Removed ini-file stuff. Sorry Skrebbel, but it wasn't good enough ;)

This commit is contained in:
Erik Faye-Lund 2009-01-14 15:44:19 +00:00
parent 18410f89f3
commit bd4c5d31b3
5 changed files with 0 additions and 81 deletions

View File

@ -184,10 +184,6 @@
>
</File>
<File
RelativePath=".\inifile.cpp"
>
</File>
<File
RelativePath="..\sync\network.cpp"
>
</File>

View File

@ -1,4 +0,0 @@
#include "inifile.h"
std::string IniFile::filename;
std::string IniFile::section;

View File

@ -1,62 +0,0 @@
#pragma once
#include <string>
#include <windows.h>
class IniFile
{
protected:
static std::string filename;
static std::string section;
public:
static std::string getFullPath(std::string filename)
{
char fullpath[100];
char* dummy;
GetFullPathName(filename.c_str(), 100, fullpath, &dummy);
return std::string(fullpath);
}
static void load(std::string filename)
{
IniFile::filename = getFullPath(filename);
}
static void load(std::string filename, std::string section)
{
load(filename);
setSection(section);
}
static void setSection(std::string section)
{
IniFile::section = section;
}
static bool check()
{
char buf[10];
return (GetPrivateProfileSectionNames( buf, 10, filename.c_str() )) ? true : false;
}
static int get(std::string filename, std::string section, std::string key, int defaultValue=INT_MAX)
{
return GetPrivateProfileInt(section.c_str(), key.c_str(), defaultValue, filename.c_str());
}
static int get(std::string section, std::string key, int defaultValue=INT_MAX)
{
return get(filename, section, key, defaultValue);
}
static int get(std::string key, int defaultValue=INT_MAX)
{
return get(filename, section, key, defaultValue);
}
static void read(int &var, std::string filename, std::string section, std::string key)
{
var = get(filename, section, key, var);
}
static void read(int &var, std::string section, std::string key)
{
var = get(filename, section, key, var);
}
static void read(int &var, std::string key)
{
var = get(filename, section, key, var);
}
};

View File

@ -6,7 +6,6 @@
#include "../sync/network.h"
#include "../sync/data.h"
#include "inifile.h"
#include <stack>
#include <list>
#include <vector>

View File

@ -51,16 +51,6 @@ void TrackView::setFont(HFONT font)
TrackView::TrackView()
{
IniFile::load("rocket.ini", "GUI");
if(IniFile::check())
{
//read directly into variables, using their current values
//as defaults in case the ini file or the keys are not found.
IniFile::read(rowHeight, "fontHeight");
IniFile::read(fontWidth, "fontWidth");
}
scrollPosX = 0;
scrollPosY = 0;
windowWidth = -1;