本文整理汇总了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;
}
}
示例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;
}
示例3: readString
void readString(std::string& utf8)
{
uint32_t i = readUInt32BE();
utf8.clear();
utf8.reserve(i);
while (i--) {
utf8.push_back(readUInt8BE());
}
align(4);
}
示例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('/');
}
}
示例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);
}
}
}
示例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);
}
示例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');
}
示例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));
}
}
}
示例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)
示例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();
}
}
}
示例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);
}
}
示例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;
}
示例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);
}
示例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();
}
示例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;
}