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


C++ string::push_back方法代码示例

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


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

示例1: number_list

	void Parser_XML::number_list(std::string& chaine, std::string& number)
	{
		const char current_token = read_current_token(chaine);
	
		if(ASCII_NUM(current_token)) {
			destroy_current_token(chaine, current_token);
			number.push_back(current_token);

			number_list(chaine, number);
		} else if(current_token == '<') {
		} else if(current_token == '.') {
			destroy_current_token(chaine, current_token);
			number.push_back(current_token);

			number_float(chaine, number);
		} else {
			std::cerr << "Error when reading a number." << std::endl;
		}
	}
开发者ID:BaumannMatthieu,项目名称:Parser_XML,代码行数:19,代码来源:ParserXML.cpp

示例2: set

bool HashMap::set( const std::string& key, const std::string& value)
{
	uint32_t id = m_symtab.getOrCreate( key);
	if (!m_symtab.isNew()) throw strus::runtime_error(_TXT("duplicate definition of symbol '%s'"), key.c_str());
	if (id != m_value_refs.size()+1) throw std::runtime_error( _TXT("internal: inconsistency in data"));
	m_value_strings.push_back('\0');
	m_value_refs.push_back( m_value_strings.size());
	m_value_strings.append( value);
	return true;
}
开发者ID:patrickfrey,项目名称:strusAnalyzer,代码行数:10,代码来源:normalizerDictMap.cpp

示例3: readString

 void readString(std::string& utf8)
 {
   uint32_t i = readUInt32BE();
   utf8.clear();
   utf8.reserve(i);
   while (i--) {
     utf8.push_back(readUInt8BE());
   }
   align(4);
 }
开发者ID:kursatonsoz,项目名称:openrti,代码行数:10,代码来源:InitialStreamProtocol.cpp

示例4: setResourcePath

    void setResourcePath(const std::string& path)
    {
        TGUI_ResourcePath = path;

        if (!TGUI_ResourcePath.empty())
        {
            if (TGUI_ResourcePath[TGUI_ResourcePath.length()-1] != '/')
                TGUI_ResourcePath.push_back('/');
        }
    }
开发者ID:DalikarFT,项目名称:dndgame,代码行数:10,代码来源:TGUI.cpp

示例5: dist

		CgroupManager() {
			std::mt19937 rd{std::random_device{}()};
			std::uniform_int_distribution<int> dist{0, 61};

			groupName.reserve(31);
			groupName.push_back('/');
			for(int i = 0; i < 30; ++ i) {
				int r = dist(rd);

				// Only ASCII and UTF-8 Support
				if(r < 26) {
					groupName.push_back('a' + r);
				}else if(r < 52) {
					groupName.push_back('A' + r - 26);
				}else {
					groupName.push_back('0' + r - 52);
				}
			}
		}
开发者ID:cs3238-tsuzu,项目名称:popcon-judge,代码行数:19,代码来源:cgroup.hpp

示例6: clear

 inline void clear() {
     St.clear();
     s.clear();
     last=1;
     n=0;
     St.push_back(0);
     St.push_back(-1);
     St[0].sufflink=1;
     s.push_back(-1);
 }
开发者ID:petwill,项目名称:coding,代码行数:10,代码来源:palindromicTree.cpp

示例7: getGifMask

static inline void getGifMask(std::string &mask, const std::string &front)
{
    mask = front;
    //Make mask filename
    size_t dotPos = mask.find_last_of('.');
    if(dotPos == std::string::npos)
        mask.push_back('m');
    else
        mask.insert(mask.begin() + dotPos, 'm');
}
开发者ID:Wohlhabend-Networks,项目名称:PGE-Project,代码行数:10,代码来源:LazyFixTool.cpp

示例8: serialize

	void serialize(std::string& out) const
	{
		if (Action == ACT_BAN)
			out.push_back('*');
		else if (Action == ACT_BLOCK)
			out.push_back('~');

		out.append(ConvToStr(Lines)).push_back(':');
		out.append(ConvToStr(Seconds));
		if (Diff)
		{
			out.push_back(':');
			out.append(ConvToStr(Diff));
			if (Backlog)
			{
				out.push_back(':');
				out.append(ConvToStr(Backlog));
			}
		}
	}
