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


C++ CUnit::AsString方法代码示例

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


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

示例1: CFileException

//----------------------------------------
void CInternalFilesYFX::CreateData
		(const string		&Name,
		 const string		&Units,
		 const string		&LongName,
                 const string           &Comment /* = ""*/,
      	         double	                ValidMin /* = CTools::m_defaultValueDOUBLE */,
		 double	                ValidMax /* = CTools::m_defaultValueDOUBLE */,
		 nc_type		Type	/*= NC_DOUBLE*/)
{
  if (VarExists(Name))
  {
    throw CFileException(CTools::Format("Try to create data variable '%s' while it already exists",
					                              Name.c_str()),
			                                  GetName(),
			                                  BRATHL_LOGIC_ERROR);
  }

  if (m_file.GetNbDimensions() != 1)
  {
    throw CFileException(CTools::Format("Try to create data variable '%s' while not only one dimension exists",
					                              Name.c_str()),
			                                  GetName(),
			                                  BRATHL_LOGIC_ERROR);
  }

  CUnit unit = CUnit::ToUnit(Units);
  string strUnit = unit.AsString(false, true);

  m_file.AddVar(Name, Type, strUnit, LongName, Comment, 0, -1, -1, -1, ValidMin, ValidMax);
}
开发者ID:adakite,项目名称:main,代码行数:31,代码来源:InternalFilesYFX.cpp

示例2: BaseUnit

CUnit CUnit::BaseUnit() const
{
	CUnit	Result;
	Result.m_Compiled		= m_Compiled;
	FindBaseUnit( Result.m_Compiled );
	Result.m_Text			= Result.AsString();
	return Result;
}
开发者ID:BRAT-DEV,项目名称:main,代码行数:8,代码来源:Unit.cpp

示例3: str_icmp

//----------------------------------------
bool CUnit::operator==(CUnit& u)
{
  return str_icmp(this->AsString().c_str(), u.AsString().c_str());
}
开发者ID:BRAT-DEV,项目名称:main,代码行数:5,代码来源:Unit.cpp

示例4: GetInfo

//----------------------------------------
void CPlot::GetInfo()
{

  CUnit unitXRead;
  CUnit unitYRead;

  string unitXStr;
  string unitYStr;

  bool assignYUnit = true;
  bool assignYTitle = true;
  bool assignXUnit = true;
  bool assignXTitle = true;

  CObArray allInternalFiles(false);


  GetAllInternalFiles(allInternalFiles);
  int32_t nrFiles = allInternalFiles.size();

  //int32_t iField = 0;
  int32_t nrFields = m_fields.size();
  CObArray::iterator itField;
  CObArray::iterator itFile;

  CStringArray plotFieldNames;

  for (itField = m_fields.begin() ; itField != m_fields.end() ; itField++)
  {
    CPlotField* field = CPlotField::GetPlotField(*itField);
    string fieldName = (const char *)(field->m_name);

    plotFieldNames.InsertUnique(fieldName);

    if ((field->m_xyProps != NULL) && (m_title.IsEmpty()) )
    {
      m_title = field->m_xyProps->GetTitle();
    }

    for (itFile = field->m_internalFiles.begin() ; itFile != field->m_internalFiles.end() ; itFile++)
    {

      CInternalFiles* yfx = CPlot::GetInternalFiles(*itFile);
      //-----------------------------------
      // Get plot Title --> title of the first file
      //-----------------------------------
      if (m_title.IsEmpty())
      {
        m_title = yfx->GetTitle("").c_str();
      }

      //-----------------------------------
      // Get and control unit of X axis
      //-----------------------------------
      string varXName;
      GetAxisX(yfx, NULL, NULL, &varXName);

      unitXRead = yfx->GetUnit(varXName);


      if (assignXUnit)
      {
        m_unitX = unitXRead;
        unitXStr = m_unitX.AsString();
        m_unitXLabel = "\nUnit:\t" + wxString(m_unitX.GetText().c_str());
        assignXUnit = false;
      }
      else
      {
        string unitXReadStr = unitXRead.AsString();
        if (m_unitX.IsCompatible(unitXRead) == false)
        {
          string msg = CTools::Format("CPlot::CkeckUnits - In group field number %d, X field unit are not in the same way (not compatible)"
                                      "- Expected unit '%s' and found '%s' for axis X - File name is '%s'",
                                       m_groupNumber,
                                       unitXStr.c_str(),
                                       unitXReadStr.c_str(),
                                       yfx->GetName().c_str());
          CException e(msg, BRATHL_INCONSISTENCY_ERROR);
          CTrace::Tracer("%s", e.what());
          throw (e);

        }
        if (unitXStr.compare(unitXReadStr) != 0)
        {
          m_unitXConv = true;
        }
      }
      //-----------------------------------
      // Get title of X axis
      //-----------------------------------
      string titleX;

      if (m_titleX.IsEmpty())
      {
        titleX = yfx->GetTitle(varXName);
        if (titleX.empty())
        {
          titleX = varXName;
//.........这里部分代码省略.........
开发者ID:adakite,项目名称:main,代码行数:101,代码来源:Plot.cpp


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