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


C++ StringSet::find方法代码示例

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


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

示例1:

bool
inWordSet(int i)
{
  const ECString& w = Pst::fromInt(i);
  if(wordSet.find(w) == wordSet.end()) return false;
  return true;
}
开发者ID:haewon-mit,项目名称:Syntax-Analysis,代码行数:7,代码来源:trainRs.C

示例2: has_repeats

static bool has_repeats(const Fragments& fragments) {
    StringSet genomes;
    BOOST_FOREACH (Fragment* f, fragments) {
        ASSERT_TRUE(f->seq());
        std::string genome = f->seq()->genome();
        if (genomes.find(genome) != genomes.end()) {
            return true;
        }
        genomes.insert(genome);
    }
开发者ID:npge,项目名称:npge,代码行数:10,代码来源:SplitRepeats.cpp

示例3: unsetToken

// Note: static method
bool LDModelParser::unsetToken(StringSet &tokens, const char *token)
{
	StringSet::iterator it = tokens.find(token);

	if (it != tokens.end())
	{
		tokens.erase(it);
		return true;
	}
	return false;
}
开发者ID:HazenBabcock,项目名称:LDView,代码行数:12,代码来源:LDModelParser.cpp

示例4: nameIsUnique

bool SemanticValidator::nameIsUnique(StringSet set, const std::string name, CdefMessage msgType, const std::string& property)
{
	StringSet::const_iterator got = set.find(name);

	if (got != set.end()) {
		CompileMessage error(CompileMessage::type_t::Error, msgType, _callback, 
			"The %s '%s' is used more than once", property.c_str(), name.c_str());
		return false;
	}

	set.insert(name);
	return true;
}
开发者ID:antoncl,项目名称:libPerfCounter,代码行数:13,代码来源:SemanticValidator.cpp

示例5: parser

void PointMatcher<T>::ICPChainBase::loadFromYaml(std::istream& in)
{
	this->cleanup();
	
	YAML::Parser parser(in);
	YAML::Node doc;
	parser.GetNextDocument(doc);
	typedef set<string> StringSet;
	StringSet usedModuleTypes;
	
	// Fix for issue #6: compilation on gcc 4.4.4
	//PointMatcher<T> pm;
	const PointMatcher & pm = PointMatcher::get();

	{
		// NOTE: The logger needs to be initialize first to allow ouput from other contructors
		boost::mutex::scoped_lock lock(loggerMutex);
		usedModuleTypes.insert(createModuleFromRegistrar("logger", doc, pm.REG(Logger), logger));
	}
	usedModuleTypes.insert(createModulesFromRegistrar("readingDataPointsFilters", doc, pm.REG(DataPointsFilter), readingDataPointsFilters));
	usedModuleTypes.insert(createModulesFromRegistrar("readingStepDataPointsFilters", doc, pm.REG(DataPointsFilter), readingStepDataPointsFilters));
	usedModuleTypes.insert(createModulesFromRegistrar("referenceDataPointsFilters", doc, pm.REG(DataPointsFilter), referenceDataPointsFilters));
	//usedModuleTypes.insert(createModulesFromRegistrar("transformations", doc, pm.REG(Transformation), transformations));
	//usedModuleTypes.insert(createModuleFromRegistrar("matcher", doc, pm.REG(Matcher), matcher)); // don't destroy the already created tree
	usedModuleTypes.insert(createModulesFromRegistrar("outlierFilters", doc, pm.REG(OutlierFilter), outlierFilters));
	usedModuleTypes.insert(createModuleFromRegistrar("errorMinimizer", doc, pm.REG(ErrorMinimizer), errorMinimizer));

	// See if to use a rigid transformation
	if (nodeVal("errorMinimizer", doc) != "PointToPointSimilarityErrorMinimizer")
		this->transformations.push_back(new typename TransformationsImpl<T>::RigidTransformation());
	else
		this->transformations.push_back(new typename TransformationsImpl<T>::SimilarityTransformation());
	
	usedModuleTypes.insert(createModulesFromRegistrar("transformationCheckers", doc, pm.REG(TransformationChecker), transformationCheckers));
	usedModuleTypes.insert(createModuleFromRegistrar("inspector", doc, pm.REG(Inspector),inspector));
	
	
	// FIXME: this line cause segfault when there is an error in the yaml file...
	//loadAdditionalYAMLContent(doc);
	
	// check YAML entries that do not correspend to any module
	for(YAML::Iterator moduleTypeIt = doc.begin(); moduleTypeIt != doc.end(); ++moduleTypeIt)
	{
		string moduleType;
		moduleTypeIt.first() >> moduleType;
		if (moduleType != "matcher" && usedModuleTypes.find(moduleType) == usedModuleTypes.end())
			throw InvalidModuleType(
				(boost::format("Module type %1% does not exist") % moduleType).str()
			);
	}
}
开发者ID:oleg-alexandrov,项目名称:libpointmatcher,代码行数:51,代码来源:ICP.cpp

示例6: IsBoolField

	bool IsBoolField(const string& field_name) {
		static StringSet int_bool_filter, special_bool_filter;
		if (int_bool_filter.empty() && special_bool_filter.empty()) {
			int_bool_filter.insert("lan-mode");
			int_bool_filter.insert("announce");
			int_bool_filter.insert("query");
			int_bool_filter.insert("rcon");
			int_bool_filter.insert("logqueries");
			int_bool_filter.insert("chatlogging");

			special_bool_filter.insert("timestamp");
			special_bool_filter.insert("output");
		}
		return int_bool_filter.end() != int_bool_filter.find(field_name) || special_bool_filter.end() != special_bool_filter.find(field_name);
	}
开发者ID:sabinich,项目名称:gsmanager,代码行数:15,代码来源:gta_mini.cpp

示例7: SIsMember

 int MMKVImpl::SIsMember(DBID db, const Data& key, const Data& member)
 {
     int err = 0;
     RWLockGuard<MemorySegmentManager, READ_LOCK> keylock_guard(m_segment);
     StringSet* set = GetObject<StringSet>(db, key, V_TYPE_SET, false, err)();
     if (IS_NOT_EXISTS(err))
     {
         return 0;
     }
     if (NULL == set || 0 != err)
     {
         return err;
     }
     return set->find(Object(member, true)) != set->end();
 }
开发者ID:shitfSign,项目名称:mmkv,代码行数:15,代码来源:t_set.cpp

示例8: can_finalize_function

static bool can_finalize_function(StringRef F, SmallSet<Module*, 16> &known)
{
    if (incomplete_fname.find(F) != incomplete_fname.end())
        return false;
    Module *M = module_for_fname.lookup(F);
    if (M && known.insert(M).second) {
        for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I) {
            Function *F = &*I;
            if (F->isDeclaration() && !isIntrinsicFunction(F)) {
                if (!can_finalize_function(F->getName(), known))
                    return false;
            }
        }
    }
    return true;
}
开发者ID:davidanthoff,项目名称:julia,代码行数:16,代码来源:jitlayers.cpp

