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


C++ StringList::begin方法代码示例

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


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

示例1: find

  String File::find(const String& filename, StringList directories)
  {
    String filename_new = filename;

    // empty string cannot be found, so throw Exception. 
    // The code below would return success on empty string, since a path is prepended and thus the location exists
    if (filename_new.trim().empty()) throw Exception::FileNotFound(__FILE__, __LINE__, __PRETTY_FUNCTION__, filename);

    //add data dir in OpenMS data path
    directories.push_back(getOpenMSDataPath());

    //add path suffix to all specified directories
    String path = File::path(filename);
    if (path != "")
    {
      for (StringList::iterator it = directories.begin(); it != directories.end(); ++it)
      {
        it->ensureLastChar('/');
        *it += path;
      }
      filename_new = File::basename(filename);
    }

    //look up file
    for (StringList::const_iterator it = directories.begin(); it != directories.end(); ++it)
    {
      String loc = *it;
      loc.ensureLastChar('/');
      loc = loc + filename_new;

      if (exists(loc))
      {
        return String(QDir::cleanPath(loc.toQString()));
      }
    }

    //if the file was not found, throw an exception
    throw Exception::FileNotFound(__FILE__, __LINE__, __PRETTY_FUNCTION__, filename);

    //this is never reached, but needs to be there to avoid compiler warnings
    return "";
  }
开发者ID:BioITer,项目名称:OpenMS,代码行数:42,代码来源:File.C

示例2: String

String ID3v2::Tag::genre() const
{
  // TODO: In the next major version (TagLib 2.0) a list of multiple genres
  // should be separated by " / " instead of " ".  For the moment to keep
  // the behavior the same as released versions it is being left with " ".

  if(d->frameListMap["TCON"].isEmpty() ||
     !dynamic_cast<TextIdentificationFrame *>(d->frameListMap["TCON"].front()))
  {
    return String();
  }

  // ID3v2.4 lists genres as the fields in its frames field list.  If the field
  // is simply a number it can be assumed that it is an ID3v1 genre number.
  // Here was assume that if an ID3v1 string is present that it should be
  // appended to the genre string.  Multiple fields will be appended as the
  // string is built.

  TextIdentificationFrame *f = static_cast<TextIdentificationFrame *>(
    d->frameListMap["TCON"].front());

  StringList fields = f->fieldList();

  StringList genres;

  for(StringList::Iterator it = fields.begin(); it != fields.end(); ++it) {

    if((*it).isEmpty())
      continue;

    bool ok;
    int number = (*it).toInt(&ok);
    if(ok && number >= 0 && number <= 255) {
      *it = ID3v1::genre(number);
    }

    if(std::find(genres.begin(), genres.end(), *it) == genres.end())
      genres.append(*it);
  }

  return genres.toString();
}
开发者ID:,项目名称:,代码行数:42,代码来源:

示例3: resolveRelativePath

 bool AbstractFileManager::resolveRelativePath(const String& relativePath, const StringList& rootPaths, String& absolutePath) {
     StringList::const_iterator rootIt, rootEnd;
     for (rootIt = rootPaths.begin(), rootEnd = rootPaths.end(); rootIt != rootEnd; ++rootIt) {
         const String& rootPath = *rootIt;
         absolutePath = makeAbsolute(relativePath, rootPath);
         if (exists(absolutePath))
             return true;
     }
     
     return false;
 }
开发者ID:ProPuke,项目名称:TrenchBroom,代码行数:11,代码来源:AbstractFileManager.cpp

示例4: unloadAll

// Unloads all loaded modules
void ModuleFactory::unloadAll()
{
    StringList modules = m_dependency.getSortedList();
    std::for_each(modules.begin(), modules.end(),
                  boost::bind(&ModuleFactory::unload, this, _1));
    // clear dependencies
    m_dependency.clear();

    // stop all left
    getScheduler()->stop();
}
开发者ID:,项目名称:,代码行数:12,代码来源:

示例5:

StringList
MessageEncodingRegistry::getCommonEncodings(const StringList& encodingList) const
{
  /// Currently only one encoding available.
  StringList commonEncodingList;
  for (StringList::const_iterator i = encodingList.begin(); i != encodingList.end(); ++i) {
    if (*i == "TightBE1")
      commonEncodingList.push_back(*i);
  }
  return commonEncodingList;
}
开发者ID:kursatonsoz,项目名称:openrti,代码行数:11,代码来源:MessageEncodingRegistry.cpp

示例6: getFiles

