Application* Application::Instance() {
if(!_self) _self = new Application();
return _self;
}
int Application::loadIniInt(string& section, string& var) {
printf("loadIni\n");
return 100;
}
void Application::saveIniInt(string& section, string& var, int val) {
printf("saveIni\n");
}
void Application::Run() {
wnd=new Window();
//цикл обработки сообщений
delete wnd;
}
Application* Application::_self=NULL;
#include "app.h"
class Window {
int width;
int height;
public:
Window() {
Application *p=Application::Instance();
p->loadIniInt(string("Window"), string("width"));
p->loadIniInt(string("Window"), string("height"));
}
~Window() {
Application *p=Application::Instance();
p->saveIniInt(string("Window"), string("width"), width);