本文整理汇总了C++中KKStr::ExtractTokenInt方法的典型用法代码示例。如果您正苦于以下问题:C++ KKStr::ExtractTokenInt方法的具体用法?C++ KKStr::ExtractTokenInt怎么用?C++ KKStr::ExtractTokenInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KKStr
的用法示例。
在下文中一共展示了KKStr::ExtractTokenInt方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FromDelStr
PointListPtr PointList::FromDelStr (const KKStr& _s)
{
PointListPtr result = new PointList (true);
KKStr s (_s);
s.TrimLeft ();
while (s.Len () > 0)
{
char nextCh = s.FirstChar ();
char endPairChar = 0;
if (nextCh == '[')
endPairChar = ']';
else if (nextCh == '(')
endPairChar = ')';
else
{
// Not Bracketed.
endPairChar = 0;
kkint16 row = (kkint16)s.ExtractTokenInt (",\t\n\t");
kkint16 col = (kkint16)s.ExtractTokenInt (",\t\n\t");
result->PushOnBack (new Point (row, col));
}
if (endPairChar != 0)
{
KKStr pairStr = "";
auto idx = s.Find (endPairChar);
if (idx)
{
pairStr = s.SubStrSeg (0, idx);
s = s.SubStrPart (idx + 1);
}
else
{
pairStr = s;
s = "";
}
kkint16 row = (kkint16)pairStr.ExtractTokenInt (",");
kkint16 col = (kkint16)pairStr.ExtractTokenInt (",");
result->PushOnBack (new Point (row, col));
nextCh = s.FirstChar ();
if ((nextCh == ',') || (nextCh == '\n') || (nextCh == '\r') || (nextCh == '\t'))
s.ChopFirstChar ();
}
s.TrimLeft ();
}
return result;
} /* FromDelStr */
示例2: StatusFileProcessLineJobStatusChange
void KKJobManager::StatusFileProcessLineJobStatusChange (KKStr& statusLineStr)
{
kkint32 expandedJobId = statusLineStr.ExtractTokenInt ("\t");
KKJobPtr j = jobs->LookUpByJobId (expandedJobId);
if (!j)
{
log.Level (-1) << endl << endl << endl
<< "ProcessStatusLineJobStatusChange ***Error*** Could not locate Expanded" << endl
<< endl
<< " JobId[" << expandedJobId << "]" << endl
<< endl;
EndBlock ();
osWaitForEnter ();
exit (-1);
}
KKStr statusStr = statusLineStr.ExtractToken2 ("\t");
statusStr.TrimLeft ();
statusStr.TrimRight ();
KKJob::JobStatus status = KKJob::JobStatusFromStr (statusStr);
if (status == jsNULL)
{
log.Level (-1) << endl << endl << endl
<< "ProcessStatusLineJobStatusChange ***Error*** Invalid Status Specified" << endl
<< endl
<< " JobId[" << expandedJobId << "]" << endl
<< " Status[" << statusStr << "]" << endl
<< endl;
EndBlock ();
osWaitForEnter ();
exit (-1);
}
j->Status (status);
} /* ProcessStatusLineJobStatusChange */
示例3: cancelFlag
ParameterJob::ParameterJob (RunLog& _log,
KKStr _desc
):
cancelFlag (false),
log (_log)
{
accuracy = 0;
startTime = 0;
_desc.TrimLeft ();
curStatus = _desc.ExtractChar ();
if ((curStatus == '0') ||
(curStatus == '1') ||
(curStatus == '2') ||
(curStatus == '3')
)
{
// We Are Ok
}
else
{
log.Level (-1) << endl
<< "ParameterJob: We have an invalid Cur Status."
<< endl;
osWaitForEnter ();
}
{
processNum = _desc.ExtractTokenInt (" ,\t");
jobId = _desc.ExtractTokenInt (" ,\t");
cParm = _desc.ExtractTokenInt (" ,\t");
gammaParm = _desc.ExtractTokenDouble (" ,\t");
aParm = _desc.ExtractTokenDouble (" ,\t");
accuracy = _desc.ExtractTokenDouble (" ,\t");
trainTime = (float)_desc.ExtractTokenDouble (" ,\t");
classTime = (float)_desc.ExtractTokenDouble (" ,\t");
numSVs = (float)_desc.ExtractTokenDouble (" ,\t");
}
}
示例4: ReportTextMsg
void ScannerFile::ReportTextMsg (const char* textBuff,
kkint32 numTextBytes
)
{
KKStr s (textBuff, 0, numTextBytes - 1);
if (s.StartsWith ("InstrumentDataWord\t", true))
{
s.ExtractToken2 ("\t");
kkint32 idNum = s.ExtractTokenInt ("\t");
kkuint32 scanLineNum = s.ExtractTokenUint ("\t");
kkuint32 dataWord = s.ExtractTokenUint ("\t");
WordFormat32Bits w (dataWord);
ReportInstrumentDataWord (idNum, scanLineNum, w);
}
else
{
/**
*@todo Need to add code to do something with the textBuff message.
*/
}
} /* ReportTextMsg */
示例5: ProcessStatusStr
void BinaryClass::ProcessStatusStr (KKStr statusStr,
MLClassListPtr mlClasses
)
{
KKStr fieldName;
class1 = NULL;
class2 = NULL;
fieldName = statusStr.ExtractToken2 ("\t");
while (!fieldName.Empty ())
{
fieldName.TrimLeft ("\n\r\t ");
fieldName.TrimRight ("\n\r\t ");
fieldName.Upper ();
if (fieldName == "ALLCLASSES")
{
class1 = NULL;
class2 = NULL;
}
else if (fieldName == "BINARYCLASSES")
{
class1 = mlClasses->GetMLClassPtr (statusStr.ExtractToken2 ("\t"));
class2 = mlClasses->GetMLClassPtr (statusStr.ExtractToken2 ("\t"));
if ((class1 == NULL) || (class2== NULL))
{
cout << "Class1 or Class2 == NULL" << endl;
}
else
{
if ((class1->Name ().Empty ()) || (class1->Name ().Empty ()))
{
cout << "Class1Name or Class2Name are empty" << endl;
}
}
}
else if (fieldName == "STATUS")
status = BinaryClassStatusFromStr (statusStr.ExtractToken2 ("\t"));
else if (fieldName == "NUMPROCESSORS")
numProcessors = statusStr.ExtractTokenInt ("\t");
else if (fieldName.CompareIgnoreCase ("FinalResultType") == 0)
resultType = FinalResultTypeFromStr (statusStr.ExtractToken2 ("\t"));
else if (fieldName.CompareIgnoreCase ("ResultsFileName") == 0)
finalResultsFileName = statusStr.ExtractToken2 ("\t");
else if (fieldName.CompareIgnoreCase ("SelectionMethod") == 0)
selectionMethod = SelectionMethodFromStr (statusStr.ExtractToken2 ("\t"));
else if (fieldName.CompareIgnoreCase ("configFileName") == 0)
configFileName = statusStr.ExtractToken2 ("\t");
fieldName = statusStr.ExtractToken2 ("\t");
}
} /* ProcessStatusStr */
示例6: 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 */
示例7: StatusFileProcessLine
void KKJobManager::StatusFileProcessLine (const KKStr& ln,
istream& statusFile
)
{
if (ln.SubStrPart (0, 1) == "//")
{
// A coment line; we can ignore it.
return;
}
KKStr statusStr (ln);
KKStr fieldName = statusStr.ExtractToken2 ("\t");
if (fieldName.Empty ())
{
// A empty line we will ignore it.
return;
}
statusStr.TrimLeft ("\n\r\t ");
statusStr.TrimRight ("\n\r\t ");
if (fieldName.CompareIgnoreCase ("JOB") == 0)
{
// We have a KKJob entr line; the next field determines JobType fllowed by parameters for that JobType constructor.
KKStr jobTypeName = fieldName = statusStr.ExtractToken2 ("\t");
KKJobPtr j = KKJob::CallAppropriateConstructor (this, jobTypeName, statusStr);
KKJobPtr existingJob = jobs->LookUpByJobId (j->JobId ());
if (existingJob)
{
existingJob->ReFresh (*j);
delete j; j = NULL;
}
else
{
jobs->PushOnBack (j);
}
}
else if (fieldName.EqualIgnoreCase ("CPUTIMEUSED"))
{
double cpuTimeUsed = statusStr.ExtractTokenDouble ("\t");
cpuTimeTotalUsed += cpuTimeUsed;
}
else if (fieldName.EqualIgnoreCase ("CURRENTDATETIME"))
{
KKB::DateTime dateTime = KKB::DateTime (statusStr);
if (!dateTimeFirstOneFound)
{
dateTimeFirstOneFound = true;
dateTimeStarted = dateTime;
}
dateTimeEnded = dateTime;
}
else if (fieldName.EqualIgnoreCase ("ExpansionCount"))
expansionCount = statusStr.ToInt ();
else if (fieldName.EqualIgnoreCase ("ExpansionFirstJobId"))
expansionFirstJobId = statusStr.ToInt ();
else if (fieldName.EqualIgnoreCase ("JobStatusChange"))
StatusFileProcessLineJobStatusChange (statusStr);
else if (fieldName.EqualIgnoreCase ("NextJobId"))
nextJobId = statusStr.ExtractTokenInt ("\t");
else if (fieldName.EqualIgnoreCase ("QuitRunning"))
quitRunning = true;
else if (fieldName.EqualIgnoreCase ("Restart"))
restart = false;
else if (fieldName.EqualIgnoreCase ("Status"))
status = KKJob::JobStatusFromStr (statusStr);
else
{
log.Level (-1) << "KKJobManager::StatusFileProcessLine Invalid Field Name[" << fieldName << "]." << endl;
}
} /* StatusFileProcessLine */
示例8: Load
void ActiveLearningReport::Load (KKStr fileName,
bool& validFormat
)
{
validFormat = false;
FILE* f = osFOPEN (fileName.Str (), "r");
if (!f)
{
log.Level (-1) << endl
<< "ActiveLearningReport::Load *** ERROR ***" << endl
<< endl
<< " Could noty open File[" << fileName << "]" << endl
<< endl;
return;
}
char buff[10240];
bool fileParmsLoaded = false;
{
// Get Frst Row wicj should be InitialTrainingImagesPerClass
if (!fgets (buff, sizeof (buff), f))
{
log.Level (-1) << endl
<< "ActiveLearningReport::Load *** ERROR ***" << endl
<< endl
<< " *** No Data ***" << endl
<< endl;
fclose (f);
return;
}
KKStr l (buff);
l.Upper ();
KKStr field = l.ExtractToken ("\n\t\r ");
if (field != "\\INITIALTRAININGIMAGESPERCLASS")
{
log.Level (-1) << endl
<< "ActiveLearningReport::Load *** ERROR ***" << endl
<< endl
<< " First Liine Not Valid[" << l << "]" << endl
<< endl;
fclose (f);
return;
}
initialImagesPerClass = l.ExtractTokenInt ("\n\t\r ");
}
{
// Get second Row wicj should be ImagesPerRetraining
if (!fgets (buff, sizeof (buff), f))
{
log.Level (-1) << endl
<< "ActiveLearningReport::Load *** ERROR ***" << endl
<< endl
<< " *** Missing Second Line ***" << endl
<< endl;
fclose (f);
return;
}
KKStr l (buff);
l.Upper ();
KKStr field = l.ExtractToken ("\n\t\r ");
if (field != "\\IMAGESPERRETRAINING")
{
log.Level (-1) << endl
<< "ActiveLearningReport::Load *** ERROR ***" << endl
<< endl
<< " Second Liine Not Valid[" << l << "]" << endl
<< endl;
fclose (f);
return;
}
imagesPerRetraining = l.ExtractTokenInt ("\n\t\r ");
}
SortOrderResultsPtr curSortOrderResults = NULL;
while (fgets (buff, sizeof (buff), f))
{
KKStr l (buff);
if (l.SubStrPart (0, 0) == "\\")
{
if (curSortOrderResults)
{
results.PushOnBack (curSortOrderResults);
curSortOrderResults = NULL;
}
//.........这里部分代码省略.........
示例9: StartStopTypeFromStr
void StartStopPoint::ParseTabDelStr (KKStr parser)
{
scanLineNum = parser.ExtractTokenInt ("\t");
KKStr typeStr = parser.ExtractToken2 ("\t");
type = StartStopTypeFromStr (typeStr);
}