Пример #1
0
void CPropertiesCommand::Execute (po::variables_map const& options, std::string const& arg)
{
  std::auto_ptr<SSRecordFile> file (SSRecordFile::MakeFile(arg));
  if (file.get ())
  {
    SSHistoryFile* pHistory = dynamic_cast<SSHistoryFile*> (file.get());
    SSProjectFile* pProject = dynamic_cast<SSProjectFile*> (file.get());

    if (pHistory)
    {
      std::auto_ptr<SSItemInfoObject> info (pHistory->GetItemInfo ());
      if (info.get())
        GetFormatter()->Format (*info, this);
    }
    else if (pProject)
    {
      SSRecordPtr record (pProject->GetFirstRecord());
      while (record)
      {
        SSProjectObject project (record);
        GetFormatter()->Format (project, this);
        record = pProject->GetNextRecord(record);
      }
        
    }
    else
      throw SSException ("xxx is not a history file, nor a project file");
  }
}
Пример #2
0
void CInfoCommand::Info (SSRecordPtr pRecord, bool bBasicInfo)
{
  if (bBasicInfo)
  {
    std::auto_ptr<SSObject> pObject (new SSObject(pRecord));
    GetFormatter()->Format (*pObject);
  }
  else
  {
    std::auto_ptr<SSObject> pObject (SSObject::MakeObject(pRecord));
    GetFormatter()->Format (*pObject);
  }
}
Пример #3
0
void LLBC_LogTagToken::Format(const LLBC_LogData &data, LLBC_String &formattedData) const
{
    int index = static_cast<int>(formattedData.size());
    if (data.tagLen)
        formattedData.append(data.others + data.tagBeg, data.tagLen);

    LLBC_LogFormattingInfo *formatter = GetFormatter();
    formatter->Format(formattedData, index);
}
Пример #4
0
void CInfoCommand::Execute (po::variables_map const& options, std::string const& arg)
{
  bool bBasicInfo = false;
  bool bDisplayAtOffset = false;
  int offset = 0;

  if (options.count("basic"))
    bBasicInfo = true;
  if (options.count("offset"))
  {
    bDisplayAtOffset = true;
    offset = options["offset"].as<int> ();
  }

  std::auto_ptr <SSRecordFile> pFile (SSRecordFile::MakeFile (arg));
  
  if (pFile.get ())
  {
    GetFormatter()->BeginFile (arg);
    if (bDisplayAtOffset)
    {
      SSRecordPtr pRecord = pFile->GetRecord(offset);
      Info (pRecord, bBasicInfo);
    }
    else
    {
      SSRecordPtr pRecord = pFile->GetFirstRecord();
      while (pRecord)
      {
        Info (pRecord, bBasicInfo);
        pRecord = pFile->FindNextRecord(pRecord);
      }
    }

    GetFormatter()->EndFile ();
  }
}