本文整理汇总了C++中Search::clone方法的典型用法代码示例。如果您正苦于以下问题:C++ Search::clone方法的具体用法?C++ Search::clone怎么用?C++ Search::clone使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Search
的用法示例。
在下文中一共展示了Search::clone方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: set
bool Query::set(int index, const Search& search)
{
if (!isValidIndex(index))
return false;
int subindex = m_searchMap.indexOf(index);
if (subindex >= 0) {
delete m_search.at(subindex);
m_search.replace(subindex, search.clone());
return true;
} else {
subindex = m_operatorMap.indexOf(index);
if (subindex >= 0) {
// Here the given index is a operator, so we have to remove the operator,
// and add a search at that position
m_operatorMap.removeAt(m_operatorMap.at(subindex));
m_operator.removeAt(m_operator.at(subindex));
m_search.append(search.clone());
m_searchMap.append(index);
m_elementType[index] = SearchElement;
return true;
} else {
// The index could not be found in the operator or search lists
return false;
}
}
}
示例2: append
void Query::append(const Search& search)
{
m_search.append(search.clone());
m_searchMap.append(m_elementType.count());
m_elementType.append(SearchElement);
}