geode/loader/include/Geode/cocos/robtop/xml/DS_Dictionary.h

96 lines
3.6 KiB
C
Raw Normal View History

2022-07-30 12:24:03 -04:00
#ifndef __DS_DICTIONARY_H__
#define __DS_DICTIONARY_H__
#include "pugixml.hpp"
#include <vector>
#include "../../include/cocos2d.h"
2022-07-30 12:24:03 -04:00
class CC_DLL DS_Dictionary {
public:
pugi::xml_document doc;
gd::vector<pugi::xml_node> dictTree;
bool compatible;
public:
gd::string cleanStringWhiteSpace(const gd::string&);
2023-12-20 21:14:53 -05:00
void split(gd::string const&, char const*, gd::vector<gd::string>&);
2022-07-30 12:24:03 -04:00
bool splitWithForm(const gd::string&, gd::vector<gd::string>&);
bool rectFromString(const gd::string&, cocos2d::CCRect&);
bool vec2FromString(const gd::string&, cocos2d::CCPoint&);
public:
DS_Dictionary();
~DS_Dictionary() {}
2023-04-02 10:30:53 -04:00
GEODE_CUSTOM_CONSTRUCTOR_BEGIN(DS_Dictionary)
2022-07-30 12:24:03 -04:00
static void copyFile(const char*, const char*);
cocos2d::CCObject* decodeObjectForKey(const char*, bool, int);
bool loadRootSubDictFromFile(const char*);
bool loadRootSubDictFromCompressedFile(const char*);
2023-12-20 21:14:53 -05:00
bool loadRootSubDictFromString(gd::string const&);
2022-07-30 12:24:03 -04:00
bool saveRootSubDictToFile(const char*);
bool saveRootSubDictToCompressedFile(const char*);
gd::string saveRootSubDictToString();
bool stepIntoSubDictWithKey(const char*);
void stepOutOfSubDict();
void stepBackToRootSubDict();
unsigned int getNumKeys();
gd::string getKey(unsigned int);
gd::vector<gd::string> getAllKeys();
unsigned int getIndexOfKey(const char*);
unsigned int getIndexOfKeyWithClosestAlphaNumericalMatch(const char*);
void removeKey(unsigned int);
void removeKey(const char*);
void removeAllKeys();
int getIntegerForKey(const char*);
bool getBoolForKey(const char*);
float getFloatForKey(const char*);
gd::string getStringForKey(const char*);
cocos2d::CCPoint getVec2ForKey(const char*);
cocos2d::CCRect getRectForKey(const char*);
gd::vector<gd::string> getStringArrayForKey(const char*);
gd::vector<cocos2d::CCPoint> getVec2ArrayForKey(const char*);
gd::vector<cocos2d::CCRect> getRectArrayForKey(const char*);
cocos2d::CCArray* getArrayForKey(const char*, bool);
cocos2d::CCDictionary* getDictForKey(const char*, bool);
cocos2d::CCObject* getObjectForKey(const char*);
void setIntegerForKey(const char*, int);
void setIntegerForKey(const char*, int, bool);
void setBoolForKey(const char*, bool);
void setBoolForKey(const char*, bool, bool);
void setFloatForKey(const char*, float);
void setFloatForKey(const char*, float, bool);
void setStringForKey(const char*, const gd::string&);
void setStringForKey(const char*, const gd::string&, bool);
void setVec2ForKey(const char*, const cocos2d::CCPoint&);
void setVec2ForKey(const char*, const cocos2d::CCPoint&, bool);
void setRectForKey(const char*, const cocos2d::CCRect&);
void setRectForKey(const char*, const cocos2d::CCRect&, bool);
void setStringArrayForKey(const char*, const gd::vector<gd::string>&);
void setStringArrayForKey(const char*, const gd::vector<gd::string>&, bool);
void setVec2ArrayForKey(const char*, const gd::vector<cocos2d::CCPoint>&);
void setVec2ArrayForKey(const char*, const gd::vector<cocos2d::CCPoint>&, bool);
void setRectArrayForKey(const char*, const gd::vector<cocos2d::CCRect>&);
void setRectArrayForKey(const char*, const gd::vector<cocos2d::CCRect>&, bool);
void setArrayForKey(const char*, cocos2d::CCArray*);
2023-12-20 21:14:53 -05:00
void setBoolMapForKey(const char*, gd::map<gd::string, bool>&);
2022-07-30 12:24:03 -04:00
void setSubDictForKey(const char*);
void setSubDictForKey(const char*, bool, bool);
void setDictForKey(const char*, cocos2d::CCDictionary*);
void setObjectForKey(const char*, cocos2d::CCObject*);
2023-12-20 21:14:53 -05:00
void addBoolValuesToMapForKey(gd::map<gd::string, bool>&, const char*, bool);
void addBoolValuesToMapForKeySpecial(gd::map<gd::string, bool>&, const char*, bool);
2022-07-30 12:24:03 -04:00
void checkCompatibility();
};
#endif