IconsPlugin::IconsPlugin(unsigned base, const char *config) : Plugin(base) { load_data(iconsData, &data, config); smiles = NULL; if (!getSmiles().isEmpty()){ smiles = new Smiles; if (!smiles->load(getSmiles())){ delete smiles; smiles = NULL; setSmiles(NULL); } } setIcons(); }
EXPORT const char *defaultSmiles(unsigned n) { if (pDefaultSmiles == NULL){ pDefaultSmiles = new vector<string>; for (const char *p = _smiles; *p; ){ string s; for (; *p; ){ s += p; s += '\x00'; p += strlen(p) + 1; } s += '\x00'; pDefaultSmiles->push_back(s); p++; } } return getSmiles(n, pDefaultSmiles); }
EXPORT const char *smiles(unsigned n) { if (pSmiles == NULL) setSmiles(NULL); return getSmiles(n, pSmiles); }