开发者ID:Adam-,项目名称:inspircd,代码行数:20,代码来源:m_repeat.cpp

示例9: WideStrToUTF8

void WideStrToUTF8(std::string& dest, wstring& src)
{
	wchar_t w;
	
	dest.clear();
    
	for (size_t i = 0; i < src.size(); i++)
	{
		w = src[i];
        
		if (w <= 0x7f)
		{
			dest.push_back((char)w);
		}
		else if (w <= 0x7ff)
		{
			dest.push_back(0xc0 | ((w >> 6)& 0x1f));
			dest.push_back(0x80| (w & 0x3f));
		}
		else if (w <= 0xffff)
开发者ID:andrew889,项目名称:proton_cm_open,代码行数:20,代码来源:App.cpp

示例10: awwhelper

/* all words with prefix recursive helper method */
void Trie::awwhelper(std::string word, Node* cur, std::vector<std::string>* wl){
    for(int i=0; i<26; i++){
        if(cur->galpha()[i]){
            word.push_back((char)(i + 97)); 
            if(cur->galpha()[i]->isend())
                wl->push_back(word);
            this->awwhelper(word, cur->galpha()[i], wl);
            word.pop_back(); 
        }
    }
}
开发者ID:ktingey,项目名称:portfolio,代码行数:12,代码来源:Trie.cpp

示例11: operator

void StdinReader::operator()()
{
    while(std::cin)
    {
        char c;
        std::cin.get(c);

        std::lock_guard<std::mutex> lock(m_mutex);
        if(std::cin) m_data.push_back(c);
    }
}
开发者ID:Andersbakken,项目名称:rct,代码行数:11,代码来源:ChildProcess.cpp

示例12: assert

 // Finds all occurrences of a circular pattern.
 std::set<int> Multv::cmatch(std::string &pattern) {
   assert(st_ != NULL);
   std::set<char> pattern_alpha = alphabet(pattern);
   assert(pattern_alpha.find('$') == pattern_alpha.end() && pattern_alpha.find('#') == pattern_alpha.end());
   pattern += pattern; // form PP
   pattern.push_back('#'); // add termination character
   st_->insertPattern(pattern, false);
   std::set<int> matches(st_->getMatches());
   st_->removePattern();
   return matches;
 }
开发者ID:blandw,项目名称:cpm,代码行数:12,代码来源:multv.cpp

示例13: escape_username

	std::string escape_username(std::string username)
	{
		if (username.find('@') == username.npos &&
		    !config_file.defdomain.empty())
		{
			username.push_back('@');
			username += config_file.defdomain;
		}

		return escape(username);
	}
开发者ID:svarshavchik,项目名称:courier,代码行数:11,代码来源:authpgsqllib.cpp

示例14: getline

bool istream_t::getline(std::string& line)
{
        /// \todo not very efficient: should buffer larger chunks (1K ?!) and check for endline there!
        char c;
        while (read(&c, 1) && isendl(c)) {}

        line.clear();
        while (read(&c, 1) && !isendl(c)) { line.push_back(c); }

        return m_status != io_status::error && !line.empty();
}
开发者ID:accosmin,项目名称:nano,代码行数:11,代码来源:istream.cpp

示例15: getDireccionYPuerto

void Cliente::getDireccionYPuerto(char const * dir_puerto, \
                                               std::string& direccion,\
                                               t_puerto& puerto){
    std::stringstream puerto_str;
    char c;
    while ((c=*(dir_puerto++)) && c!=':')
       direccion.push_back(c);
    while ((c=*(dir_puerto++)) && c!='\0')
       puerto_str << c;
       puerto_str >> puerto;
}
开发者ID:gizbor,项目名称:taller_tp4,代码行数:11,代码来源:client_Cliente.cpp


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