示例9: reportingFrequencyGeneralTests

void reportingFrequencyGeneralTests(SqlFile& file, const SqlFileTimeSeriesQueryVector& allQueries) {
  // list of reporting frequencies from file should match .valueDescriptions() from vector
  StringSet rfStrs;
  for (const std::string& envPeriod : file.availableEnvPeriods()) {
    StringVector rfStrsForEnv = file.availableReportingFrequencies(envPeriod);
    rfStrs.insert(rfStrsForEnv.begin(),rfStrsForEnv.end());
  }
  ReportingFrequencySet rfSetFromVector = reportingFrequencies(allQueries);
  StringSet rfStrsFromVector;
  for (const ReportingFrequency& rf : rfSetFromVector) {
    rfStrsFromVector.insert(rf.valueDescription());
  }
  EXPECT_TRUE(rfStrs.size() >= rfStrsFromVector.size());
  for (const std::string& rfStr : rfStrsFromVector) {
    EXPECT_TRUE(rfStrs.find(rfStr) != rfStrs.end());
  }
}
开发者ID:NREL,项目名称:OpenStudio,代码行数:17,代码来源:SqlFileTimeSeriesQuery_GTest.cpp

示例10: main

int main() {
    StringSet strings = SourceHighlightUtils::getFileNames(BASEDIR, "lang");

    printStringSet(strings);
    cout << endl;

    assertTrue(strings.find("java.lang") != strings.end(), "expected java.lang");
    assertTrue(strings.find("symbols.lang") != strings.end(),
            "expected symbols.lang");
    assertTrue(strings.find("foobar.lang") == strings.end(),
            "NON expected foobar.lang");

    strings = SourceHighlightUtils::getStyleFileNames(BASEDIR);

    printStringSet(strings);
    cout << endl;

    assertTrue(strings.find("default.style") != strings.end(),
            "expected default.style");

    strings = SourceHighlightUtils::getCssStyleFileNames(BASEDIR);

    printStringSet(strings);
    cout << endl;

    assertTrue(strings.find("default.css") != strings.end(),
                "expected default.css");

    strings = SourceHighlightUtils::getLangFileNames(BASEDIR);

    printStringSet(strings);
    cout << endl;

    assertTrue(strings.find("java.lang") != strings.end(),
                "expected java.lang");

    strings = SourceHighlightUtils::getOutLangFileNames(BASEDIR);

    printStringSet(strings);
    cout << endl;

    assertTrue(strings.find("html.outlang") != strings.end(),
                "expected html.outlang");

    cout << "test_utils: SUCCESS" << endl;

    return 0;
}
开发者ID:balagopalraj,项目名称:clearlinux,代码行数:48,代码来源:test_utils_main.cpp

