本文整理汇总了C++中C4Value::GetDataString方法的典型用法代码示例。如果您正苦于以下问题:C++ C4Value::GetDataString方法的具体用法?C++ C4Value::GetDataString怎么用?C++ C4Value::GetDataString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类C4Value
的用法示例。
在下文中一共展示了C4Value::GetDataString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ProcessLineResult
//.........这里部分代码省略.........
}
else if (SEqualNoCase(szCmd, "LST"))
{
for (C4AulScript* script = ScriptEngine.Child0; script; script = script->Next)
{
SendLine(RelativePath(script->ScriptName));
}
}
// toggle breakpoint
else if (SEqualNoCase(szCmd, "TBR"))
{
using namespace std;
// FIXME: this doesn't find functions which were included/appended
string scriptPath = szData;
size_t colonPos = scriptPath.find(':');
if (colonPos == string::npos)
return ProcessLineResult(false, "Missing line in breakpoint request");
int line = atoi(&scriptPath[colonPos+1]);
scriptPath.erase(colonPos);
C4AulScript *script;
for (script = ScriptEngine.Child0; script; script = script->Next)
{
if (SEqualNoCase(RelativePath(script->ScriptName), scriptPath.c_str()))
break;
}
auto sh = script ? script->GetScriptHost() : NULL;
if (sh)
{
C4AulBCC * found = NULL;
for (auto script = ::ScriptEngine.Child0; script; script = script->Next)
for (C4PropList *props = script->GetPropList(); props; props = props->GetPrototype())
for (auto fname = props->EnumerateOwnFuncs(); fname; fname = props->EnumerateOwnFuncs(fname))
{
C4Value val;
if (!props->GetPropertyByS(fname, &val)) continue;
auto func = val.getFunction();
if (!func) continue;
auto sfunc = func->SFunc();
if (!sfunc) continue;
if (sfunc->pOrgScript != sh) continue;
for (auto chunk = sfunc->GetCode(); chunk->bccType != AB_EOFN; chunk++)
{
if (chunk->bccType == AB_DEBUG)
{
int lineOfThisOne = sfunc->GetLineOfCode(chunk);
if (lineOfThisOne == line)
{
found = chunk;
goto Found;
}
}
}
}
Found:
if (found)
found->Par.i = !found->Par.i; // activate breakpoint
else
return ProcessLineResult(false, "Can't set breakpoint (wrong line?)");
}
else
return ProcessLineResult(false, "Can't find script");
}
else if (SEqualNoCase(szCmd, "SST"))
{
std::list<StdStrBuf*>::iterator it = StackTrace.begin();
for (it++; it != StackTrace.end(); it++)
{
SendLine("AT", (*it)->getData());
}
SendLine("EST");
}
else if (SEqualNoCase(szCmd, "VAR"))
{
C4Value *val = NULL;
int varIndex;
C4AulScriptContext* pCtx = pExec->GetContext(pExec->GetContextDepth() - 1);
if (pCtx)
{
if ((varIndex = pCtx->Func->ParNamed.GetItemNr(szData)) != -1)
{
val = &pCtx->Pars[varIndex];
}
else if ((varIndex = pCtx->Func->VarNamed.GetItemNr(szData)) != -1)
{
val = &pCtx->Vars[varIndex];
}
}
const char* typeName = val ? GetC4VName(val->GetType()) : "any";
StdStrBuf output = FormatString("%s %s %s", szData, typeName, val ? val->GetDataString().getData() : "Unknown");
SendLine("VAR", output.getData());
}
else
return ProcessLineResult(false, "Can't do that");
return ProcessLineResult(true, "");
}