00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef COIN_SBSTRING_H
00021 #define COIN_SBSTRING_H
00022
00023 #include <Inventor/system/inttypes.h>
00024 #include <Inventor/SbBasic.h>
00025
00026 #include <stdio.h>
00027 #include <stdarg.h>
00028
00029 #define SB_STRING_STATIC_STORAGE_SIZE 128
00030
00031
00032 class COIN_DLL_API SbString {
00033 public:
00034 SbString(void);
00035 SbString(const char * str);
00036 SbString(const char * str, int start, int end);
00037 SbString(const SbString & str);
00038 SbString(const int digits);
00039 ~SbString();
00040
00041 uint32_t hash(void);
00042 int getLength(void) const;
00043 void makeEmpty(SbBool freeold = TRUE);
00044 const char * getString(void) const;
00045 SbString getSubString(int startidx, int endidx = -1) const;
00046 void deleteSubString(int startidx, int endidx = -1);
00047
00048 void addIntString(const int value);
00049
00050 char operator [](int index) const;
00051 SbString & operator = (const char * str);
00052 SbString & operator = (const SbString & str);
00053 SbString & operator += (const char * str);
00054 SbString & operator += (const SbString & str);
00055 int operator ! (void) const;
00056 friend COIN_DLL_API int operator == (const SbString & str, const char * s);
00057 friend COIN_DLL_API int operator == (const char * s, const SbString & str);
00058 friend COIN_DLL_API int operator == (const SbString & str1, const SbString & str2);
00059 friend COIN_DLL_API int operator != (const SbString & str, const char * s);
00060 friend COIN_DLL_API int operator != (const char * s, const SbString & str);
00061 friend COIN_DLL_API int operator != (const SbString & str1, const SbString & str2);
00062 static uint32_t hash(const char * s);
00063
00064 SbString & operator += (const char c);
00065 SbString & sprintf(const char * formatstr, ...);
00066 SbString & vsprintf(const char * formatstr, va_list args);
00067
00068 void print(FILE * file = stdout) const;
00069
00070 private:
00071 char * sstring;
00072 int storagesize;
00073 char staticstorage[SB_STRING_STATIC_STORAGE_SIZE];
00074 void expand(int additional);
00075 };
00076
00077 COIN_DLL_API int operator == (const SbString & str, const char * s);
00078 COIN_DLL_API int operator == (const char * s, const SbString & str);
00079 COIN_DLL_API int operator == (const SbString & str1, const SbString & str2);
00080 COIN_DLL_API int operator != (const SbString & str, const char * s);
00081 COIN_DLL_API int operator != (const char * s, const SbString & str);
00082 COIN_DLL_API int operator != (const SbString & str1, const SbString & str2);
00083
00084 #ifndef COIN_INTERNAL
00085
00086 #include <Inventor/SbName.h>
00087 #endif // !COIN_INTERNAL
00088
00089 #endif // !COIN_SBSTRING_H