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


C++ Name::at方法代码示例

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


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

示例1: at

	bool Name::operator<(const Name& name) const{
		if (size() != name.size()) return size() < name.size();
		for (std::size_t i = 0; i < size(); i++) {
			if (at(i) != name.at(i)) {
				return at(i) < name.at(i);
			}
		}
		return false;
	}
开发者ID:PuerkitoBio,项目名称:locic,代码行数:9,代码来源:Name.cpp

示例2: Name

Name
Strategy::makeInstanceName(const Name& input, const Name& strategyName)
{
  BOOST_ASSERT(strategyName.at(-1).isVersion());

  bool hasVersion = std::any_of(input.rbegin(), input.rend(),
                                [] (const name::Component& comp) { return comp.isVersion(); });
  return hasVersion ? input : Name(input).append(strategyName.at(-1));
}
开发者ID:cawka,项目名称:NFD,代码行数:9,代码来源:strategy.cpp

示例3:

	Name::Name(const Name& prefix, const Name& suffix)
	: isAbsolute_(prefix.isAbsolute()) {
		list_.reserve(prefix.size() + suffix.size());
		for(std::size_t i = 0; i < prefix.size(); i++){
			list_.push_back(prefix.at(i));
		}
		for(std::size_t i = 0; i < suffix.size(); i++){
			list_.push_back(suffix.at(i));
		}
	}
开发者ID:PuerkitoBio,项目名称:locic,代码行数:10,代码来源:Name.cpp

示例4:

void
Tracer::onReceive(const Name& name)
{
    if (m_options.shouldPrintTimestamp) {
        std::cout << time::toIsoString(time::system_clock::now())  << " - ";
    }

    std::cout << "interest received: seq=" << name.at(-1).toUri() << std::endl;
}
开发者ID:shockjiang,项目名称:ndn-tools,代码行数:9,代码来源:tracer.cpp

示例5: isPrefixOf

	bool Name::isPrefixOf(const Name& name) const{
		if(size() >= name.size()) return false;
		for(std::size_t i = 0; i < size(); i++){
			if(at(i) != name.at(i)){
				return false;
			}
		}
		return true;
	}
开发者ID:PuerkitoBio,项目名称:locic,代码行数:9,代码来源:Name.cpp

示例6: performInnerAliasSearch

		SearchResult performInnerAliasSearch(AST::Alias& alias, const Name& name) {
			if (name.size() != 1 || name.isAbsolute()) return SearchResult::None();
			
			const auto iterator = alias.namedTemplateVariables().find(name.at(0));
			if (iterator != alias.namedTemplateVariables().end()) {
				return SearchResult::TemplateVar(*(iterator->second));
			}
			
			return SearchResult::None();
		}
开发者ID:scrossuk,项目名称:locic,代码行数:10,代码来源:NameSearch.cpp

示例7: performInnerCatchClauseSearch

		SearchResult performInnerCatchClauseSearch(AST::CatchClause* catchClause, const Name& name) {
			if (name.size() != 1 || name.isAbsolute()) return SearchResult::None();
			
			const auto iterator = catchClause->namedVariables().find(name.at(0));
			if (iterator != catchClause->namedVariables().end()) {
				return SearchResult::Var(*(iterator->second));
			}
			
			return SearchResult::None();
		}
开发者ID:scrossuk,项目名称:locic,代码行数:10,代码来源:NameSearch.cpp

示例8: performInnerTypeInstanceSearch

		SearchResult performInnerTypeInstanceSearch(AST::TypeInstance& typeInstance, const Name& name) {
			if (name.size() != 1 || name.isAbsolute()) return SearchResult::None();
			
			const auto iterator = typeInstance.namedTemplateVariables().find(name.at(0));
			if (iterator != typeInstance.namedTemplateVariables().end()) {
				return SearchResult::TemplateVar(*(iterator->second));
			}
			
			return SearchResult::None();
		}
开发者ID:scrossuk,项目名称:locic,代码行数:10,代码来源:NameSearch.cpp

