/* * Copyright (c) 2003, Sergey Zorin. All rights reserved. * * This software is distributable under the BSD license. See the terms of the * BSD license in the LICENSE file provided with this software. * */ #ifndef __string_h__ #define __string_h__ #include #include #include #include class STRING; inline STRING operator+( const STRING& s1, const STRING& s2); class STRING { public: static const int begin = 0; static const int end = -1; public: STRING(const STRING& s) { _str = new TCHAR[s.length()+1]; lstrcpy(_str, s); } STRING(const TCHAR* str = TEXT("")) { _str = new TCHAR[lstrlen(str)+1]; lstrcpy(_str, str); } ~STRING() { delete[] _str; } void resize( size_t newLength ) { size_t oldLength = length(); if ( newLength < oldLength ) { _str[newLength] = 0; // Just truncate the string } else if( newLength>oldLength) { TCHAR* p = new TCHAR[ newLength + 1 ]; lstrcpy(p, _str); for( size_t i=oldLength; i