本文整理汇总了C++中ParamInfo::addEnumValue方法的典型用法代码示例。如果您正苦于以下问题:C++ ParamInfo::addEnumValue方法的具体用法?C++ ParamInfo::addEnumValue怎么用?C++ ParamInfo::addEnumValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ParamInfo
的用法示例。
在下文中一共展示了ParamInfo::addEnumValue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getParamType
ParamInfo* TracerBase::getParamType(std::istream& stream)
{
boost::optional<ParamInfo::Type> parType;
std::string parTypeName;
stream >> parTypeName;
if (parTypeName == "E")
{
parType = ParamInfo::Type::ENUMERATIVE;
}
else if (parTypeName == "I")
{
parType = ParamInfo::Type::INTEGER;
}
else if (parTypeName == "R")
{
parType = ParamInfo::Type::REAL;
}
else if (parTypeName == "B")
{
parType = ParamInfo::Type::BOOL;
}
else if (parTypeName == "A")
{
parType = ParamInfo::Type::ARRAY;
}
else if (parTypeName == "S")
{
parType = ParamInfo::Type::STRING;
}
else
{
int i = 0;
try
{
// тип ресурса сначала пишет в поток его ID
i = boost::lexical_cast<int>(parTypeName);
}
catch (const boost::bad_lexical_cast &)
{}
if (i)
{
parType = ParamInfo::Type::RESOURCE;
//потом его имя
stream >> parTypeName;
//потом число его параметров
stream >> parTypeName;
int n = boost::lexical_cast<int>(parTypeName);
for (i = 0; i < n; ++i)
getParam(stream);
}
}
ASSERT(parType.is_initialized());
ParamInfo* pParam = new ParamInfo(parType.get());
if (parType == ParamInfo::Type::ENUMERATIVE)
{
std::size_t enumCount;
stream >> enumCount;
for (std::size_t j = 0; j < enumCount; j++)
{
std::string enumID;
stream >> enumID;
std::string enumName;
stream >> enumName;
pParam->addEnumValue(enumName);
}
}