11 #ifndef MI_BASE_STRING_H
12 #define MI_BASE_STRING_H
21 #ifdef MI_COMPILER_MSC
22 #pragma warning( push )
23 #pragma warning( disable : 4996 )
86 char* p =
reinterpret_cast<char*
>(m_allocator->
malloc( size));
88 throw std::bad_alloc();
96 void deallocate(
char* buf) { m_allocator->
free(buf); }
104 m_string(m_short_string_buffer)
106 m_short_string_buffer[0] =
'\0';
111 m_allocator( allocator),
112 m_string(m_short_string_buffer)
115 m_short_string_buffer[0] =
'\0';
124 m_length =
static_cast<Size>(MISTD::strlen(str));
126 MISTD::strcpy(m_short_string_buffer,str);
127 m_string = m_short_string_buffer;
129 m_string = allocate( m_length + 1);
130 MISTD::strcpy(m_string,str);
131 m_short_string_buffer[0] =
'\0';
135 m_string = m_short_string_buffer;
136 m_short_string_buffer[0] =
'\0';
145 m_length = str.length();
147 MISTD::strcpy(m_short_string_buffer, str.m_short_string_buffer);
148 m_string = m_short_string_buffer;
150 m_string = allocate( m_length + 1);
151 MISTD::strcpy(m_string, str.m_string);
152 m_short_string_buffer[0] =
'\0';
159 if (
this != & str) {
160 m_length = str.length();
161 if(m_string != m_short_string_buffer)
162 deallocate( m_string);
164 MISTD::strcpy(m_short_string_buffer, str.m_short_string_buffer);
165 m_string = m_short_string_buffer;
167 m_string = allocate( m_length + 1);
168 MISTD::strcpy(m_string, str.m_string);
169 m_short_string_buffer[0] =
'\0';
178 if(m_string != m_short_string_buffer)
179 deallocate( m_string);
186 return m_length ==
Size(0);
234 MISTD::strcat(m_short_string_buffer, str.m_short_string_buffer);
236 char *result = allocate( nl+1);
237 MISTD::strcpy(result, m_string);
238 MISTD::strcat(result, str.m_string);
239 if(m_string != m_short_string_buffer)
240 deallocate( m_string);
242 m_short_string_buffer[0] =
'\0';
254 return (left.length() == right.length())
255 && !MISTD::strcmp(left.c_str(),right.c_str());
263 return !(left == right);
271 return MISTD::strcmp(left.c_str(),right.c_str()) < 0;
279 return MISTD::strcmp(left.c_str(),right.c_str()) <= 0;
287 return 0 <= MISTD::strcmp(left.c_str(),right.c_str());
295 return 0 < MISTD::strcmp(left.c_str(),right.c_str());
315 #ifdef MI_COMPILER_MSC
316 #pragma warning( pop )
319 #endif // MI_BASE_STRING_H