当前位置: 首页>>代码示例>>C++>>正文


C++ KKStr::Str方法代码示例

本文整理汇总了C++中KKStr::Str方法的典型用法代码示例。如果您正苦于以下问题:C++ KKStr::Str方法的具体用法?C++ KKStr::Str怎么用?C++ KKStr::Str使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在KKStr的用法示例。


在下文中一共展示了KKStr::Str方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: AssertAreEqual

 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);
 }
开发者ID:KurtKramer,项目名称:KSquareLibraries,代码行数:7,代码来源:KKStrTest.cpp

示例2: 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 */
开发者ID:KurtKramer,项目名称:KSquareLibraries,代码行数:51,代码来源:KKJob.cpp

示例3: SaveFeatureFile

void  FeatureFileIO::SaveFeatureFile (const KKStr&          _fileName, 
                                      FeatureNumListConst&  _selFeatures,
                                      FeatureVectorList&    _examples,
                                      kkuint32&             _numExamplesWritten,
                                      VolConstBool&         _cancelFlag,
                                      bool&                 _successful,
                                      RunLog&               _log
                                     )
{
  _log.Level (10) << "FeatureFileIO::SaveFeatureFile - File[" << _fileName << "]." << endl;

  ofstream  out (_fileName.Str ());
  if  (!out.is_open())
  {
    _log.Level (-1) << "***ERROR***, SaveFeatureFile, Opening File[" << _fileName << "]" << endl;
    _successful = false;
  }

  out.precision (9);

  KKStr  errorMessage;
  SaveFile (_examples, _fileName, _selFeatures, out, _numExamplesWritten, _cancelFlag, _successful, errorMessage, _log);

  out.close ();
}  /* SaveFeatureFile */
开发者ID:KurtKramer,项目名称:KSquareLibraries,代码行数:25,代码来源:FeatureFileIO.cpp

示例4: ExtractParametersFromFile

void  CmdLineExpander::ExtractParametersFromFile (const KKStr&  cmdFileName, 
                                                  VectorKKStr&  cmdFileParameters,
                                                  bool&         validFile
                                                 )
{
  FILE*  in = osFOPEN (cmdFileName.Str (), "r");
  if  (!in)
  {
    log.Level (-1) << endl << endl << endl
         << "ExtractParametersFromFile     *** EROR ***" << endl
         << endl
         << "      Invalid CmdFile[" << cmdFileName << "]" << endl
         << endl;
    validFile = false;
    return;
  }

  KKStr  token;
  bool    eof = false;

  token  = osReadNextQuotedStr (in, " \n\r", eof);
  while  (!eof)
  {
    cmdFileParameters.push_back (token);
    token  = osReadNextQuotedStr (in, " \n\r", eof);
  }

  std::fclose (in);
}  /* ExtractParametersFromFile */
开发者ID:KurtKramer,项目名称:KSquareLibraries,代码行数:29,代码来源:CmdLineExpander.cpp

示例5: WriteConfigFile

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 */
开发者ID:KurtKramer,项目名称:Pices,代码行数:33,代码来源:DataBaseServer.cpp

示例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;
}
开发者ID:KurtKramer,项目名称:KSquareLibraries,代码行数:8,代码来源:HTMLReport.cpp

示例7: trimWhiteSpace

KKStrParser::KKStrParser (const KKStr&  _str):
    len            (_str.Len ()),
    nextPos        (0),
    str            (_str.Str ()),
    trimWhiteSpace (false),
    weOwnStr       (false),
    whiteSpace     (NULL)
{
}
开发者ID:,项目名称:,代码行数:9,代码来源:

示例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 */
开发者ID:,项目名称:,代码行数:12,代码来源:

示例9: in