示例9: performInnerFunctionSearch

		SearchResult performInnerFunctionSearch(AST::Function& function, const Name& name) {
			if (name.size() != 1 || name.isAbsolute()) return SearchResult::None();
			
			// Search template variables.
			{
				const auto iterator = function.namedTemplateVariables().find(name.at(0));
				if (iterator != function.namedTemplateVariables().end()) {
					return SearchResult::TemplateVar(*(iterator->second));
				}
			}
			
			// Search parameter variables.
			{
				const auto iterator = function.namedVariables().find(name.at(0));
				if (iterator != function.namedVariables().end()) {
					return SearchResult::Var(*(iterator->second));
				}
			}
			
			return SearchResult::None();
		}
开发者ID:scrossuk,项目名称:locic,代码行数:21,代码来源:NameSearch.cpp

示例10: performTypeInstanceSearch

		SearchResult performTypeInstanceSearch(AST::TypeInstance& typeInstance, const Name& name, size_t pos) {
			const auto size = name.size() - pos;
			
			if (size == 0) return SearchResult::TypeInstance(typeInstance);
			
			const auto canonicalName = CanonicalizeMethodName(name.at(pos));
			const auto function = typeInstance.findFunction(canonicalName);
			if (function != nullptr && function->isStaticMethod()) {
				return performFunctionSearch(*function, name, pos + 1);
			}
			
			return SearchResult::None();
		}
开发者ID:scrossuk,项目名称:locic,代码行数:13,代码来源:NameSearch.cpp

示例11:

bool
Name::equals(const Name& name) const
{
  if (size() != name.size())
    return false;

  for (size_t i = 0; i < size(); ++i) {
    if (at(i) != name.at(i))
      return false;
  }

  return true;
}
开发者ID:WeiqiJust,项目名称:NDN-total,代码行数:13,代码来源:name.cpp

示例12:

int
Name::compare(size_t pos1, size_t count1, const Name& other, size_t pos2, size_t count2) const
{
  count1 = std::min(count1, this->size() - pos1);
  count2 = std::min(count2, other.size() - pos2);
  size_t count = std::min(count1, count2);

  for (size_t i = 0; i < count; ++i) {
    int comp = this->at(pos1 + i).compare(other.at(pos2 + i));
    if (comp != 0) { // i-th component differs
      return comp;
    }
  }
  // [pos1, pos1+count) of this Name equals [pos2, pos2+count) of other Name
  return count1 - count2;
}
开发者ID:named-data-ndnSIM,项目名称:ndn-cxx,代码行数:16,代码来源:name.cpp

示例13: performNamespaceSearch

		SearchResult performNamespaceSearch(AST::Namespace& nameSpace, const Name& name, size_t pos) {
			const auto size = name.size() - pos;
			
			if (size == 0) return SearchResult::None();
			
			const auto iterator = nameSpace.items().find(name.at(pos));
			if (iterator != nameSpace.items().end()) {
				const auto& item = iterator->second;
				if (item.isFunction()) {
					return performFunctionSearch(item.function(), name, pos + 1);
				} else if (item.isNamespace()) {
					return performNamespaceSearch(item.nameSpace(), name, pos + 1);
				} else if (item.isAlias()) {
					return performAliasSearch(item.alias(), name, pos + 1);
				} else if (item.isTypeInstance()) {
					return performTypeInstanceSearch(item.typeInstance(), name, pos + 1);
				}
			}
			
			return SearchResult::None();
		}
开发者ID:scrossuk,项目名称:locic,代码行数:21,代码来源:NameSearch.cpp

示例14: if

int
Name::compare(const Name& other) const
{
  for (size_t i = 0; i < size() && i < other.size(); ++i) {
    int comparison = at(i).compare(other.at(i));
    if (comparison == 0)
      // The components at this index are equal, so check the next components.
      continue;

    // Otherwise, the result is based on the components at this index.
    return comparison;
  }

  // The components up to min(this.size(), other.size()) are equal, so the shorter name is less.
  if (size() < other.size())
    return -1;
  else if (size() > other.size())
    return 1;
  else
    return 0;
}
开发者ID:WeiqiJust,项目名称:NDN-total,代码行数:21,代码来源:name.cpp


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