示例11: ConvertToBool

	void ConvertToBool(string& field_name) {
		static StringSet special_bool_filter;
		if(special_bool_filter.empty()) {
			special_bool_filter.insert("timestamp");
			special_bool_filter.insert("output");
		}
		if(special_bool_filter.end() == special_bool_filter.find(field_name)) {
			if("on" == m_conf[field_name])
				m_conf[field_name] = "1";
			else
				m_conf[field_name] = "0";
		} else {
			if("on" == m_conf[field_name])
				m_conf[field_name] = "Enable";
			else
				m_conf[field_name] = "Disable";
		}
	}
开发者ID:sabinich,项目名称:gsmanager,代码行数:18,代码来源:gta_mini.cpp

示例12: verifyAndReportDangerousProperties

  static void verifyAndReportDangerousProperties(const StringSet &dangerousProperties,
                                                 const StringSet &clearedProperties,
                                                 const std::string &ivarName,
                                                 const QualType ivarType,
                                                 const std::string &declName,
                                                 const std::function<void(StringRef)> &emitBugReport) {
    // Verify that all the dangerous properties have been cleared
    for(auto it = dangerousProperties.begin(), end = dangerousProperties.end(); it != end; it++) {

      if (clearedProperties.find(*it) == clearedProperties.end()) {
        llvm::SmallString<128> buf;
        llvm::raw_svector_ostream os(buf);
        StringRef className;
        const ObjCObjectPointerType *classType = dyn_cast_or_null<ObjCObjectPointerType>(ivarType.getTypePtr());
        if (classType && classType->getInterfaceDecl()) {
          className = classType->getInterfaceDecl()->getName();
        }

        os << "Leaking unsafe reference to self stored in "<< ivarName << "." << *it;
        if (declName != "") {
          os << " (in " << declName << ")";
        }
        os << ". ";

        os << "The assign property '" << *it << "' of the ";
        if (className != "") {
          os << "instance of " << className;
        } else {
          os << "object";
        }
        os << " stored in '" << ivarName << "' appears to occasionally point to self. ";

        os << "For memory safety, you need to clear this property explicitly before losing reference to this object, typically by adding a line: '" << ivarName << "." << *it << " = nil;'. ";

        os << "In case of a false warning, consider adding an assert instead: 'FBAssert(" << ivarName << "." << *it << " != self);' or, if applicable: 'FBAssert(!" << ivarName << ");'.";

        emitBugReport(os.str());
      }
    }
  }
开发者ID:openaphid,项目名称:facebook-clang-plugins,代码行数:40,代码来源:DanglingDelegateChecker.cpp

示例13: SRem

 int MMKVImpl::SRem(DBID db, const Data& key, const DataArray& members)
 {
     if (m_readonly)
     {
         return ERR_PERMISSION_DENIED;
     }
     int err = 0;
     RWLockGuard<MemorySegmentManager, WRITE_LOCK> keylock_guard(m_segment);
     EnsureWritableValueSpace();
     StringSet* set = GetObject<StringSet>(db, key, V_TYPE_SET, false, err)();
     if (IS_NOT_EXISTS(err))
     {
         return 0;
     }
     if (NULL == set || 0 != err)
     {
         return err;
     }
     int removed = 0;
     for (size_t i = 0; i < members.size(); i++)
     {
         StringSet::iterator found = set->find(Object(members[i], true));
         if (found != set->end())
         {
             Object cc = *found;
             set->erase(found);
             DestroyObjectContent(cc);
             removed++;
         }
     }
     if (set->empty())
     {
         GenericDel(GetMMKVTable(db, false),db, Object(key, false));
     }
     return removed;
 }
