本文整理汇总了C++中ConfigMap::pack方法的典型用法代码示例。如果您正苦于以下问题:C++ ConfigMap::pack方法的具体用法?C++ ConfigMap::pack怎么用?C++ ConfigMap::pack使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConfigMap
的用法示例。
在下文中一共展示了ConfigMap::pack方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadProc
void Loader::loadProc()
{
Toolkit toolkit;
app->config->load();
string cmd;
#define createdir(d) cmd = string("mkdir -p ") + app-> d;system(cmd.c_str());assert(toolkit.dirExists(app-> d));
createdir(dirCache);
createdir(dirCacheIcons);
createdir(dirProperties);
createdir(dirTranslation);
std::ofstream fstr;
fstr.open(app->loadFile, std::ios::out | std::ios::binary);
assert(fstr.is_open());
struct IconRec
{
string name;
int size;
};
vector<IconRec> vicons;
ApplicationLoader appLoader;
appLoader.getItems(vapplications);
CategoryLoader catLoader;
catLoader.init(&vapplications);
appLoader.insertPlaces(vapplications);
//------------- load applications
for (auto deskrec : vapplications)
{
//printf("\napp %s %s", deskrec.title.c_str(),deskrec.category.c_str());
ConfigMap cmap;
cmap["itemtype"] = res.itemApp;
deskrec.attrs = sutl::encode(deskrec.attr.pack(), attrEscape);
#define rec2map(name) cmap[#name]=deskrec.name
rec2map(iconName);
rec2map(title);
rec2map(genname);
rec2map(loctitle);
rec2map(locgenname);
rec2map(command);
rec2map(comment);
rec2map(loccomment);
rec2map(fname);
rec2map(categories);
rec2map(attrs);
#undef rec2map
string catMoveTo = app->properties->get(deskrec, res.pkeyMoveToCategory);
int iconSize = CFGI("app_icon_size");
CategoryLoader::CategoryRec catrec;
if (!catMoveTo.empty())
{
catrec.category = catMoveTo;
} else if (sutl::startsWith(deskrec.fname, toolkit.desktopDir()))
{
catrec.category = res.categoryDesktop;
catrec.loctitle = res.categoryDesktop_loc;
catrec.iconName = CFG("icon_place_desktop");
} else if (deskrec.category == res.categoryPlaces)
{
catrec.category = res.categoryPlaces;
catrec.iconName = CFG("icon_category_places");
cmap["itemtype"] = res.itemPlace;
iconSize = CFGI("place_icon_size");
} else
{
catrec = catLoader.getCategory(deskrec);
if (catrec.category.empty())
{
//catrec.category = res.categoryOther;
continue;
}
}
vicons.push_back( { deskrec.iconName, iconSize });
if (vcategories.find(catrec.category) == vcategories.end())
{
vcategories[catrec.category] = catrec;
}
cmap["category"] = catrec.category;
string raw = cmap.pack();
raw = sutl::encode(raw);
fstr << raw << "\n";
}
//.........这里部分代码省略.........