本文整理汇总了C++中string_type::append方法的典型用法代码示例。如果您正苦于以下问题:C++ string_type::append方法的具体用法?C++ string_type::append怎么用?C++ string_type::append使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类string_type
的用法示例。
在下文中一共展示了string_type::append方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: xsputn
std::streamsize xsputn(const char_type* s, std::streamsize n) {
typedef typename string_type::size_type size_type;
BOOST_ASSERT(string != nullptr);
basic_ostringstreambuf::sync();
const size_type max_size_left = string->max_size() - string->size();
if (static_cast<size_type>(n) < max_size_left) {
string->append(s, static_cast<size_type>(n));
return n;
}
string->append(s, max_size_left);
return static_cast<std::streamsize>(max_size_left);
}
示例2: xsputn
//! Puts a character sequence to the string
std::streamsize xsputn(const char_type* s, std::streamsize n)
{
BOOST_ASSERT(m_Storage != 0);
basic_ostringstreambuf::sync();
typedef typename string_type::size_type string_size_type;
register const string_size_type max_storage_left =
m_Storage->max_size() - m_Storage->size();
if (static_cast< string_size_type >(n) < max_storage_left)
{
m_Storage->append(s, static_cast< string_size_type >(n));
return n;
}
else
{
m_Storage->append(s, max_storage_left);
return static_cast< std::streamsize >(max_storage_left);
}
}
示例3: sync
int sync() {
BOOST_ASSERT(string != nullptr);
char_type* pbase = this->pbase();
char_type* pptr = this->pptr();
if (pbase != pptr) {
string->append(pbase, pptr);
this->pbump(static_cast<int>(pbase - pptr));
}
return 0;
}
示例4: sync
//! Puts all buffered data to the string
int sync()
{
BOOST_ASSERT(m_Storage != 0);
register char_type* pBase = this->pbase();
register char_type* pPtr = this->pptr();
if (pBase != pPtr)
{
m_Storage->append(pBase, pPtr);
this->pbump(static_cast< int >(pBase - pPtr));
}
return 0;
}
示例5: write
// Write to a wstring
void write(string_type& s, const char_type* from, const char_type* to) {
assert(from <= to);
s.append(from, to);
}
示例6: append
static void append(string_type& str, const char* f, const char* l) {
str.append(f, l);
}