本文整理汇总了C++中KKStr::CompareIgnoreCase方法的典型用法代码示例。如果您正苦于以下问题:C++ KKStr::CompareIgnoreCase方法的具体用法?C++ KKStr::CompareIgnoreCase怎么用?C++ KKStr::CompareIgnoreCase使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KKStr
的用法示例。
在下文中一共展示了KKStr::CompareIgnoreCase方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MonthFromStr
uchar DateType::MonthFromStr (const KKStr& monthStr)
{
uchar month = 0;
for (month = 1; month < 13; month++)
{
if (monthStr.CompareIgnoreCase (monthlyShortNames[month]) == 0)
break;
if (monthStr.CompareIgnoreCase (monthlyNames[month]) == 0)
break;
}
return month;
} /* MonthFromStr */
示例2: JobStatusFromStr
KKJob::JobStatus KKJob::JobStatusFromStr (const KKStr& statusStr)
{
if (statusStr.CompareIgnoreCase ("OPEN") == 0)
return jsOpen;
if (statusStr.CompareIgnoreCase ("STARTED") == 0)
return jsStarted;
if (statusStr.CompareIgnoreCase ("DONE") == 0)
return jsDone;
if (statusStr.CompareIgnoreCase ("Expanded") == 0)
return jsExpanded;
return jsNULL;
} /* JobStatusToStr */
示例3: ln
void RandomSplitJobManager::StatusFileProcessLine (const KKStr& _ln,
istream& statusFile
)
{
KKStr ln (_ln);
KKStr fieldName = ln.ExtractToken2 ("\t");
KKStr fieldValue = ln.ExtractToken2 ("\t");
if (fieldName.CompareIgnoreCase ("MLClasses") == 0)
mlClasses = MLClassList::BuildListFromDelimtedStr (fieldValue, ',');
else if (fieldName.CompareIgnoreCase ("ConfigFileName") == 0)
configFileName = fieldValue;
else if (fieldName.CompareIgnoreCase ("DataFileName") == 0)
dataFileName = fieldValue;
else if (fieldName.CompareIgnoreCase ("DataIndexFileName") == 0)
dataIndexFileName = fieldValue;
else if (fieldName.CompareIgnoreCase ("Format") == 0)
format = FeatureFileIO::FileFormatFromStr (fieldValue);
else if (fieldName.CompareIgnoreCase ("NumFolds") == 0)
numFolds = fieldValue.ToInt ();
else if (fieldName.CompareIgnoreCase ("NumSplits") == 0)
numSplits = fieldValue.ToInt ();
else if (fieldName.CompareIgnoreCase ("SplitFraction") == 0)
{
bool percentage = (fieldValue.LastChar () == '%');
if (percentage)
{
fieldValue.ChopLastChar ();
splitFraction = fieldValue.ToFloat () / 100.0f;
}
else
{
splitFraction = fieldValue.ToFloat ();
if (splitFraction > 1.0f)
splitFraction = splitFraction / 100.0f;
}
}
else
KKJobManager::StatusFileProcessLine (_ln, statusFile);
} /* StatusFileProcessLine */
示例4: PrerequisitesFromStr
void KKJob::PrerequisitesFromStr (const KKStr& s)
{
prerequisites.clear ();
if (s.CompareIgnoreCase ("None") != 0)
{
VectorKKStr fields = s.Split (',');
for (kkuint32 x = 0; x < fields.size (); ++x)
{
kkint32 p = fields[x].ToInt ();
prerequisites.push_back (p);
}
}
} /* PrerequisitesFromStr */
示例5: ProcessStatusStr
void KKJob::ProcessStatusStr (const KKStr& statusStr)
{
log.Level (30) << "KKJob::ProcessStatusStr[" << statusStr << "]" << endl;
KKStr fieldName;
KKStr fieldValue;
VectorKKStr fields = statusStr.Split ('\t');
kkuint32 fieldNum = 0;
while (fieldNum < fields.size ())
{
fieldName = fields[fieldNum];
fieldNum++;
if (fieldNum < fields.size ())
{
fieldValue = fields[fieldNum];
fieldNum++;
}
else
{
fieldValue = "";
}
fieldName.Upper ();
fieldValue.TrimLeft ("\n\r\t ");
fieldValue.TrimRight ("\n\r\t ");
if (fieldName.CompareIgnoreCase ("JOBID") == 0)
jobId = atoi (fieldValue.Str ());
else if (fieldName.CompareIgnoreCase ("PARENTID") == 0)
parentId = atoi (fieldValue.Str ());
else if (fieldName.CompareIgnoreCase ("STATUS") == 0)
status = JobStatusFromStr (fieldValue);
else if (fieldName.CompareIgnoreCase ("NumProcessors") == 0)
numProcessors = fieldValue.ToInt ();
else if (fieldName.CompareIgnoreCase ("NumPorcessesAllowed") == 0)
numPorcessesAllowed = fieldValue.ToInt ();
else if (fieldName.CompareIgnoreCase ("Prerequisites") == 0)
PrerequisitesFromStr (fieldValue);
else
{
ProcessStatusField (fieldName, fieldValue);
}
}
} /* ProcessStatusStr */
示例6: 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 */
示例7: if
void KKJobManager::ProcessJobXmlBlockOfText (const KKStr& startStr,
istream& i
)
{
if ((startStr.SubStrPart (0, 4) != "<KKJob ") || (startStr.LastChar () != '>'))
{
log.Level (-1) << endl
<< "KKJobManager::ProcessJobXmlBlockOfText ***ERROR*** StartStr[" << startStr << "] is not a KKJob String." << endl
<< endl;
return;
}
KKStr s = startStr.SubStrPart (5);
s.TrimLeft ();
s.ChopLastChar ();
KKStr jobTypeStr = "";
kkint32 jobId = -1;
VectorKKStr parameters = s.Split (',');
for (kkuint32 x = 0; x < parameters.size (); ++x)
{
KKStr parameterStr = parameters[x];
parameterStr.TrimLeft ();
parameterStr.TrimRight ();
KKStr fieldName = parameterStr.ExtractToken2 ("=");
fieldName.TrimLeft (); fieldName.TrimRight ();
KKStr fieldValue = parameterStr.ExtractToken2 ("=");
fieldValue.TrimLeft (); fieldValue.TrimRight ();
if (fieldName.CompareIgnoreCase ("JobType") == 0)
jobTypeStr = fieldValue;
else if (fieldName.CompareIgnoreCase ("JobId") == 0)
jobId = fieldValue.ToInt ();
}
if (jobTypeStr.Empty () || (jobId < 0))
{
log.Level (-1) << endl
<< "KKJobManager::ProcessJobXmlBlockOfText ***ERROR*** StartStr[" << startStr << "]." << endl
<< " JobType and/or JobId were not provided." << endl
<< endl;
return;
}
KKJobPtr j = jobs->LookUpByJobId (jobId);
if (j == NULL)
{
// We do not have this job in memory yet. We will have to create it now.
KKStr emptyStatusStr = "JobId\t" + StrFormatInt (jobId, "ZZZZ0");
j = KKJob::CallAppropriateConstructor (this, jobTypeStr, emptyStatusStr);
}
j->CompletedJobDataRead (i);
} /* ProcessJobXmlBlockOfText */
示例8: 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 */
示例9: ReadSimpleConfusionMatrix
void ClassificationBiasMatrix::ReadSimpleConfusionMatrix (istream& sr,
MLClassListPtr fileClasses
)
{
// 'classes' - The class order that the owner of this object is expecting.
// 'fileClasses' - The order that the classes are stored in the text file.
if ((classes == NULL) || (fileClasses == NULL))
{
KKStr errMsg = "ReadSimpleConfusionMatrix ***ERROR*** The 'Classes' line was never provided.";
runLog.Level (-1) << errMsg << endl;
valid = false;
throw KKException (errMsg);
}
kkint32 classesColIdx = 0;
char buff[10240];
KKStr l;
while (!sr.eof ())
{
sr.getline (buff, sizeof (buff));
l = buff;
l.TrimLeft ();
l.TrimRight ();
if (l.CompareIgnoreCase ("</SimpleConfusionMatrix>") == 0)
break;
KKStr lineName = l.ExtractToken2 ("\t");
if (lineName.CompareIgnoreCase ("DataRow") == 0)
{
if (fileClasses == NULL)
{
KKStr errMsg = "ReadSimpleConfusionMatrix ***ERROR*** 'Classes' was not provided before 'DataRow'.";
runLog.Level (-1) << errMsg << endl;
valid = false;
throw KKException (errMsg);
}
KKStr className = l.ExtractToken2 ("\t");
KKStr data = l.ExtractToken2 ("\t");
MLClassPtr pc = MLClass::CreateNewMLClass (className);
kkint32 classesIdx = classes->PtrToIdx (pc);
kkint32 fileClassesIdx = fileClasses->PtrToIdx (pc);
if (classesIdx < 0)
{
KKStr errMsg = "ReadSimpleConfusionMatrix ***ERROR*** DataRow specifies class[" + className + "] which is not defined by caller";
runLog.Level (-1) << errMsg << endl;
valid = false;
throw KKException (errMsg);
}
if (fileClassesIdx < 0)
{
KKStr errMsg = "ReadSimpleConfusionMatrix ***ERROR*** DataRow specifies class[" + className + "] was not defined in 'Classes' line.";
runLog.Level (-1) << errMsg << endl;
valid = false;
throw KKException (errMsg);
}
kkint32 classesRowIdx = classesIdx;
VectorKKStr dataFields = data.Split (',');
if (dataFields.size () != (kkuint32)numClasses)
{
KKStr errMsg = "ReadSimpleConfusionMatrix ***ERROR*** DataRow Class[" + className + "] number[" + StrFormatInt ((kkint32)dataFields.size (), "ZZZ0") + "] of values provided does not match number of Classes.";
runLog.Level (-1) << errMsg << endl;
valid = false;
throw KKException (errMsg);
}
for (kkint32 c = 0; c < numClasses; c++)
{
pc = fileClasses->IdxToPtr (c);
classesColIdx = classes->PtrToIdx (pc);
VectorKKStr parts = dataFields[c].Split (':');
if (parts.size () > 1)
{
(*counts) [classesRowIdx][classesColIdx] = parts[0].ToDouble ();
(*probabilities)[classesRowIdx][classesColIdx] = parts[1].ToDouble ();
}
}
}
}
} /* ReadSimpleConfusionMatrix */
示例10: ReadXML
void ClassificationBiasMatrix::ReadXML (istream& sr)
{
char buff[10240];
KKStr l (512);
if (sr.eof ())
return;
MLClassListPtr fileClasses = NULL;
sr.getline (buff, sizeof (buff));
while (!sr.eof ())
{
l = buff;
l.TrimRight ();
if (l.CompareIgnoreCase ("</ClassificationBiasMatrix>") == 0)
break;
KKStr lineName = l.ExtractToken2 ("\t");
if (!lineName.Empty ())
{
KKStr fieldValue = l.ExtractToken2 ("\t");
if (lineName.CompareIgnoreCase ("Classes") == 0)
{
delete fileClasses; fileClasses = NULL;
fileClasses = MLClassList::BuildListFromDelimtedStr (fieldValue, ',');
if (classes == NULL)
classes = new MLClassList (*fileClasses);
}
else if (lineName.CompareIgnoreCase ("ConfigDateTime") == 0)
{
configDateTime = fieldValue;
}
else if (lineName.CompareIgnoreCase ("ConfigFileName") == 0)
{
configFileNameFromMatrixBiasFile = fieldValue;
}
else if (lineName.CompareIgnoreCase ("ConfigFileDateTime") == 0)
{
configDateTime = fieldValue;
}
else if (lineName.CompareIgnoreCase ("DateTime") == 0)
{
dateTimeFileWritten = fieldValue;
}
else if (lineName.CompareIgnoreCase ("DateTimeFileWritten") == 0)
{
dateTimeFileWritten = fieldValue;
}
else if (lineName.CompareIgnoreCase ("FileName") == 0)
{
}
else if (lineName.CompareIgnoreCase ("NumClasses") == 0)
{
numClasses = fieldValue.ToInt ();
}
else if (lineName.CompareIgnoreCase ("<SimpleConfusionMatrix>") == 0)
{
ReadSimpleConfusionMatrix (sr, fileClasses);
}
}
if (!sr.eof ())
sr.getline (buff, sizeof (buff));
}
} /* ReadXML */