本文整理汇总了C++中KKStr类的典型用法代码示例。如果您正苦于以下问题:C++ KKStr类的具体用法?C++ KKStr怎么用?C++ KKStr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了KKStr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: strcmp
void KKStrTest::AssertAreEqual (const char* expected, const KKStr& found, const KKStr& testName)
{
bool equal = strcmp(expected, found.Str ()) == 0;
KKStr msg;
msg << "Expected: " << expected << "\t" << "Found: " << found.Str ();
Assert(equal, testName, msg);
}
示例2: if
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: StripOutAnyComments
void StripOutAnyComments (KKStr& line)
{
bool found = false;
kkint32 len = line.Len ();
kkint32 x = 0;
while ((x < (len - 1)) && (!found))
{
if ((line[x] == '/') &&
(line[x + 1] == '/'))
found = true;
else
x++;
}
if (found)
{
if (x == 0)
line = "";
else
line = line.SubStrPart (0, x - 1);
}
} /* StripOutAnyComments */
示例4: osCreateDirectoryPath
void DataBaseServerList::WriteConfigFile () const
{
osCreateDirectoryPath (PicesVariables::ConfigurationDirectory ());
KKStr configFileName = osAddSlash (PicesVariables::ConfigurationDirectory ()) + "MySql.cfg";
log.Level (10) << "DataBaseServerList::WriteConfigFile Writing ConfigFileName[" << configFileName << "]" << endl;
ofstream o (configFileName.Str ());
if (!o.is_open ())
{
log.Level (-1) << endl << endl
<< "DataBaseServerList::WriteConfigFile ***ERROR*** Opening ConfigFile[" << configFileName << "]" << endl
<< endl;
return;
}
o << "// PICES MySQL configuration file. There will be one entry for each known MySQL database server." << std::endl
<< "//" << std::endl
<< "// Date Written: " << osGetLocalDateTime () << std::endl
<< "//" << std::endl
<< "// Number Entries: " << QueueSize () << std::endl
<< "//" << std::endl;
DataBaseServerList::const_iterator idx;
for (idx = begin (); idx != end (); idx++)
o << "Server" << "\t" << (*idx)->ToParameterStr () << endl;
o << "//" << std::endl
<< "DefaultServer" << "\t" << defaultServerDescription << std::endl;
o.close ();
} /* WriteConfigFile */
示例5: parmValueUpper
bool ImportFullSizeFromSqlBackUp::ProcessCmdLineParameter (
char parmSwitchCode,
KKStr parmSwitch,
KKStr parmValue
)
{
KKStr parmValueUpper (parmValue);
parmValueUpper.Upper ();
parmSwitch.Upper ();
if ((parmSwitch == "-S") ||
(parmSwitch == "-SRC") ||
(parmSwitch == "-SOURCE") ||
(parmSwitch.EqualIgnoreCase ("-SrcFile"))
)
{
srcFileName = parmValue;
if (!osFileExists (srcFileName))
{
log.Level (-1) << "ProcessCmdLineParameter ***ERROR*** Invalid '-SrcFile' [" << srcFileName << "] file." << endl;
Abort (true);
}
}
return !Abort ();
} /* ProcessCmdLineParameter */
示例6:
HTMLReport& KKB::operator<< (HTMLReport& htmlReport,
const DateTime& right
)
{
KKStr s = right.Date ().YYYY_MM_DD () + "-" + right.Time ().HH_MM_SS ();
htmlReport.Append (s.Str ());
return htmlReport;
}
示例7: trimWhiteSpace
KKStrParser::KKStrParser (const KKStr& _str):
len (_str.Len ()),
nextPos (0),
str (_str.Str ()),
trimWhiteSpace (false),
weOwnStr (false),
whiteSpace (NULL)
{
}
示例8: s
/**
*@brief Adds Instrument data to the underlying Scanner files as text.
*/
void ScannerFile::WriteInstrumentDataWord (uchar idNum,
kkuint32 scanLineNum,
WordFormat32Bits dataWord
)
{
KKStr s (100);
s << "InstrumentDataWord" << "\t" << (int)idNum << "\t" << scanLineNum << "\t" << dataWord.unsigned32BitInt;
WriteTextBlock ((const uchar*)s.Str (), s.Len ());
} /* WriteInstrumentDataWord */
示例9: s
HTMLReport& KKB::operator<< (HTMLReport& htmlReport,
kkuint64 right
)
{
KKStr s (30);
s = StrFormatInt64 (right, "0");
htmlReport.Append (s.Str ());
return htmlReport;
}
示例10: parmValueUpper
bool AbundanceCorrectionStatsBuilder::ProcessCmdLineParameter (char parmSwitchCode,
KKStr parmSwitch,
KKStr parmValue
)
{
KKStr parmValueUpper (parmValue);
parmValueUpper.Upper ();
if (parmSwitch.EqualIgnoreCase ("-c") || parmSwitch.EqualIgnoreCase ("-config"))
{
configFileName = parmValue;
configFileFullPath = TrainingConfiguration2::GetEffectiveConfigFileName (configFileName);
if (!osFileExists (configFileFullPath))
{
log.Level (-1) << "ProcessCmdLineParameter ***ERROR*** Invalid '-config' [" << configFileName << "] file." << endl;
Abort (true);
}
}
else if (parmSwitch.EqualIgnoreCase ("-folds") || parmSwitch.EqualIgnoreCase ("-numFolds") || parmSwitch.EqualIgnoreCase ("-numOfFolds"))
{
numOfFolds = parmValue.ToInt ();
if ((numOfFolds < 2) || (numOfFolds > 1000))
{
log.Level (-1) << "ProcessCmdLineParameter ***ERROR*** Invalid '-NumFolds' [" << numOfFolds << "] Invlaid; valid values (2 - 1000)." << endl;
Abort (true);
}
}
else if (parmSwitch.EqualIgnoreCase ("-r") || parmSwitch.EqualIgnoreCase ("-report") || parmSwitch.EqualIgnoreCase ("-ReportFileName"))
reportFileName = parmValue;
return !Abort ();
} /* ProcessCmdLineParameter */
示例11: ifstream
void KKJobManager::StatusFileRefresh ()
{
// we only want to read in any new changes to the status file.
log.Level (10) << "KKJobManager::StatusFileRefresh statusFileName[" << statusFileName << "]" << endl;
ifstream* statusFile = new ifstream (statusFileName.Str ());
if (!statusFile->is_open ())
{
log.Level (-1) << endl
<< "KKJobManager::LoadCurrentStatusFile ***ERROR*** Can not open Status File["
<< statusFileName << "]."
<< endl;
EndBlock ();
delete statusFile; statusFile = NULL;
osWaitForEnter ();
exit (-1);
}
char buff[20480];
KKStr statusStr (512);
if (statusFileNextByte >= 0)
statusFile->seekg (statusFileNextByte);
//fseek (statusFile, statusFileNextByte, SEEK_SET);
statusFile->getline (buff, sizeof (buff));
while (!statusFile->eof ())
{
statusStr = buff;
if (statusStr.SubStrPart (0, 4) == "<KKJob ")
{
ProcessJobXmlBlockOfText (statusStr, *statusFile);
}
else
{
StatusFileProcessLine (statusStr, *statusFile);
}
long zed = statusFile->tellg ();
if (zed >= 0)
statusFileNextByte = zed;
if (!statusFile->eof ())
statusFile->getline (buff, sizeof (buff));
}
statusFile->close ();
delete statusFile;
statusFile = NULL;
log.Level (20) << "KKJobManager::StatusFileRefresh Exiting." << endl;
} /* StatusFileRefresh */
示例12: Strip
void Strip ()
{
bool cancelFlag = false;
bool successful = false;
bool changesMade = false;
RunLog log;
FeatureFileIOPtr driver = FeatureFileIO::FileFormatFromStr ("C45");
MLClassList mlClasses;
FeatureVectorListPtr data =
driver->LoadFeatureFile ("D:\\Pices\\Reports\\FeatureDataFiles\\AllValidatedImages_ForJonathon\\AllValidatedDataNorm.data",
mlClasses,
-1,
cancelFlag,
successful,
changesMade,
log
);
FeatureVectorListPtr stripped = new FeatureVectorList (data->FileDesc (), false);
FeatureVectorList::const_iterator idx;
for (idx = data->begin (); idx != data->end (); ++idx)
{
FeatureVectorPtr fv = *idx;
KKStr fn = fv->ExampleFileName ();
if (fn.StartsWith ("SML") || (fn.StartsWith ("SMP")))
{
}
else
{
stripped->PushOnBack (fv);
}
}
kkuint32 numExamplesWritten = 90;
driver->SaveFeatureFile ("D:\\Pices\\Reports\\FeatureDataFiles\\AllValidatedImages_ForJonathon\\AllValidatedData1209.data",
data->AllFeatures (),
*stripped,
numExamplesWritten,
cancelFlag,
successful,
log
);
}
示例13: if
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 */
示例14: applicationName
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 ();
}
示例15: 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 */