本文整理汇总了C++中KKStr::ExtractQuotedStr方法的典型用法代码示例。如果您正苦于以下问题:C++ KKStr::ExtractQuotedStr方法的具体用法?C++ KKStr::ExtractQuotedStr怎么用?C++ KKStr::ExtractQuotedStr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KKStr
的用法示例。
在下文中一共展示了KKStr::ExtractQuotedStr方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: cmdLine
CmdLineExpander::CmdLineExpander (const KKStr& _applicationName,
RunLog& _log,
const KKStr& _cmdLine
):
applicationName (_applicationName),
log (_log)
{
VectorKKStr initialParameters;
KKStr cmdLine (_cmdLine);
cmdLine.TrimLeft ();
while (!cmdLine.Empty ())
{
KKStr nextField = cmdLine.ExtractQuotedStr ("\n\r\t ", false); // false = Do not decode escape characters
nextField.TrimRight ();
if (!nextField.Empty ())
initialParameters.push_back (nextField);
cmdLine.TrimLeft ();
}
BuildCmdLineParameters (initialParameters);
BuildExpandedParameterPairs ();
}
示例2: ExtractQuotedStr
bool KKStrTest::ExtractQuotedStr ()
{
KKStr s = "TokenOne, Token;Two,'Token Three',\"\\\"Token Four\\\"\",\"Token\\tFive\"";
auto t1 = s.ExtractQuotedStr (",", true);
AssertAreEqual ("TokenOne", t1, "ExtractQuotedStr");
auto t2 = s.ExtractQuotedStr (",", true);
AssertAreEqual (" Token;Two", t2, "ExtractQuotedStr");
auto t3 = s.ExtractQuotedStr (", ", true);
AssertAreEqual ("Token Three", t3, "ExtractQuotedStr using single(') quote");
auto t4 = s.ExtractQuotedStr (",", true);
AssertAreEqual ("\"Token Four\"", t4, "ExtractQuotedStr Decode Escape Characters");
auto t5 = s.ExtractQuotedStr (",", false);
AssertAreEqual ("Token\\tFive", t5, "ExtractQuotedStr Don't Decode Escape Characters");
return true;
}
示例3: ImportValidatedClassInfo
void ImportValidatedClassInfo ()
{
RunLog log;
KKStr srcFileName = "D:\\Users\\kurt\\OneDrive\\Sipper\\FromAndrewToKurt\\Validation\\2014-09-16\\ValidatedImagesList.txt";
KKStr classNameFileName = "D:\\Users\\kurt\\OneDrive\\Sipper\\FromAndrewToKurt\\Validation\\2014-09-16\\ClassList.txt";
map<int, KKStr> classNameLookup;
map<int, KKStr>::iterator idx;
FILE* cnl = KKB::osFOPEN(classNameFileName.Str (), "r");
KKStrPtr line = KKB::osReadNextLine (cnl);
while (line)
{
if (!line->Empty())
{
auto fields = line->Parse("\t");
if (fields.size() > 2)
{
int classId = fields[0].ToInt32();
KKStr className = fields[1];
classNameLookup.insert(pair<int, KKStr>(classId, className));
}
}
delete line;
line = KKB::osReadNextLine (cnl);
}
ifstream i (srcFileName.Str ());
if (!i.is_open ())
return;
DataBasePtr dbConn = new DataBase (log);
if (!dbConn)
return;
char buff[20480];
int count = 0;
KKStr s (1024);
KKStr imageFileName;
int validatedClassId;
KKStr validatedClassName;
KKStr errMsg = "";
while (i.getline (buff, sizeof (buff)))
{
count++;
s = buff;
imageFileName = s.ExtractQuotedStr (",\n\t\r", false);
if (imageFileName.StartsWith("ETP"))
{
validatedClassId = s.ExtractTokenInt (",\n\t\r");
//validatedClassName = s.ExtractQuotedStr (",\n\t\r", false);
idx = classNameLookup.find(validatedClassId);
if (idx != classNameLookup.end())
{
validatedClassName = idx->second;
MLClassPtr c = MLClass::CreateNewMLClass (validatedClassName);
dbConn->ImagesUpdateValidatedClass (imageFileName, c);
if (!dbConn->Valid ())
errMsg = dbConn->LastErrorDesc ();
cout << count << "\t" << imageFileName << "\t" << validatedClassName << "\t" << errMsg << endl;
}
errMsg = "";
}
}
} /* ImportValidatedClassInfo */