00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039 #ifndef _OSGIDSTRING_H_
00040 #define _OSGIDSTRING_H_
00041 #ifdef __sgi
00042 #pragma once
00043 #endif
00044
00045 #include <OSGConfig.h>
00046 #include <OSGBase.h>
00047 #include <OSGBaseTypes.h>
00048 #include <string.h>
00049 #include <vector>
00050 #include <iostream>
00051
00052 OSG_BEGIN_NAMESPACE
00053
00054 class IDString;
00055
00056 OSG_BASE_DLLMAPPING std::ostream &operator <<( std::ostream &os,
00057 const IDString &obj);
00058
00062 class OSG_BASE_DLLMAPPING IDString
00063 {
00064
00065
00066 public:
00067
00068 enum MemType
00069 {
00070 COPY,
00071 LINK
00072 };
00073
00074 typedef std::vector<IDString > StringVec;
00075 typedef std::vector<IDString *> StringPVec;
00076
00077
00081 explicit IDString( UInt32 size = 0 );
00082
00083 explicit IDString(const Char8 *str,
00084 MemType memType = COPY);
00085 IDString(const IDString &obj,
00086 MemType memType = COPY);
00087
00089
00093 virtual ~IDString(void);
00094
00096
00100 const Char8 *str ( void ) const;
00101
00102 bool isEmpty ( void ) const;
00103
00104
00105 void set (const Char8 *str,
00106 MemType memType = COPY);
00107
00108 void toUpper ( void );
00109 void toLower ( void );
00110
00111 UInt32 getLength( void ) const;
00112 void setLength( UInt32 length );
00113
00114 void tokenize ( StringVec &v );
00115 void tokenize ( StringPVec &v );
00116
00118
00122 const IDString & operator =(const IDString &obj);
00123
00125
00129 bool operator ==(const IDString &obj) const;
00130 bool operator !=(const IDString &obj) const;
00131
00132 bool operator < (const IDString &obj) const;
00133 bool operator > (const IDString &obj) const;
00134
00135 bool operator >=(const IDString &obj) const;
00136 bool operator <=(const IDString &obj) const;
00137
00139
00140
00141 protected:
00142
00143
00144
00145 Char8 *_str;
00146 MemType _memType;
00147
00148 private:
00149
00150 friend OSG_BASE_DLLMAPPING
00151 std::ostream &operator <<( std::ostream &os,
00152 const IDString &obj);
00153
00154 };
00155
00156 OSG_END_NAMESPACE
00157
00158 #include <OSGIDString.inl>
00159 #include <OSGIDStringLink.h>
00160
00161 #endif
00162
00163
00164