开发者ID:shitfSign,项目名称:mmkv,代码行数:36,代码来源:t_set.cpp

示例14: authorize

void authorize(const AuthParams &challenge, AuthParams &authorization,
               const URI &uri, const std::string &method, const std::string &username,
               const std::string &password)
{
    std::string realm, qop, nonce, opaque, algorithm;
    StringMap::const_iterator it;
    if ( (it = challenge.parameters.find("realm")) != challenge.parameters.end()) realm = it->second;
    if ( (it = challenge.parameters.find("qop")) != challenge.parameters.end()) qop = it->second;
    if ( (it = challenge.parameters.find("nonce")) != challenge.parameters.end()) nonce = it->second;
    if ( (it = challenge.parameters.find("opaque")) != challenge.parameters.end()) opaque = it->second;
    if ( (it = challenge.parameters.find("algorithm")) != challenge.parameters.end()) algorithm = it->second;

    if (algorithm.empty())
        algorithm = "MD5";
    StringSet qopValues;
    bool authQop = false;
    // If the server specified a quality of protection (qop), make sure it allows "auth"
    if (!qop.empty()) {
        ListParser parser(qopValues);
        parser.run(qop);
        if (parser.error() || !parser.complete())
            MORDOR_THROW_EXCEPTION(BadMessageHeaderException());
        if (qopValues.find("auth") == qopValues.end())
            MORDOR_THROW_EXCEPTION(InvalidQopException(qop));
        authQop = true;
    }

    // come up with a suitable client nonce
    std::ostringstream os;
    os << std::hex << TimerManager::now();
    std::string cnonce = os.str();
    std::string nc = "00000001";

    // compute A1
    std::string A1;
    if (algorithm == "MD5")
        A1 = username + ':' + realm + ':' + password;
    else if (algorithm == "MD5-sess")
        A1 = md5( username + ':' + realm + ':' + password ) + ':' + nonce + ':' + cnonce;
    else
        MORDOR_THROW_EXCEPTION(InvalidAlgorithmException(algorithm));

    // compute A2 - our qop is always auth or unspecified
    os.str("");
    os << method << ':' << uri;
    std::string A2 = os.str();

    authorization.scheme = "Digest";
    authorization.base64.clear();
    authorization.parameters["username"] = username;
    authorization.parameters["realm"] = realm;
    authorization.parameters["nonce"] = nonce;
    authorization.parameters["uri"] = uri.toString();
    authorization.parameters["algorithm"] = algorithm;

    std::string response;
    if (authQop) {
        qop = "auth";
        response = md5( md5(A1) + ':' + nonce + ':' + nc + ':' + cnonce + ':' + qop + ':' + md5(A2) );
        authorization.parameters["qop"] = qop;
        authorization.parameters["nc"] = nc;
        authorization.parameters["cnonce"] = cnonce;
    } else {
        response = md5( md5(A1) + ':' + nonce + ':' + md5(A2) );

    }
    authorization.parameters["response"] = response;
    if (!opaque.empty())
        authorization.parameters["opaque"] = opaque;
}
开发者ID:DavidXubin,项目名称:mordor,代码行数:70,代码来源:digest.cpp

示例15: writeVCProjectFiles

