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); }
//! 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>() ); }
bool LibraryMgr_t::GetModuleFileName(std::basic_string<TCHAR>& sName) { if( ! m_hModule ) return false; sName.assign( m_sFileNAme ); return true; }
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)); }
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(); }
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); } }
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() ); } }
inline void assign_op( std::basic_string<CharT1>& target, basic_cstring<CharT2> src, int ) { target.assign( src.begin(), src.size() ); }