本文整理汇总了C++中CStringList::InsertUnique方法的典型用法代码示例。如果您正苦于以下问题:C++ CStringList::InsertUnique方法的具体用法?C++ CStringList::InsertUnique怎么用?C++ CStringList::InsertUnique使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CStringList
的用法示例。
在下文中一共展示了CStringList::InsertUnique方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadAliasName
//----------------------------------------
int32_t CMission::LoadAliasName(CStringList& aliases)
{
int32_t result = BRATHL_SUCCESS;
const uint32_t MAX_LINE_LEN = 255;
char line[MAX_LINE_LEN+1];
char name[MAX_LINE_LEN+1];
char alias[MAX_LINE_LEN+1];
bool bFoundInFile = false;
aliases.InsertUnique(GetName());
std::string refFilePathName = CTools::FindDataFile(CMission::m_refAliasName);
if (refFilePathName == "")
{
if (m_printWarnings)
{
printf("\nWARNING - CMission::LoadAliasName - Unabled to open file '%s' "
"\nCheck directory '%s'",
CMission::m_refAliasName,
CTools::GetInternalDataDir().c_str());
}
return BRATHL_WARNING_OPEN_FILE_ALIAS_MISSION;
}
// reads file contains value reference
CFile fileRef(refFilePathName, CFile::modeRead);
if (fileRef.IsOpen() == false)
{
if (m_printWarnings)
{
printf("\nWARNING - CMission::LoadAliasName - Unabled to open file '%s'\n", refFilePathName.c_str());
}
return BRATHL_WARNING_OPEN_FILE_ALIAS_MISSION;
}
int32_t nbFields = EOF;
int32_t size = fileRef.ReadLineData(line, MAX_LINE_LEN);
while (size > 0)
{
nbFields = sscanf ( line, "%s %s",
name,
alias);
if ( (nbFields < 2) )
{
if (m_printWarnings)
{
printf("\nWARNING - CMission::LoadAliasName - Invalid reference mission file format - file name %s \n",
refFilePathName.c_str());
}
return BRATHL_WARNING_INVALID_REF_FILE_FIELD;
}
/*printf("name %s, alias %s\n",
name,
alias);
*/
if (strcmp(name, GetName()) == 0)
{
aliases.InsertUnique(CTools::StringTrim(alias));
bFoundInFile = true;
}
// reads next data
size = fileRef.ReadLineData(line, MAX_LINE_LEN);
}
if (bFoundInFile == false)
{
if (m_printWarnings)
{
printf("\nWARNING - CMission::LoadAliasName - no alias for %s found in file %s \n"
"Default values will be considered\n",
name,
refFilePathName.c_str());
}
}
fileRef.Close();
return result;
}