本文整理汇总了C++中FactoryResource::setCodewords方法的典型用法代码示例。如果您正苦于以下问题:C++ FactoryResource::setCodewords方法的具体用法?C++ FactoryResource::setCodewords怎么用?C++ FactoryResource::setCodewords使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FactoryResource
的用法示例。
在下文中一共展示了FactoryResource::setCodewords方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setClassification
bool ClassificationImp::setClassification(const string& classificationText)
{
if (classificationText.empty() == true)
{
return false;
}
Service<UtilityServices> pUtilities;
FactoryResource<Classification> pClassification;
const string delimiter = "//";
// Level
QString field = QString::fromStdString(classificationText);
string::size_type pos = classificationText.find(delimiter);
if (pos != string::npos)
{
field = QString::fromStdString(classificationText.substr(0, pos));
}
pClassification->setLevel(field.toStdString());
// All other fields
while (pos != string::npos)
{
// Get the next field
pos += delimiter.length();
string::size_type nextPos = classificationText.find(delimiter, pos);
if (nextPos != string::npos)
{
field = QString::fromStdString(classificationText.substr(pos, nextPos - pos));
}
else
{
field = QString::fromStdString(classificationText.substr(pos));
}
pos = nextPos;
if (field.isEmpty() == true)
{
continue;
}
QStringList fieldList = field.split("/", QString::SkipEmptyParts);
// Codewords
bool codewordsField = true;
const vector<string>& codewords = pUtilities->getCodewords();
for (int i = 0; i < fieldList.count(); ++i)
{
if (std::find(codewords.begin(), codewords.end(), fieldList[i].toStdString()) == codewords.end())
{
codewordsField = false;
break;
}
}
if (codewordsField == true)
{
field.replace("/", " ");
pClassification->setCodewords(field.toStdString());
continue;
}
// System
bool systemField = true;
const vector<string>& systems = pUtilities->getSystems();
for (int i = 0; i < fieldList.count(); ++i)
{
if (std::find(systems.begin(), systems.end(), fieldList[i].toStdString()) == systems.end())
{
systemField = false;
break;
}
}
if (systemField == true)
{
field.replace("/", " ");
pClassification->setSystem(field.toStdString());
continue;
}
// File releasing
bool fileReleasingField = true;
const QString relTo = "REL TO";
const vector<string>& fileReleasings = pUtilities->getFileReleasing();
for (int i = 0; i < fieldList.count(); ++i)
{
QString fileReleasing = fieldList[i];
if (fileReleasing.indexOf(relTo) == 0)
{
fileReleasing = relTo;
}
//.........这里部分代码省略.........