FeatureVectorListPtr  FeatureFileIO::LoadFeatureFile 
                                      (const KKStr&   _fileName,
                                       MLClassList&   _mlClasses,
                                       OptionUInt32   _maxCount,
                                       VolConstBool&  _cancelFlag,    // will be monitored,  if set to True  Load will terminate.
                                       bool&          _successful,
                                       bool&          _changesMade,
                                       RunLog&        _log
                                      )
{
  _log.Level (10) << "LoadFeatureFile  File[" << _fileName << "]  FileFormat[" << driverName << "]" << endl;
  
  _changesMade = false;

  kkint32  estimatedNumOfDataItems = -1;
  
  _successful = true;

  ifstream  in (_fileName.Str (), ios_base::in);
  if  (!in.is_open ())
  {
    _log.Level (-1) << "LoadFeatureFile   ***ERROR***      Error Opening File[" << _fileName << "]." << endl;
    _successful = false;
    return  NULL;
  }

  KKStr  errorMessage;
  
  FileDescConstPtr  fileDescFromFile = GetFileDesc (_fileName, in, &_mlClasses, estimatedNumOfDataItems, errorMessage, _log);
  if  (fileDescFromFile == NULL)
  {
    _log.Level (-1) << endl << endl 
                   << "FeatureFileIO::LoadFeatureFile    ***ERROR***     Loading Feature File[" << _fileName << "]" << endl
                   << endl;
    _successful = false;
    return NULL;
  }

  FileDescConstPtr fileDesc = FileDesc::GetExistingFileDesc (fileDescFromFile);

  in.clear ();
  in.seekg (0, ios::beg);

  FeatureVectorListPtr  examples = LoadFile (_fileName, fileDesc, _mlClasses, in, _maxCount, _cancelFlag, _changesMade, errorMessage, _log);
  if  (examples == NULL)
  {
    _successful = false;
  }
  else
  {
    _successful = true;
  }

  in.close ();

  return  examples;
}  /* LoadFeatureFile */
开发者ID:KurtKramer,项目名称:KSquareLibraries,代码行数:57,代码来源:FeatureFileIO.cpp

示例10: s

HTMLReport&  KKB::operator<< (HTMLReport&  htmlReport,
                              kkuint64     right
                             )
{
  KKStr  s (30);
  s = StrFormatInt64 (right, "0");
  htmlReport.Append (s.Str ());
  return  htmlReport;
}
开发者ID:KurtKramer,项目名称:KSquareLibraries,代码行数:9,代码来源:HTMLReport.cpp

示例11: ParseDegreeMinutesStr

void  InstrumentDataGPS::ParseDegreeMinutesStr (const KKStr&  str,
                                                double&        degrees,
                                                double&        minutes
                                               ) const
{
  degrees = 0.0;
  minutes = 0.0;

  auto x = str.LocateCharacter ('.');
  if  (!x)
    return;

  KKStr  degStr = str.SubStrSeg (0, x - 2);
  KKStr  minStr = str.SubStrPart (x - 2);
  
  degrees = atof (degStr.Str ());
  minutes = atof (minStr.Str ());
}  /* ParseDegreeMinutesStr */
开发者ID:KurtKramer,项目名称:Pices,代码行数:18,代码来源:InstrumentDataGPS.cpp

示例12: WriteHeader

void  ScannerFile::WriteHeader ()
{
  KKStr  ln (100);
  ln << "ScannerFile" << "\t" << FileFormatStr () << "\n";
  fwrite (ln.Str (), 1, ln.Len (), file);
  
  ScannerHeaderFields::const_iterator  idx;
  for  (idx = headerFields->begin ();  idx != headerFields->end ();  ++idx)
  {
    ln = "";
    ln << idx->first << "\t" << idx->second << "\n";
    fwrite (ln.Str (), 1, ln.Len (), file);
  }

  // Write End of text Marker
  char  ch = 0;
  fwrite (&ch, 1, 1, file);
  headerDataWritten = true;
}  /* WriteHeader */
开发者ID:,项目名称:,代码行数:19,代码来源:

示例13: Save

