1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
17 #ifndef NLGEORGES_STRING_EX_H
18 #define NLGEORGES_STRING_EX_H
20 #include "nel/misc/stream.h"
22 namespace NLOLDGEORGES
25 class CStringEx
: public std::basic_string
<char, std::char_traits
<char>, std::allocator
<char> >
29 CStringEx() : std::basic_string
<char, std::char_traits
<char>, std::allocator
<char> >() {}
30 CStringEx( char* _pc
) : std::basic_string
<char, std::char_traits
<char>, std::allocator
<char> >( (char *)_pc
) {}
31 CStringEx( std::string _s
) : std::basic_string
<char, std::char_traits
<char>, std::allocator
<char> >( (std::string
)_s
) {}
32 CStringEx( const char _c
, int _i
) { append( _i
, _c
); }
35 CStringEx
get_remove() const;
36 CStringEx
get_remove( const char ) const;
37 CStringEx
get_make_lower() const;
38 CStringEx
get_make_upper() const;
39 CStringEx
get_trim_left() const;
40 CStringEx
get_trim_left( const char _c
) const;
41 CStringEx
get_trim_right() const;
42 CStringEx
get_trim_right( const char _c
) const;
43 CStringEx
get_trim() const;
44 CStringEx
get_trim( const char _c
) const;
45 CStringEx
get_mid( const int nFirst
, const int nCount
) const;
46 CStringEx
get_mid( const int nFirst
) const;
47 CStringEx
get_left( const int nCount
) const;
48 CStringEx
get_right( const int nCount
) const;
49 CStringEx
get_purge() const;
52 void remove( const char _c
);
56 void trim_left( const char _c
);
58 void trim_right( const char _c
);
60 void trim( const char _c
);
61 void mid( const int nFirst
, const int nCount
);
62 void mid( const int nFirst
);
63 void left( const int nCount
);
64 void right( const int nCount
);
67 void format( const char*, ... );
68 std::string::size_type
reverse_find( const char _c
) const;
70 void serial( NLMISC::IStream
& s
) { s
.serial( (std::string
&)(*this) );}
72 bool operator <= ( const CStringEx
& s
) const;
73 bool operator < ( const CStringEx
& s
) const;
78 #endif // NLGEORGES_STRING_EX_H