mirror of
https://github.com/1dot13/source.git
synced 2026-09-09 14:46:05 +02:00
**********************************************************
** Big Maps Projects code (incl. Multiplayer v1.5 ** ********************************************************** - Merged Big Maps Project code from BMP+MP trunk (Revision: 3340) o Complete SVN Revision history: https://81.169.133.124/source/ja2/branches/Wanne/JA2%201.13%20MP - Before THIS merge, I made a branch of the existing 1.13 source o SVN Branch: https://81.169.133.124/source/ja2/branches/JA2_rev.3336/src - Removed old VS 6.0 and VS 2003 project and solutions files, because compilation is broken long time ago - I will add VS 2010 projects and solution file in the next few days git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@3341 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
+46
-44
@@ -9,7 +9,7 @@
|
||||
#include <list>
|
||||
#include <set>
|
||||
|
||||
class CPropertyContainer
|
||||
class VFS_API CPropertyContainer
|
||||
{
|
||||
public:
|
||||
class TagMap
|
||||
@@ -17,11 +17,11 @@ public:
|
||||
typedef std::map<utf8string,utf8string> tTagMap;
|
||||
public:
|
||||
TagMap();
|
||||
utf8string const& Container(utf8string::char_t* container = NULL);
|
||||
utf8string const& Section(utf8string::char_t* section = NULL);
|
||||
utf8string const& SectionID(utf8string::char_t* section_id = NULL);
|
||||
utf8string const& Key(utf8string::char_t* key = NULL);
|
||||
utf8string const& KeyID(utf8string::char_t* key_id = NULL);
|
||||
utf8string const& container(utf8string::char_t* container = NULL);
|
||||
utf8string const& section(utf8string::char_t* section = NULL);
|
||||
utf8string const& sectionID(utf8string::char_t* section_id = NULL);
|
||||
utf8string const& key(utf8string::char_t* key = NULL);
|
||||
utf8string const& keyID(utf8string::char_t* key_id = NULL);
|
||||
private:
|
||||
tTagMap _map;
|
||||
};
|
||||
@@ -29,77 +29,79 @@ public:
|
||||
CPropertyContainer(){};
|
||||
~CPropertyContainer(){};
|
||||
|
||||
void ClearContainer();
|
||||
void clearContainer();
|
||||
|
||||
bool InitFromIniFile(vfs::Path const& sFileName);
|
||||
bool InitFromIniFile(vfs::tReadableFile *pFile);
|
||||
bool WriteToIniFile(vfs::Path const& sFileName, bool bCreateNew = false);
|
||||
bool initFromIniFile(vfs::Path const& sFileName);
|
||||
bool initFromIniFile(vfs::tReadableFile *pFile);
|
||||
bool writeToIniFile(vfs::Path const& sFileName, bool bCreateNew = false);
|
||||
|
||||
bool InitFromXMLFile(vfs::Path const& sFileName, TagMap& tagmap);
|
||||
bool WriteToXMLFile(vfs::Path const& sFileName, TagMap& tagmap);
|
||||
bool initFromXMLFile(vfs::Path const& sFileName, TagMap& tagmap);
|
||||
bool writeToXMLFile(vfs::Path const& sFileName, TagMap& tagmap);
|
||||
|
||||
void PrintProperties();
|
||||
void printProperties();
|
||||
|
||||
bool hasProperty(utf8string const& sSection, utf8string const& sKey);
|
||||
//
|
||||
utf8string const& GetStringProperty(utf8string const& sSection, utf8string const& sKey, utf8string const& sDefaultValue=L"");
|
||||
bool GetStringProperty(utf8string const& sSection, utf8string const& sKey, utf8string& sValue, utf8string const& sDefaultValue=L"");
|
||||
bool GetStringProperty(utf8string const& sSection, utf8string const& sKey, utf8string::char_t* sValue, vfs::UInt32 len, utf8string const& sDefaultValue=L"");
|
||||
utf8string const& getStringProperty(utf8string const& sSection, utf8string const& sKey, utf8string const& sDefaultValue=L"");
|
||||
bool getStringProperty(utf8string const& sSection, utf8string const& sKey, utf8string& sValue, utf8string const& sDefaultValue=L"");
|
||||
bool getStringProperty(utf8string const& sSection, utf8string const& sKey, utf8string::char_t* sValue, vfs::size_t len, utf8string const& sDefaultValue=L"");
|
||||
//
|
||||
vfs::Int64 GetIntProperty(utf8string const& sSection, utf8string const& sKey, vfs::Int64 iDefaultValue);
|
||||
vfs::Int64 GetIntProperty(utf8string const& sSection, utf8string const& sKey, vfs::Int64 iDefaultValue, vfs::Int64 iMinValue, vfs::Int64 iMaxValue);
|
||||
vfs::Int64 getIntProperty(utf8string const& sSection, utf8string const& sKey, vfs::Int64 iDefaultValue);
|
||||
vfs::Int64 getIntProperty(utf8string const& sSection, utf8string const& sKey, vfs::Int64 iDefaultValue, vfs::Int64 iMinValue, vfs::Int64 iMaxValue);
|
||||
//
|
||||
vfs::UInt64 GetUIntProperty(utf8string const& sSection, utf8string const& sKey, vfs::UInt64 iDefaultValue);
|
||||
vfs::UInt64 GetUIntProperty(utf8string const& sSection, utf8string const& sKey, vfs::UInt64 iDefaultValue, vfs::UInt64 iMinValue, vfs::UInt64 iMaxValue);
|
||||
vfs::UInt64 getUIntProperty(utf8string const& sSection, utf8string const& sKey, vfs::UInt64 iDefaultValue);
|
||||
vfs::UInt64 getUIntProperty(utf8string const& sSection, utf8string const& sKey, vfs::UInt64 iDefaultValue, vfs::UInt64 iMinValue, vfs::UInt64 iMaxValue);
|
||||
//
|
||||
double GetFloatProperty(utf8string const& sSection, utf8string const& sKey, double fDefaultValue);
|
||||
double GetFloatProperty(utf8string const& sSection, utf8string const& sKey, double fDefaultValue, double fMinValue, double fMaxValue);
|
||||
double getFloatProperty(utf8string const& sSection, utf8string const& sKey, double fDefaultValue);
|
||||
double getFloatProperty(utf8string const& sSection, utf8string const& sKey, double fDefaultValue, double fMinValue, double fMaxValue);
|
||||
//
|
||||
bool GetBoolProperty(utf8string const& sSection, utf8string const& sKey, bool bDefaultValue);
|
||||
bool getBoolProperty(utf8string const& sSection, utf8string const& sKey, bool bDefaultValue);
|
||||
//
|
||||
bool GetStringListProperty(utf8string const& sSection, utf8string const& sKey, std::list<utf8string> &lValueList, utf8string sDefaultValue);
|
||||
bool GetIntListProperty(utf8string const& sSection, utf8string const& sKey, std::list<vfs::Int64> &lValueList, vfs::Int64 iDefaultValue);
|
||||
bool GetUIntListProperty(utf8string const& sSection, utf8string const& sKey, std::list<vfs::UInt64> &lValueList, vfs::UInt64 iDefaultValue);
|
||||
bool GetFloatListProperty(utf8string const& sSection, utf8string const& sKey, std::list<double> &lValueList, double fDefaultValue);
|
||||
bool GetBoolListProperty(utf8string const& sSection, utf8string const& sKey, std::list<bool> &lValueList, bool bDefaultValue);
|
||||
bool getStringListProperty(utf8string const& sSection, utf8string const& sKey, std::list<utf8string> &lValueList, utf8string sDefaultValue);
|
||||
bool getIntListProperty(utf8string const& sSection, utf8string const& sKey, std::list<vfs::Int64> &lValueList, vfs::Int64 iDefaultValue);
|
||||
bool getUIntListProperty(utf8string const& sSection, utf8string const& sKey, std::list<vfs::UInt64> &lValueList, vfs::UInt64 iDefaultValue);
|
||||
bool getFloatListProperty(utf8string const& sSection, utf8string const& sKey, std::list<double> &lValueList, double fDefaultValue);
|
||||
bool getBoolListProperty(utf8string const& sSection, utf8string const& sKey, std::list<bool> &lValueList, bool bDefaultValue);
|
||||
//
|
||||
void SetStringProperty(utf8string const& sSection, utf8string const& sKey, utf8string const& sValue);
|
||||
void setStringProperty(utf8string const& sSection, utf8string const& sKey, utf8string const& sValue);
|
||||
//
|
||||
void SetIntProperty(utf8string const& sSection, utf8string const& sKey, vfs::Int64 const& iValue);
|
||||
void SetUIntProperty(utf8string const& sSection, utf8string const& sKey, vfs::UInt64 const& iValue);
|
||||
void SetFloatProperty(utf8string const& sSection, utf8string const& sKey, double const& fValue);
|
||||
void SetBoolProperty(utf8string const& sSection, utf8string const& sKey, bool const& bValue);
|
||||
void setIntProperty(utf8string const& sSection, utf8string const& sKey, vfs::Int64 const& iValue);
|
||||
void setUIntProperty(utf8string const& sSection, utf8string const& sKey, vfs::UInt64 const& iValue);
|
||||
void setFloatProperty(utf8string const& sSection, utf8string const& sKey, double const& fValue);
|
||||
void setBoolProperty(utf8string const& sSection, utf8string const& sKey, bool const& bValue);
|
||||
//
|
||||
void SetStringListProperty(utf8string const& sSection, utf8string const& sKey, std::list<utf8string> const& slValue);
|
||||
void SetIntListProperty(utf8string const& sSection, utf8string const& sKey, std::list<vfs::Int64> const& ilValue);
|
||||
void SetUIntListProperty(utf8string const& sSection, utf8string const& sKey, std::list<vfs::UInt64> const& ilValue);
|
||||
void SetFloatListProperty(utf8string const& sSection, utf8string const& sKey, std::list<double> const& flValue);
|
||||
void SetBoolListProperty(utf8string const& sSection, utf8string const& sKey, std::list<bool> const& blValue);
|
||||
void setStringListProperty(utf8string const& sSection, utf8string const& sKey, std::list<utf8string> const& slValue);
|
||||
void setIntListProperty(utf8string const& sSection, utf8string const& sKey, std::list<vfs::Int64> const& ilValue);
|
||||
void setUIntListProperty(utf8string const& sSection, utf8string const& sKey, std::list<vfs::UInt64> const& ilValue);
|
||||
void setFloatListProperty(utf8string const& sSection, utf8string const& sKey, std::list<double> const& flValue);
|
||||
void setBoolListProperty(utf8string const& sSection, utf8string const& sKey, std::list<bool> const& blValue);
|
||||
private:
|
||||
enum EOperation
|
||||
{
|
||||
Error, Set, Add,
|
||||
};
|
||||
bool ExtractSection(utf8string::str_t const& readStr, size_t startPos, utf8string::str_t& sSection);
|
||||
EOperation ExtractKeyValue(utf8string::str_t const &readStr, size_t startPos, utf8string::str_t& sKey, utf8string::str_t& sValue);
|
||||
bool extractSection(utf8string::str_t const& readStr, vfs::size_t startPos, utf8string::str_t& sSection);
|
||||
EOperation extractKeyValue(utf8string::str_t const &readStr, vfs::size_t startPos, utf8string::str_t& sKey, utf8string::str_t& sValue);
|
||||
private:
|
||||
class CSection
|
||||
{
|
||||
friend class CPropertyContainer;
|
||||
typedef std::map<utf8string,utf8string, utf8string::Less> tProps;
|
||||
public:
|
||||
bool has(utf8string const& key);
|
||||
bool add(utf8string const& key, utf8string const& value);
|
||||
bool value(utf8string const& key, utf8string& value);
|
||||
utf8string& value(utf8string const& key);
|
||||
void Print(std::ostream& out, utf8string::str_t sPrefix = L"");
|
||||
void Clear();
|
||||
void print(std::ostream& out, utf8string::str_t sPrefix = L"");
|
||||
void clear();
|
||||
private:
|
||||
tProps mapProps;
|
||||
};
|
||||
typedef std::map<utf8string, CSection, utf8string::Less> tSections;
|
||||
|
||||
bool GetValueForKey(utf8string const& sSection, utf8string const& sKey, utf8string &sValue);
|
||||
bool getValueForKey(utf8string const& sSection, utf8string const& sKey, utf8string &sValue);
|
||||
|
||||
CSection& Section(utf8string const& sSection);
|
||||
CSection& section(utf8string const& sSection);
|
||||
|
||||
tSections m_mapProps;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user