Debian Codegraph @

src/framework/System/CString.cpp

raw symbols SCIP
1 /***************************************************************************
2 CString.cpp - description
3 -------------------
4 begin : December 29th, 2008
5 copyright : (C) 2008 by Duong Khang NGUYEN
6 email : neoneurone @ gmail com
7
8 $Id: CString.cpp 442 2010-04-24 10:52:32Z neoneurone $
9 ***************************************************************************/
10
11 /***************************************************************************
12 * *
13 * This program is free software; you can redistribute it and/or modify *
14 * it under the terms of the GNU General Public License as published by *
15 * the Free Software Foundation; either version 2 of the License, or *
16 * any later version. *
17 * *
18 ***************************************************************************/
19
20 // Framework headers
21 #include "CNullValue.h" // System::NullValue class
22 #include "CString.h"
23
24 // Standard C++ headers
25 #include <sstream> // stringstream
26
27 // Debugging
28 //#include "CConsole.h"
29
30 SPF_NAMESPACE_BEGIN(System)
31
32
33 const String String::Empty; // Default String.Empty value
34
35
36 /*=====================================================================*/
37 String::String() {}
38
39
40 String::String(const char* const& value) : msString(value) {}
41
42
43 String::String(const unsigned char* const& value) : msString((const char* const&)value) {}
44
45
46 String::String(std::string value) : msString(value) {}
47
48
49 String::~String() {}
50
51
52 /*=====================================================================*/
53 int String::GetLength() const
54 {
55 return msString.size();
56 }
57
58
59 String String::ToString() const
60 {
61 return *this;
62 }
63
64
65 /*=====================================================================*/
66 String::operator const char*() const
67 {
68 return msString.c_str();
69 }
70
71
72 String& String::operator=(const char* const value)
73 {
74 msString = value;
75 return *this;
76 }
77
78
79 String& String::operator=(const NullValue& null)
80 {
81 mbIsNull = null.IsNull();
82 return *this;
83 }
84
85
86 const String String::operator+(const char* const value) const
87 {
88 return String(msString + value);
89 }
90
91
92 const String String::operator+(const String& value) const
93 {
94 return String(msString + value.msString);
95 }
96
97
98 String& String::operator+=(const String& value)
99 {
100 msString += value.msString;
101 return *this;
102 }
103
104
105 /*=====================================================================*/
106
107 bool String::operator==(const char* const value) const
108 {
109 return (msString == value);
110 }
111
112
113 bool String::operator==(const String& value) const
114 {
115 return (msString == value.msString);
116 }
117
118
119 String& String::operator<<(const unsigned char value)
120 {
121 msString += value;
122 // System::Terminal << *this;
123 return *this;
124 }
125
126
127 String& String::operator<<(const int value)
128 {
129 std::stringstream loStream;
130 loStream << value;
131
132 msString += loStream.str();
133 return *this;
134 }
135
136
137 String& String::operator<<(const char* const value)
138 {
139 msString += value;
140 return *this;
141 }
142
143
144 /*=====================================================================*/
145 std::ostream& operator<<(std::ostream& os, const String& value)
146 {
147 return (os << value.msString);
148 }
149
150
151 SPF_NAMESPACE_END