本文整理汇总了C++中Serialiser::serialiseValue方法的典型用法代码示例。如果您正苦于以下问题:C++ Serialiser::serialiseValue方法的具体用法?C++ Serialiser::serialiseValue怎么用?C++ Serialiser::serialiseValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Serialiser
的用法示例。
在下文中一共展示了Serialiser::serialiseValue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: scanStmt
//.........这里部分代码省略.........
if(cg->isCompiling())
error("can only run 'savevar' in interactive mode");
if(tok->getnext()!=T_IDENT)
error("expected a variable name after 'savevar'");
const char *vname = tok->getstring();
int vdesc = lana->consts->findOrCreateString(vname);
if(tok->getnext()!=T_STRING)
error("expected a string after 'savevar'");
const char *fname = tok->getstring();
// try to get the value
Value *v;
int id;
id = lana->globs->find(vdesc);
if(id>=0) {
v = lana->globs->get(id); // it's a global
} else {
id = ses->findSesVar(vdesc);
if(id<0)
error("variable not found: %s",lana->consts->getStr(vdesc));
v = ses->getSesVar(id);
}
FILE *a;
if(!strlen(fname))
a = stdout;
else
a = fopen(fname,"w");
if(!a)
error("cannot open file '%s'",fname);
Serialiser *ser = new Serialiser(ses);
ser->serialiseValue(a,v,lana->consts->getStr(vdesc));
if(strlen(fname))
fclose(a);
delete ser;
}
break;
case T_FOR:
scanFor();
break;
case T_ENDFOR:
scanEndFor();
break;
case T_THIS:
tok->rewind(); // put the token back
if(!scanExpr(true))
// clear all statements if not a func or other oddity,
// or just a dummy for recreation purposes if in immediate mode.
cg->emit(cg->isCompiling()?OP_ENDESTMT:OP_ENDESTMT2);
break;
case T_GOTO:
if(!cg->isCompiling())
error("must be compiling a function/procedure to use '%s'",tok->getstring());
scanGoto();
break;
case T_ENDFUNC:
scanEndFunc();
break;
case T_END:
if(!(lana->opFlags & LOP_STRIPCOMMENTS))
cg->emit(OP_BLANKLINE); // yes, these are wasteful .. very slightly
break;
case T_IF:
// first we push a special value onto the compiler stack