/* Loads a configuration file following the proper format. */ #ifndef CONFIG_LOADER_H_ #define CONFIG_LOADER_H_ #include #include using namespace std; #ifdef WIN32 #pragma warning(disable : 4996) #endif struct CF { char tag[500]; char info[500]; CF(char* pTag1, char *info1) { memset(tag, 0, 500); memset(info, 0, 500); strcpy(tag, pTag1); strcpy(info, info1); } }; class ConfigLoader { public: ConfigLoader(); ~ConfigLoader(); int Load(char* pFile); int GetDataAsInt(char* pName, int* pDestBuf); int GetDataAsBool(char* pName, bool* pDestBuf); int GetDataAsUInt(char* pName, unsigned int* pDest); int GetDataAsShort(char* pName, short* pDest); int GetDataAsShortX(char* pName, unsigned short* pDestBuf); int GetCFIndexByName(char* pName); int GetDataAsString(char* pName, char* pDestBuf); int GetDataAsIPBytes(char* pName, unsigned char* pDestBuf); bool ErrorOccurred(); void CleanUp(); private: vector mArgs; int mErrorCode; }; #endif