00001 /* 00002 Gel2D Game Engine - Cross-platform 2D gaming middleware 00003 Copyright (C) 2011 Mark D. Procarione 00004 00005 Gel2D is free software: you can redistribute it and/or modify 00006 it under the terms of the GNU General Public License as published by 00007 the Free Software Foundation, either version 3 of the License, or 00008 (at your option) any later version. 00009 00010 Gel2D is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 GNU General Public License for more details. 00014 */ 00015 00016 #ifndef __GELCSTRING_H__ 00017 #define __GELCSTRING_H__ 00018 00019 #include "gelNamespace.h" 00020 #include <cstring> 00021 00022 namespace gel 00023 { 00025 00027 class GelCString 00028 { 00029 public: 00031 GelCString(); 00032 00034 GelCString( const GelCString &cstring ); 00035 00037 00038 GelCString( const char *str ); 00039 00041 ~GelCString() { delete[] data; } 00042 00043 void append( const char *str ); 00044 void append( const char ch ); 00045 00047 00048 int getLength() const { return len; } 00049 00051 00052 void resize( int size ); 00053 00055 char *getData() { return data; } 00056 00058 const char *getData() const { return data; } 00059 00060 GelCString &operator=( const GelCString &s ); 00061 GelCString &operator=( const char *s ); 00062 GelCString &operator+=( const char *s ) { append(s); return *this; } 00063 GelCString &operator+=( const char c ) { append(c); return *this; } 00064 00065 char &operator[]( int i ) { return data[i]; } 00066 const char &operator[]( int i ) const { return data[i]; } 00067 00068 operator const char *() const { return data; } 00069 00070 private: 00071 char *data; 00072 int len; 00073 int alloc; 00074 }; 00075 } 00076 00077 #endif // __GELCSTRING_H__
API Documentation by Mark D. Procarione | Generated by |