46 logger->
log1(
"Initializing item options database...");
56 const char *
const name)
62 FOR_EACH (ItemFieldInfos::const_iterator, it, fields)
64 const std::string fieldName = (*it).first;
65 if (fieldName == value)
67 options.push_back((*it).second);
78 for (
int f = 0; f < 15; f ++)
80 const std::string field =
strprintf(
"field%d", f);
91 XmlNodeConstPtrConst rootNode = doc.
rootNode();
93 if ((rootNode ==
nullptr) || !xmlNameEqual(rootNode,
"itemoptions"))
97 logger->
log(
"ItemFieldDb: Error while loading %s!",
115 if (xmlNameEqual(node,
"include"))
122 if (xmlNameEqual(node,
"option"))
132 STD_VECTOR<ItemFieldType*> &options =
mOptions[id];
141 logger->
log1(
"Unloading item options database...");
148 OptionInfos::const_iterator it =
mOptions.find(
id);
static void loadXmlFile(const std::string &file, const std::string &name, BadgesInfos &arr, const SkipError skipError)
#define loadXmlDir(name, function)
#define reportAlways(...)
std::string getStringValue(const std::string &key) const
void log(const char *const log_text,...)
void log1(const char *const log_text)
#define FOR_EACH(type, iter, array)
std::map< std::string, ItemFieldType * > ItemFieldInfos
static void addFieldByName(std::vector< ItemFieldType * > &options, const xmlNodePtr node, const ItemFieldInfos &fields, const char *const name)
static void readOptionFields(std::vector< ItemFieldType * > &options, const xmlNodePtr node, const ItemFieldInfos &fields)
#define for_each_xml_child_node(var, parent)
const ItemFieldInfos & getRequiredFields()
const ItemFieldInfos & getAddFields()
void loadXmlFile(const std::string &fileName, const SkipError skipError)
const std::vector< ItemFieldType * > & getFields(const int id)
std::map< int, std::vector< ItemFieldType * > > OptionInfos
int getProperty(const xmlNodePtr node, const char *const name, int def)
const std::vector< ItemFieldType * > mEmptyOption
ItemOptionDb::OptionInfos mOptions
const bool SkipError_false
const bool SkipError_true
std::string strprintf(const char *const format,...)
const bool UseVirtFs_true