void SBSourcesBuildPhase::writeVCProjectFiles(VCProject& proj) const
{
  // We don't support source compilation when building bundles
  TargetProductType productType = m_parentTarget.getProductType();
  if (productType == TargetBundle)
  {
    if (!m_phase->getBuildFileList().empty()) {
      SBLog::warning() << "Ignoring all source files in \"" << m_parentTarget.getName() << "\" bundle target." << std::endl;
    }
    return;
  }

  SBBuildPhase::writeVSFileDescriptions(proj, "Text");

  String xcProjectDir = m_parentTarget.getProject().getProjectDir();
  String vsProjectDir = sb_dirname(proj.getPath());
  StringSet prefixHeaders;
  for (auto bs : m_parentTarget.getBuildSettings()) {
    VCProjectConfiguration* config = proj.addConfiguration(bs.first);

    // Prefix header (recalculate relative path)
    String prefixHeader = bs.second->getValue("GCC_PREFIX_HEADER");
    if (!prefixHeader.empty()) {
      String absHeaderPath = m_parentTarget.makeAbsolutePath(prefixHeader);
      String relHeaderPath = m_parentTarget.makeRelativePath(prefixHeader, vsProjectDir);;
      relHeaderPath = winPath(relHeaderPath);
      config->setItemDefinition("ClangCompile", "PrefixHeader", relHeaderPath);

      // Add plist file to project (only once)
      if (prefixHeaders.find(absHeaderPath) == prefixHeaders.end()) {
        addRelativeFilePathToVS("ClInclude", absHeaderPath, "", proj, *bs.second);
        prefixHeaders.insert(absHeaderPath);
      }
    }

    // Preprocessor definitions
    StringVec preprocessorTokens;
    bs.second->getValue("GCC_PREPROCESSOR_DEFINITIONS", preprocessorTokens);
    String preprocessorDefs = joinStrings(preprocessorTokens, ";");
    if (!preprocessorDefs.empty()) {
      config->setItemDefinition("ClangCompile", "PreprocessorDefinitions", preprocessorDefs);
    }

    // Optimization level
    String optimizationLevel = bs.second->getValue("GCC_OPTIMIZATION_LEVEL");
    if (!optimizationLevel.empty()) {
      String vsOptimizationLevel;
      if (optimizationLevel == "s") {
        vsOptimizationLevel = "MinSpace";
      } else if (optimizationLevel == "0") {
        vsOptimizationLevel = "Disabled";
      } else {
        vsOptimizationLevel = "MaxSpeed";
      }
      config->setItemDefinition("ClangCompile", "OptimizationLevel", vsOptimizationLevel);
    }

    // ARC
    String enableARC = bs.second->getValue("CLANG_ENABLE_OBJC_ARC");
    if (enableARC == "YES") {
      config->setItemDefinition("ClangCompile", "ObjectiveCARC", "true");
    }

    // Modules
    String enableModules = bs.second->getValue("CLANG_ENABLE_MODULES");
    if (enableModules == "YES") {
        config->setItemDefinition("ClangCompile", "ObjectiveCModules", "true");
    }

    // Header search paths (make them relative)
    StringVec includePaths;
    bs.second->getValue("HEADER_SEARCH_PATHS", includePaths);
    for (auto &cur : includePaths) {
      cur = m_parentTarget.makeRelativePath(cur, vsProjectDir);
      cur = winPath(cur);
    }
    includePaths.insert(includePaths.begin(), "$(SolutionPublicHeadersDir)");
    config->setItemDefinition("ClangCompile", "IncludePaths", joinStrings(includePaths, ";"));

    // User header search paths (make them relative)
    StringVec userIncludePaths;
    bs.second->getValue("USER_HEADER_SEARCH_PATHS", userIncludePaths);
    for (auto &cur : userIncludePaths) {
      cur = m_parentTarget.makeRelativePath(cur, vsProjectDir);
      cur = winPath(cur);
    }
    if (!userIncludePaths.empty()) {
      config->setItemDefinition("ClangCompile", "UserIncludePaths", joinStrings(userIncludePaths, ";"));
    }

    // Exclude search path subdirectories
    StringVec excludeSubDirectories;
    bs.second->getValue("EXCLUDED_RECURSIVE_SEARCH_PATH_SUBDIRECTORIES", excludeSubDirectories);
    if (!excludeSubDirectories.empty()) {
        config->setItemDefinition("ClangCompile", "ExcludedSearchPathSubdirectories", joinStrings(excludeSubDirectories, ";"));
    }

    // Header map
    if (bs.second->getValue("USE_HEADERMAP") == "YES") {
      if (bs.second->getValue("ALWAYS_SEARCH_USER_PATHS") == "YES") {
//.........这里部分代码省略.........
开发者ID:Dyndrilliac,项目名称:WinObjC,代码行数:101,代码来源:SBSourcesBuildPhase.cpp


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