本文整理汇总了C++中CfgList::AddValue方法的典型用法代码示例。如果您正苦于以下问题:C++ CfgList::AddValue方法的具体用法?C++ CfgList::AddValue怎么用?C++ CfgList::AddValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CfgList
的用法示例。
在下文中一共展示了CfgList::AddValue方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MakeConfig
CfgList* TextureGroupHandler::MakeConfig (TextureGroup *tg)
{
CfgList *gc = new CfgList;
char n [10];
CfgList *texlist=new CfgList;
int index=0;
for (set<Texture*>::iterator t=tg->textures.begin();t!=tg->textures.end();++t) {
sprintf (n,"tex%d", index++);
texlist->AddLiteral (n, (*t)->name.c_str());
}
gc->AddValue ("textures", texlist);
gc->AddLiteral ("name", tg->name.c_str());
return gc;
}
示例2: Save
bool ArchiveList::Save () {
string fn=applicationPath + ArchiveListFile;
CfgWriter writer (fn.c_str());
if (writer.IsFailed())
return false;
CfgList cfg;
CfgList *archs=new CfgList;
cfg.AddValue ("Archives", archs);
int index=0;
for (set<string>::iterator s=archives.begin();s!=archives.end();++s, index++) {
char tmp[20];
sprintf (tmp, "arch%d", index);
archs->AddLiteral (tmp,s->c_str());
}
cfg.Write (writer,true);
return true;
}
示例3: Save
bool TextureGroupHandler::Save(const char *fn)
{
// open a cfg writer
CfgWriter writer(fn);
if (writer.IsFailed()) {
fltk::message ("Unable to save texture groups to %s\n", fn);
return false;
}
// create a config list and save it
CfgList cfg;
for (uint a=0;a<groups.size();a++) {
CfgList *gc=MakeConfig(groups[a]);
char n [10];
sprintf (n, "group%d", a);
cfg.AddValue (n, gc);
}
cfg.Write(writer,true);
return true;
}
示例4: SerializeConfig
void EditorUI::SerializeConfig (CfgList& cfg, bool store)
{
// Serialize editor window properties
int x=window->x(), y=window->y(), width=window->w(), height=window->h();
string& springTexDir = Texture::textureLoadDir;
if (store) {
CFG_STOREN(cfg,x);
CFG_STOREN(cfg,y);
CFG_STOREN(cfg,width);
CFG_STOREN(cfg,height);
CFG_STORE(cfg,springTexDir);
CFG_STORE(cfg,optimizeOnLoad);
bool showTimeline=uiTimeline->window->visible();
CFG_STORE(cfg,showTimeline);
bool showTrackEdit=uiAnimTrackEditor->window->visible();
CFG_STORE(cfg,showTrackEdit);
bool showIK=uiIK->window->visible();
CFG_STORE(cfg,showIK);
} else {
CFG_LOADN(cfg,x);
CFG_LOADN(cfg,y);
CFG_LOADN(cfg,width);
CFG_LOADN(cfg,height);
CFG_LOAD(cfg,springTexDir);
CFG_LOAD(cfg,optimizeOnLoad);
window->resize(x,y,width,height);
}
// Serialize views: first match the number of views specified in the config
int numViews = viewsGroup->children();
if (store) {
CFG_STOREN(cfg,numViews);
} else {
CFG_LOADN(cfg,numViews);
int nv=numViews-viewsGroup->children();
if (nv > 0) {
viewsGroup->begin();
for (int a=0;a<nv;a++) {
EditorViewWindow *wnd = new EditorViewWindow (0,0,0,0,&callback);
wnd->SetMode(a%4);
}
viewsGroup->end();
} else {
for (int a=viewsGroup->children()-1;a>=numViews;a--) {
EditorViewWindow *wnd = (EditorViewWindow *)viewsGroup->child(a);
viewsGroup->remove (wnd);
delete wnd;
}
}
}
// then serialize view settings for each view in the config
int viewIndex = 0;
char viewName[16];
for (int a=0;a<viewsGroup->children();++a) {
sprintf (viewName, "View%d", viewIndex++);
CfgList *viewcfg;
if (store) {
viewcfg = new CfgList;
cfg.AddValue (viewName, viewcfg);
}else viewcfg=dynamic_cast<CfgList*>(cfg.GetValue(viewName));
if (viewcfg)
((EditorViewWindow *)viewsGroup->child(a))->Serialize (*viewcfg,store);
}
}