本文整理汇总了C++中CExpression::ParseUserString方法的典型用法代码示例。如果您正苦于以下问题:C++ CExpression::ParseUserString方法的具体用法?C++ CExpression::ParseUserString怎么用?C++ CExpression::ParseUserString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CExpression
的用法示例。
在下文中一共展示了CExpression::ParseUserString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateFromString
void CEditorParam::CreateFromString(CString src, CApplication* pApp, int type, CString reserved, bool exporting)
{
m_type = type;
m_reserved = reserved;
///////////////////
// Object types
///////////////////
CObjTypeMap& typemap = pApp->object_types;
int unused;
// Tokenise the expression with editormode
CExpression tokeniser;
tokeniser.pCallerType = pApp->FindObjTypeFromNumber(oid);
tokeniser.oidCaller = oid;
tokeniser.ParseUserString(src, &unused, !exporting);
ttokens = tokeniser.toks;
ProcessEdittimeExpressionInformation(ttokens, pApp, oid);
/*
// Davo's version
tokens.clear();
// We need to create
CString copy;
copy = src;
char* f = copy.LockBuffer();
char* c = f;
char* tmp = c;
CString name;
CString tok;
bool quote = false;
while((char)(*c)) // c has not reached null
{
name = "";
// test if we are reading a name
if( *c == '"')
quote = 1 - quote;
while(CharPartOfName(*c) && !quote) // post incr c
{
name += (char)(*c);
c++;
}
if(name != "")
{
long number;
bool found = false;
POSITION pos = typemap.GetStartPosition();
CObjType* obj;
bool IsFamily = false;
while(pos)
{
typemap.GetNextAssoc(pos, number, obj);
if(obj->m_name == name)
{
found = true;
break;
}
}
for(list<CFamily>::iterator i = pApp->m_Families.begin(); i != pApp->m_Families.end(); i++)
{
CString l = i->m_Name;
CString r = name;
l.MakeLower();
r.MakeLower();
if(l == r)
{
found = true;
IsFamily = true;
break;
}
}
if(found) // we have found an object name
{
//save last token
if(tok != "")
{
CEditorParamToken token;
token.tok = tok;
token.type = PTOK_STRING;
token.trans = true;
tokens.push_back(token);
}
// now record the object name
if(IsFamily) // family
{
//.........这里部分代码省略.........