00001 // +-------------------------------------------------------------------------+ 00002 // | I__n__t__e__L__i__b 0.6.10 development | 00003 // | Copyright (c) Andrey Vikt. Stolyarov <crocodil_AT_croco.net> 2000-2007. | 00004 // | | 00005 // | This is free software. The library part is available under | 00006 // | GNU LESSER GENERAL PUBLIC LICENSE v.2.1. | 00007 // | GNU LGPL v2.1 is found in docs/gnu_gpl2.txt, or at http://www.gnu.org | 00008 // | Please see also docs/readme.txt and visit http://www.intelib.org | 00009 // | | 00010 // | !!! THERE IS NO WARRANTY OF ANY KIND, NEITHER EXPRESSED NOR IMPLIED !!! | 00011 // +-------------------------------------------------------------------------+ 00012 00013 00014 00015 00025 #ifndef INTELIB_SSTRING_HPP_SENTRY 00026 #define INTELIB_SSTRING_HPP_SENTRY 00027 00028 #include "sexpress.hpp" 00029 #include "gensref.hpp" 00030 00031 00033 typedef GenericSReference<SExpressionString, IntelibX_not_a_string> 00034 SStringRef; 00035 00037 00045 class SString : public SStringRef { 00046 public: 00048 SString() : SStringRef(new SExpressionString("")) {} 00050 SString(const char *s) : SStringRef(new SExpressionString(s)) {} 00052 SString(SExpressionString *ts) : SStringRef(ts) {} 00054 SString(const SString &other) : SStringRef(other) {} 00056 SString(const SReference &other) : SStringRef(other) {} 00058 ~SString() {} 00059 00061 SString& operator =(const char *s); 00062 00064 SString operator+(const SString &other) const; 00066 void operator+=(const SString &other); 00068 SString operator+(const char *s) const; 00070 void operator+=(const char *s); 00072 void operator+=(char c); 00074 const char *c_str() const; 00076 00077 char operator[](int index) const { return c_str()[index]; } 00079 unsigned int length() const; 00081 unsigned int Length() const { return length(); } 00082 00084 bool operator==(const SString& other) const; 00086 bool operator!=(const SString& other) const; 00087 }; 00088 00089 00090 #endif