本文整理汇总了C++中std::basic_string::assign方法的典型用法代码示例。如果您正苦于以下问题:C++ basic_string::assign方法的具体用法?C++ basic_string::assign怎么用?C++ basic_string::assign使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类std::basic_string
的用法示例。
在下文中一共展示了basic_string::assign方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Build
void Build(const wxByte* pat, size_t len)
{
if(m_Pattern.length()==len && IsTheSame(m_Pattern.c_str(), pat, (int)len)) return;
m_Pattern.assign(pat, len);
for(size_t i=0; i<256; ++i) m_Table[i] = (int)len+1;
for(size_t i=0; i<len; ++i) m_Table[pat[i]] = (int)(len-i);
}
示例2: loadValue
//! Loads a string from the current node
template<class CharT, class Traits, class Alloc> inline
void loadValue( std::basic_string<CharT, Traits, Alloc> & str )
{
std::basic_istringstream<CharT, Traits> is( itsNodes.top().node->value() );
str.assign( std::istreambuf_iterator<CharT, Traits>( is ),
std::istreambuf_iterator<CharT, Traits>() );
}
示例3: GetModuleFileName
bool LibraryMgr_t::GetModuleFileName(std::basic_string<TCHAR>& sName)
{
if( ! m_hModule )
return false;
sName.assign( m_sFileNAme );
return true;
}
示例4: copy_strtrans
inline void copy_strtrans(std::basic_string<CharOut, std::char_traits<CharOut>, std::allocator<CharOut>>& out, const Char* in)
{
if (!in)
{
out.clear();
return;
}
out.assign(_begin(in), _end(in));
}
示例5: readString
size_t readString( ptr_t address,
size_t amountChars,
std::basic_string<char_t>& dest) const
{
std::vector<char_t> returnedBytes(amountChars);
rawRead(address, &returnedBytes[0], returnedBytes.size());
//Append a zero in case we didn't read the full string
returnedBytes.push_back(0);
dest.assign(&returnedBytes[0]);
return dest.length();
}
示例6: serialize
inline void serialize(SF::Archive &ar, std::basic_string<C,T,A> &t, const unsigned int)
{
if (ar.isRead())
{
C *pch = NULL;
UInt32 length = 0;
ar & SF::Archive::Flag( SF::Archive::NO_BEGIN_END ) & dynamicArray(pch, length);
t.assign(pch, length);
delete [] pch;
}
else if (ar.isWrite())
{
C *pch = const_cast<C *>(t.c_str());
UInt32 length = static_cast<UInt32>(t.length());
ar & SF::Archive::Flag( SF::Archive::NO_BEGIN_END ) & dynamicArray(pch, length);
}
}
示例7: str_formalize
void str_formalize( std::basic_string< CharType > & formattedString, int maxSize, const CharType * format, va_list vaList )
{
std::vector< CharType > strText( maxSize + 1, 0 );
try
{
if ( format )
{
size_t written = str_vprintf( strText.data(), maxSize + 1, format, vaList );
formattedString.assign( strText.data(), strText.data() + std::min( written, size_t( maxSize ) ) );
}
}
catch ( ... )
{
StringStream message;
message << ERROR_DB_FORMALIZE << formattedString.c_str();
DB_EXCEPT( EDatabaseExceptionCodes_DateTimeError, message.str() );
}
}
示例8:
inline void
assign_op( std::basic_string<CharT1>& target, basic_cstring<CharT2> src, int )
{
target.assign( src.begin(), src.size() );
}