void  Histogram::Save (KKStr  fileName)  const
{
  ofstream o (fileName.Str ());

  kkint32  bucketIDX;


  float  avgVal = totalVal / totalCount;

  o << "MinValue" << "\t" << "\t" << "BucketSize"  << "\t"  << "NumOfBuckets" << "\t" << "TotalCount" << "\t" << "Average"  << std::endl;
  o <<  minValue  << "\t" << "\t" <<  bucketSize   << "\t"  <<  numOfBuckets  << "\t" <<  totalCount  << "\t" <<  avgVal    << std::endl;

  o << std::endl;
  o << std::endl;

  float  avg;
  float  percentage;
  float  bucketVal = minValue + bucketSize;

  o << "BucketValue"  << "\t"
    << "Count"        << "\t"
    << "AvgValue"     << "\t"
    << "%OfTotalCount"
    << std::endl
    << std::endl;

  for  (bucketIDX = 0;  bucketIDX < numOfBuckets;  bucketIDX++)
  {
    o << bucketVal;

    o << "\t" << buckets[bucketIDX];

    if  (buckets[bucketIDX] > (float)0.0)
      avg = bucketTotals[bucketIDX] / buckets[bucketIDX];
    else
      avg = 0.0;
    o << "\t" << avg;


    percentage = (float)100.0 * buckets[bucketIDX] / totalCount;
    o << "\t" << percentage << "%";

    bucketVal += bucketSize;
    o << std::endl;
  }

  o << std::endl;
  o << std::endl;

  o.close ();
}  /* Save */
开发者ID:,项目名称:,代码行数:51,代码来源:

示例14: w

ActiveLearningReport::ActiveLearningReport (RunLog&          _log,
                                            MLClassList&  _mlClasses,
                                            KKStr           _subDirName
                                           ):
  mlClasses        (_mlClasses),
  log                 (_log),
  subDirName          (_subDirName),
  results             (true, 10),
  baseResultsFileName ("ActiveLearningResults")
{
  if  (!subDirName.Empty ())
  {
    KKStr  w (subDirName);
    osAddLastSlash (w);
    w << baseResultsFileName;
    baseResultsFileName = w;
  }


// C:\users\kkramer\GradSchool\Plankton\ActiveLearning\Results\010-IPC\2003-12-03_AllOrders_010-IPC_50-IPR

  int x = subDirName.LocateLastOccurrence ('_');

  if  (x > 5)
  {
    KKStr leftSide = subDirName.SubStrPart (0, x - 1);
    KKStr rightSide = subDirName.SubStrPart (x + 1);
    x = rightSide.LocateCharacter ('-');
    KKStr  IPR = rightSide.SubStrPart (0, x - 1);
    imagesPerRetraining = atoi (IPR.Str ());

    x = leftSide.LocateLastOccurrence ('_');
    rightSide = subDirName.SubStrPart (x + 1);
    x = rightSide.LocateCharacter ('-');
    KKStr  IPC = rightSide.SubStrPart (0, x - 1);
    initialImagesPerClass = atoi (IPC.Str ());
  }
}  
开发者ID:jizhihang,项目名称:Pices-XXX-,代码行数:38,代码来源:ActiveLearningReport.cpp

示例15: ReportBlockedStats

void  GoalKeeper::ReportBlockedStats ()
{
  HANDLE  mutexCreateHandle = CreateMutex (NULL,                 /**< default security attributes. */
                                           false,                /**< initially not owned.         */
                                           "GoalKeeper_ReportBlockedStats"
                                          ); 

  WaitForSingleObject (mutexCreateHandle, INFINITE);

  KKStr  path = "C:\\Temp\\BlockedStats";

  KKB::osCreateDirectoryPath (path);

  KKStr  fileName = osAddSlash (path) + "BlockedStats.txt";

  ofstream  o (fileName.Str (), ios_base::app);
  
  o << "Name"
    << "\t" << "Count"
    << "\t" << "BlockedThreadId"
    << "\t" << "BlockerThreadId"
    << "\t" << "DateTimeBlocked"
    << "\t" << "MilliSecsBlocked"
    << "\t" << "NumBlockedThreads"
    << endl;

  int  c = 0;
  BlockedStatList::iterator  idx;
  for  (idx = blockedStats->begin (), c = 0;  idx != blockedStats->end ();  ++idx, ++c)
  {
    BlockedStat*  bs = *idx;
    o << name
      << "\t" << c
      << "\t" << bs->blockedThreadId 
      << "\t" << bs->blockerThreadId 
      << "\t" << bs->dateTimeBlocked.Date () << " " << bs->dateTimeBlocked.Time ()
      << "\t" << bs->milliSecsBlocked
      << "\t" << bs->numBlockedThreads
      << endl;
  }

  o.close ();

  ReleaseMutex (mutexCreateHandle);
  CloseHandle(mutexCreateHandle);
}  /* ReportBlockedStats */
开发者ID:,项目名称:,代码行数:46,代码来源:


注:本文中的KKStr::Str方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。