Path: blob/main/RSDKv4/Ini.hpp
817 views
#ifndef INI_H1#define INI_H23#include <vector>45class IniParser6{7public:8enum ItemType {9INI_ITEM_STRING,10INI_ITEM_INT,11INI_ITEM_FLOAT,12INI_ITEM_BOOL,13INI_ITEM_COMMENT,14};1516struct ConfigItem {17ConfigItem()18{19sprintf(section, "%s", "");20sprintf(key, "%s", "");21sprintf(value, "%s", "");22hasSection = false;23type = INI_ITEM_STRING;24}25char section[0x20];26bool hasSection = false;27char key[0x40];28char value[0x100];29byte type = INI_ITEM_STRING;30};3132IniParser() { items.clear(); }33IniParser(const char *filename, bool addPath = true);3435int GetString(const char *section, const char *key, char *dest);36int GetInteger(const char *section, const char *key, int *dest);37int GetFloat(const char *section, const char *key, float *dest);38int GetBool(const char *section, const char *key, bool *dest);39int SetString(const char *section, const char *key, char *value);40int SetInteger(const char *section, const char *key, int value);41int SetFloat(const char *section, const char *key, float value);42int SetBool(const char *section, const char *key, bool value);43int SetComment(const char *section, const char *key, const char *comment);44void Write(const char *filename, bool addPath = true);4546std::vector<ConfigItem> items;47};48#endif // !INI_H495051