MCPcopy Create free account
hub / github.com/CobaltFusion/DebugViewPP / basic_stringbuilder

Class basic_stringbuilder

include/CobaltFusion/stringbuilder.h:17–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15
16template <class CharType, class Traits = std::char_traits<CharType>, class Allocator = std::allocator<CharType>>
17class basic_stringbuilder
18{
19public:
20 typedef std::basic_string<CharType, Traits, Allocator> string_type;
21
22 template <typename T>
23 basic_stringbuilder& operator<<(const T& t)
24 {
25 m_ss << t;
26 return *this;
27 }
28
29 basic_stringbuilder& operator<<(const std::wstring& str)
30 {
31 m_ss << Str(str).str().c_str();
32 return *this;
33 }
34
35 basic_stringbuilder& operator<<(const std::string& str)
36 {
37 m_ss << str.c_str();
38 return *this;
39 }
40
41 string_type str() const
42 {
43 return m_ss.str();
44 }
45
46 const CharType* c_str() const
47 {
48 return m_ss.str().c_str();
49 }
50
51 operator string_type() const
52 {
53 return m_ss.str();
54 }
55
56private:
57 std::basic_ostringstream<CharType, Traits, Allocator> m_ss;
58};
59
60typedef basic_stringbuilder<char> stringbuilder;
61typedef basic_stringbuilder<wchar_t> wstringbuilder;

Callers

nothing calls this directly

Calls 3

StrClass · 0.85
c_strMethod · 0.45
strMethod · 0.45

Tested by

no test coverage detected