// Reads a folder and provides a list with filename from the
// folder
// @param[in] folder - the folder with files
// @exception @ref Result
const StringList Utils::getFiles(const std::string& folder, bool recursive)
{
    DIR* dir = NULL;
    BOOST_ASSERT(Utils::fileExist(folder) == true);
    StringList res;
    dir = opendir(folder.c_str());
    if (dir != NULL)
    {
        struct dirent* dir_info = NULL;
        // Process all files in the subdirectory
        while ((dir_info = readdir(dir)))
        {
            if ((strcmp(dir_info->d_name, ".") != 0) &&
                (strcmp(dir_info->d_name, "..") != 0))
            {
                std::string file_name = folder;
                file_name += "/";
                file_name += dir_info->d_name;

                struct stat st;

                if (lstat(file_name.c_str(), &st) < 0)
                {
                    klk_log(KLKLOG_ERROR, "Error %d in lstat(): %s",
                            errno, strerror(errno));
                    KLKASSERT(0);
                    continue;
                }

                // process only reg file
                if (S_ISREG(st.st_mode))
                {
                    res.push_back(file_name);
                }
                else if (S_ISDIR(st.st_mode) && recursive)
                {
                    StringList files = getFiles(file_name, recursive);
                    std::copy(files.begin(), files.end(),
                              std::back_inserter(res));
                }
            }
        }

        closedir(dir);
    }
    else
    {
        throw Exception(__FILE__, __LINE__,
                             "Error %d in opendir() for %s: %s", errno,
                             folder.c_str(), strerror(errno));
    }

    return res;
}
开发者ID:,项目名称:,代码行数:58,代码来源:

示例7: stringListContain

static inline bool stringListContain(StringList& strList, const string& str)
{
	StringList::iterator iter = strList.begin();
	for (; iter != strList.end(); iter++)
	{
		if (*iter == str) {
			return true;
		}
	}
	return false;
}
开发者ID:,项目名称:,代码行数:11,代码来源:

示例8: StringListAccumulator

// Converts a list to a string with items separated
// by the specified separator
const std::string
Utils::convert2String(const StringList& list, const std::string& sep)
{
    const std::string result = std::accumulate(
        list.begin(),
        list.end(), std::string(""),
        boost::bind<std::string>(
            StringListAccumulator(), _1, _2, sep));

    return result;
}
开发者ID:,项目名称:,代码行数:13,代码来源:

示例9: fieldList

StringList UserTextIdentificationFrame::fieldList() const
{
  StringList l = TextIdentificationFrame::fieldList();

  if(!l.isEmpty()) {
    StringList::Iterator it = l.begin();
    l.erase(it);
  }

  return l;
}
开发者ID:elha,项目名称:CDex,代码行数:11,代码来源:textidentificationframe.cpp

示例10: wipeExternal

void CCUtils::wipeExternal(StringList paths) {
	string internalStorage = getInternalStoragePath();
	if(internalStorage[internalStorage.length() - 1] != '/') {
		internalStorage += "/";
	}
	for(StringList::iterator iter = paths.begin(); iter != paths.end(); iter++) {
		string fullpath = internalStorage + (*iter);
		if(isPathExistent(fullpath)) {
			deleteFile(fullpath);
		}
	}
}
开发者ID:stubma,项目名称:cocos2dx-classical,代码行数:12,代码来源:CCUtils.cpp

示例11: writeObjectFields

void OutputStream::writeObjectFields( const osg::Object* obj )
{
    std::string name = obj->libraryName();
    name += std::string("::") + obj->className();

    ObjectWrapper* wrapper = Registry::instance()->getObjectWrapperManager()->findWrapper( name );
    if ( !wrapper )
    {
        OSG_WARN << "OutputStream::writeObject(): Unsupported wrapper class "
                                << name << std::endl;
        return;
    }
    _fields.push_back( name );

    const StringList& associates = wrapper->getAssociates();
    for ( StringList::const_iterator itr=associates.begin(); itr!=associates.end(); ++itr )
    {
        const std::string& assocName = *itr;
        ObjectWrapper* assocWrapper = Registry::instance()->getObjectWrapperManager()->findWrapper(assocName);
        if ( !assocWrapper )
        {
            OSG_WARN << "OutputStream::writeObject(): Unsupported associated class "
                                    << assocName << std::endl;
            continue;
        }
        else if ( _useSchemaData )
        {
            if ( _inbuiltSchemaMap.find(assocName)==_inbuiltSchemaMap.end() )
            {
                StringList properties;
                assocWrapper->writeSchema( properties );
                if ( properties.size()>0 )
                {
                    std::string propertiesString;
                    for ( StringList::iterator sitr=properties.begin(); sitr!=properties.end(); ++sitr )
                    {
                        propertiesString += *sitr;
                        propertiesString += ' ';
                    }
                    _inbuiltSchemaMap[assocName] = propertiesString;
                }
            }
        }
        _fields.push_back( assocWrapper->getName() );

        assocWrapper->write( *this, *obj );
        if ( getException() ) return;

        _fields.pop_back();
    }
    _fields.pop_back();

}
开发者ID:nsmoooose,项目名称:osg,代码行数:53,代码来源:OutputStream.cpp

示例12: parseRelations

static int parseRelations()
{
	depTable.clear();
	confTable.clear();

	char assistName[MAX_PATH];
	sprintf(assistName, "%s\\%s\\%s", WtoA(getMiscPath(PATH_IPS)), BurnDrvGetTextA(DRV_NAME), "assistant.txt");

	//parse ips dat and update the treewidget
	FILE* fp = fopen(assistName, "rt");
	if (!fp) {
		return 1;
	}

	char s[1024];
	char* p = NULL;
	string line;
	size_t nLen = 0;
	size_t pos = string::npos;

	while (!feof(fp)) {
		if (fgets(s, sizeof s, fp) != NULL) {
			p = s;
			// skip UTF-8 sig
			if (strncmp(p, UTF8_SIGNATURE, strlen(UTF8_SIGNATURE)) == 0) {
				p += strlen(UTF8_SIGNATURE);
			}

			if (p[0] == '#') {
				continue; // skip comment
			}

			getLine(p);
			line = p;

			pos = line.find(">");
			if (pos != string::npos) {
				StringList depStrs = split2Str(line, ">");
				string parent = *(depStrs.begin());
				lowerString(parent);
				StringList children = stringSplit(depStrs.back(), ",");
				lowerTrimmed(children);
				depTable.insert(make_pair(parent, children));
			} else {
				StringList conflicts = stringSplit(line, ",");
				lowerTrimmed(conflicts);
				confTable.push_back(conflicts);
			}
		}
	}

	return 0;
}
开发者ID:,项目名称:,代码行数:53,代码来源:

示例13: main

int main ()
{
    // Create a list of critters.
    StringList critters;

    // Insert a few critters.
    critters.insert (critters.begin (), "antelope");
    critters.insert (critters.begin (), "bear");
    critters.insert (critters.begin (), "cat");

    // Print out the list.
    std::cout << critters << '\n';

    // Change cat to cougar.
    *std::find (critters.begin (),critters.end (), "cat") = "cougar";
    std::cout << critters << '\n';

    // Put a zebra at the beginning, an ocelot ahead of antelope,
    // and a rat at the end.
    critters.push_front ("zebra");
    critters.insert (std::find (critters.begin (), critters.end (),
                                "antelope"), "ocelot");
    critters.push_back ("rat");
    std::cout << critters << '\n';

    // Sort the list (Use list's sort function since the 
    // generic algorithm requires a random access iterator 
    // and list only provides bidirectional)
    critters.sort ();
    std::cout << critters << '\n';

    // Now let's erase half of the critters.
    StringList::size_type half = critters.size () / 2;
    for (StringList::size_type i = 0; i != half; ++i)
        critters.erase (critters.begin ());

    std::cout << critters << '\n';
  
    return 0;
}
开发者ID:Flameeyes,项目名称:stdcxx,代码行数:40,代码来源:list.cpp

示例14: if

// Retrives list of possible completions for a n's parameter
const cli::ParameterVector
ScanStart::getCompletion(const cli::ParameterVector& setparams)
{
    cli::ParameterVector res;

    if (setparams.empty())
    {
        // possible source names
        IDevList list =
            getFactory()->getResources()->getResourceByType(dev::DVB_ALL);
        for (IDevList::iterator i = list.begin(); i != list.end(); i++)
        {
            const std::string source = (*i)->getStringParam(dev::SOURCE);
            if (!source.empty())
            {
                const std::string source_name =
                    dvb::Utils::getSourceName(getFactory(),
                                              source);
                if (std::find(res.begin(), res.end(), source_name) ==
                    res.end())
                {
                    res.push_back(source_name);
                }
            }
        }
    }
    else if (setparams.size() == 1)
    {
        IDevPtr dev = getDev(setparams[0]);
        // possible frequency table
        StringList list;
        if (dev->getStringParam(dev::TYPE) == dev::DVB_T)
        {
            list = base::Utils::getFiles(dir::SHARE + "/scan/dvb-t");
        }
        else if (dev->getStringParam(dev::TYPE) == dev::DVB_S)
        {
            list = base::Utils::getFiles(dir::SHARE + "/scan/dvb-s");
        }

        for (StringList::iterator i = list.begin(); i != list.end(); i++)
        {
            const std::string fname = base::Utils::getFileName(*i);
            if (std::find(res.begin(), res.end(), fname) == res.end())
            {
                res.push_back(fname);
            }
        }
    }

    return res;
}
开发者ID:,项目名称:,代码行数:53,代码来源:

示例15: GetRocketRow

	void GetRocketRow( StringList &rocketRow, int row_index, const StringList& cols ) const {
		RowsList::const_iterator r_it = rows.begin();
		std::advance( r_it, row_index );
		if( r_it == rows.end() ) {;
			return;
		}

		const Row &row = *r_it;
		for( StringList::const_iterator it = cols.begin(); it != cols.end(); ++it ) {
			Row::const_iterator v = row.find( (*it).CString() );
			rocketRow.push_back( v == row.end() ? "" : v->second.c_str() );
		}
	}
开发者ID:Clever-Boy,项目名称:qfusion,代码行数:13,代码来源:ui_gameajax_datasource.cpp


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