MCPcopy Create free account
hub / github.com/boostorg/filesystem / basic_custom_string

Class basic_custom_string

test/path_test.cpp:178–222  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

176
177template< typename String >
178class basic_custom_string
179{
180public:
181 typedef String string_type;
182 typedef typename string_type::size_type size_type;
183 typedef typename string_type::difference_type difference_type;
184 typedef typename string_type::value_type value_type;
185 typedef typename string_type::reference reference;
186 typedef typename string_type::const_reference const_reference;
187 typedef typename string_type::pointer pointer;
188 typedef typename string_type::const_pointer const_pointer;
189 typedef typename string_type::iterator iterator;
190 typedef typename string_type::const_iterator const_iterator;
191
192private:
193 string_type m_str;
194
195public:
196 basic_custom_string() {}
197 explicit basic_custom_string(const_pointer str) : m_str(str) {}
198 explicit basic_custom_string(string_type const& str) : m_str(str) {}
199 template< typename OtherChar >
200 explicit basic_custom_string(const OtherChar* str)
201 {
202 // Do a simple character code conversion; only valid for ASCII characters
203 while (*str != static_cast< OtherChar >(0))
204 {
205 m_str.push_back(static_cast< value_type >(*str));
206 ++str;
207 }
208 }
209
210 bool empty() const { return m_str.empty(); }
211 size_type size() const { return m_str.size(); }
212
213 const_pointer data() const { return m_str.data(); }
214 const_pointer c_str() const { return m_str.c_str(); }
215
216 iterator begin() { return m_str.begin(); }
217 const_iterator begin() const { return m_str.begin(); }
218 iterator end() { return m_str.end(); }
219 const_iterator end() const { return m_str.end(); }
220
221 operator string_type() const { return m_str; }
222};
223
224typedef basic_custom_string< std::string > custom_string;
225typedef basic_custom_string< std::wstring > wcustom_string;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected