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


C++ CVariable::GetType方法代码示例

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


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

示例1: LoadFromFile

void CConfiguration::LoadFromFile(const CString& FileName)
{
 CStringList configuration, sub_strings;
 CStringListIterator iterator(&configuration);
 configuration.LoadFromFile(FileName);
 //
 for (int i = 0; i < configuration.GetCount(); i++)
 {
  ParseStr(configuration[i],"=;",sub_strings);
  CVariable variable = VarNamed(sub_strings[0]);
  if (variable.GetType()==VARIABLE_TYPE_CHAR)
  {
   CStringList sub_strings2;
   ParseStr(sub_strings[1],"''",sub_strings2);
   variable.SetString(sub_strings2[1]);
  }
  else if (variable.GetType()==VARIABLE_TYPE_STRING)
  {
   CStringList sub_strings2;
   ParseStr(sub_strings[1],"\"\"",sub_strings2);
   variable.SetString(sub_strings2[1]);
  }
  sub_strings.Clear();
 }
}
开发者ID:mirai-computing,项目名称:cbp2make,代码行数:25,代码来源:stlconfig.cpp

示例2: Print

void CConfiguration::Print(std::ostream& out)
{
 for (size_t i = 0; i < m_Variables.size(); i++)
 {
  CVariable *variable = m_Variables[i];
  out<<variable->GetTypeName().GetCString()<<" "<<variable->GetName().GetCString()<<"=";
  if (VARIABLE_TYPE_STRING == variable->GetType())
  {
   out<<"\""<<variable->GetString().GetCString()<<"\";"<<std::endl;
  }
  else if (VARIABLE_TYPE_CHAR == variable->GetType())
  {
   out<<"'"<<variable->GetString().GetCString()<<"';"<<std::endl;
  }
  else
  {
   out<<variable->GetString().GetCString()<<";"<<std::endl;
 }}
}
开发者ID:mirai-computing,项目名称:cbp2make,代码行数:19,代码来源:stlconfig.cpp

示例3: sizeof

void ParaEngine::CVariable::Clone(const CVariable& value)
{
	ChangeType(value.GetType());
	m_strVal = value.m_strVal;
	memcpy(m_vector4, value.m_vector4, sizeof(float) * 4);
	if (value.m_pAnimated)
	{
		// TODO: copy animated data. 
		PE_ASSERT(false);
	}
}
开发者ID:LiXizhi,项目名称:NPLRuntime,代码行数:11,代码来源:Variable.cpp

示例4: SaveToFile

void CConfiguration::SaveToFile(const CString& FileName)
{
 FILE *stream = fopen(FileName.GetCString(),"wt");
 for (size_t i = 0; i < m_Variables.size(); i++)
 {
  CVariable *variable = m_Variables[i];
  CString string = variable->GetName()+"=";
  if ((variable->GetType()==VARIABLE_TYPE_STRING)||
      (variable->GetType()==VARIABLE_TYPE_CHAR))
  { string+="\""+variable->GetString()+"\""; }
  else
  { string+=variable->GetString(); }
  string.Append(';').AppendEOL();
  fwrite(string.GetCString(),string.GetLength(),1,stream);
 }
 fclose(stream);
}
开发者ID:mirai-computing,项目名称:cbp2make,代码行数:17,代码来源:stlconfig.cpp


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