Jump to content


Check out our Community Blogs

notes

Member Since 09 Apr 2011
Offline Last Active Apr 25 2013 02:09 AM
-----

Topics I've Started

[SOLVED][Qt]Project help - displaying doc file.

24 September 2012 - 06:45 AM

Hello.

I have a project to make for my app programming classes. A Qt based 'previewer' of a doc files. I want to be able to put like 10 c++ tutorials on combo box, list view or anything else and then user will choose one to be displayed in the application window. I know the basics of Qt libraries (Buttons, views, layouts ect...) but I dont have idea how to open/display .doc file in my application window... Could anyone point me a direction how to do it ? Where to read about this stuff ?

Regards,
notes.

[C++] Proper memento implementation.

08 September 2012 - 04:28 AM

Hi,

I've myself came up with memento design pattern implementation. Please tell me if it's right way to implement this.
Code is for VS 2010

memento.h
#pragma once
#include "stdafx.h"
class Memento {
private:
string state;
public :
Memento(string stateToSave) {
  state = stateToSave;
}
string get_saved_state() {
  return state;
}
};
class Originator {
private:
string state;
public :
void set (string state_) {
  cout << "\nSetting state to: "<<state_ << endl;
  state = state_;
}
Memento save_to_mem() {
  cout << "Saving to memento...\n";
  return Memento(state);
}
void restore_from_mem(Memento mem) {
  state = mem.get_saved_state();
  cout << "Restoring from memento to state :"
   << state << endl;
}
};

main.cpp:
#include "stdafx.h"
void memento_main() {
cout << " \tMemento\n";
Originator or;
vector<Memento> memVector;
or.set("State 1");
memVector.push_back(or.save_to_mem());
or.set("State 2");

Memento m = memVector.at(0);
memVector.pop_back();
or.restore_from_mem(m);
}

int _tmain(int argc, _TCHAR* argv[])
{
memento_main();
//system("Pause");
return 0;
}


I was trying to avoid nesting classes cause I have few big classes I don't want to modify but in some part of program objects of theese classes need to be restored to previous state. Eg. Shop in RPG game - User can put new armor on and check stats, and then buy or discard changes.

Indie Games

17 July 2012 - 06:40 AM

Have you played lately any Indie game that you want to recommend, review ? Post it here.

I've made this topic, cause I like indie games but I don't exactly know where to start for searching ones.

I ve played : Desktop Dungeons and it was fun RPG game. Very, very addicting .
Here is official page : http://www.desktopdungeons.net/

Also played 2d platform game called Limbo. It has very strange graphics. But if you like logical riddles and gloomy, dark mood. It's for you.
Here is official page :http://limbogame.org/

Is That Proper Uml According To Code [C++] ?

12 July 2012 - 08:55 AM

I've started to learn UML cause I have assignment that will have to be provided with UML graphs.

I have this piece of code :
#pragma once
#include "stdafx.h"
class ProxyBase {
public :
virtual void f() = 0;
virtual void g() = 0;
virtual void h() = 0;
};
class Implementation : public ProxyBase {
public:
void f() { cout << "Implementatnon f()" << endl; }
void g() { cout << "Implementation g()" << endl; }
void h() { cout << "Implementation h()" << endl; }
};
class Proxy : public ProxyBase {
ProxyBase* implementation;
public :
Proxy() { implementation = new Implementation();}
~Proxy() { delete implementation;}
void f() { implementation -> f(); }
void g() { implementation -> g(); }
void h() { implementation -> h(); }
};

This is implementation of proxy design pattern from thinking in c++.

I' ve attached .jpg UML graph also on imageshack :
http://desmond.image...jpg&res=landing
I don't know how to write that function is virtual ( do I have to ? Since it's interface ? ), also Is this right arrow I should use to point delegate ?

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download