Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef ACE_SSTRING_H
00014 #define ACE_SSTRING_H
00015 #include "ace/pre.h"
00016
00017 #include "ace/SStringfwd.h"
00018
00019 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00020 # pragma once
00021 #endif
00022
00023 #include "ace/String_Base.h"
00024
00025 #if !defined (ACE_DEFAULT_GROWSIZE)
00026 #define ACE_DEFAULT_GROWSIZE 32
00027 #endif
00028
00029 #if !defined (ACE_LACKS_IOSTREAM_TOTALLY)
00030 #include "ace/iosfwd.h"
00031 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00032 ACE_Export ACE_OSTREAM_TYPE &operator << (ACE_OSTREAM_TYPE &, const ACE_CString &);
00033 ACE_Export ACE_OSTREAM_TYPE &operator << (ACE_OSTREAM_TYPE &, const ACE_WString &);
00034 ACE_END_VERSIONED_NAMESPACE_DECL
00035 #endif
00036
00037 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00038
00039 #if defined ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT
00040 template class ACE_Export ACE_String_Base<char>;
00041 template class ACE_Export ACE_String_Base<ACE_WSTRING_TYPE>;
00042
00043 template class ACE_Export ACE_String_Base_Iterator<char>;
00044 template class ACE_Export ACE_String_Base_Iterator<ACE_WSTRING_TYPE>;
00045
00046 template class ACE_Export ACE_String_Base_Const_Iterator<char>;
00047 template class ACE_Export ACE_String_Base_Const_Iterator<ACE_WSTRING_TYPE>;
00048 #endif
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058 class ACE_Export ACE_NS_WString : public ACE_WString
00059 {
00060 public:
00061
00062 using ACE_WString::size_type;
00063
00064
00065 ACE_NS_WString (ACE_Allocator *alloc = 0);
00066
00067
00068 ACE_NS_WString (const char *s,
00069 ACE_Allocator *alloc = 0);
00070
00071
00072 ACE_NS_WString (const ACE_WSTRING_TYPE *s,
00073 ACE_Allocator *alloc = 0);
00074
00075 #if defined (ACE_WSTRING_HAS_USHORT_SUPPORT)
00076
00077
00078 ACE_NS_WString (const ACE_USHORT16 *s,
00079 size_type len,
00080 ACE_Allocator *alloc = 0);
00081 #endif
00082
00083
00084
00085 ACE_NS_WString (const ACE_WSTRING_TYPE *s,
00086 size_type len,
00087 ACE_Allocator *alloc = 0);
00088
00089
00090
00091 ACE_NS_WString (size_type len, ACE_Allocator *alloc = 0);
00092
00093
00094 ACE_NS_WString (const ACE_NS_WString &s);
00095
00096
00097 ACE_NS_WString (ACE_WSTRING_TYPE c, ACE_Allocator *alloc = 0);
00098
00099
00100
00101 char *char_rep (void) const;
00102
00103
00104
00105 ACE_USHORT16 *ushort_rep (void) const;
00106 };
00107
00108 ACE_Export
00109 ACE_NS_WString operator + (const ACE_NS_WString &,
00110 const ACE_NS_WString &);
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133 class ACE_Export ACE_SString
00134 {
00135 public:
00136
00137 typedef ACE_Allocator::size_type size_type;
00138
00139
00140 static const size_type npos;
00141
00142
00143 ACE_SString (ACE_Allocator *alloc = 0);
00144
00145
00146 ACE_SString (const char *s, ACE_Allocator *alloc = 0);
00147
00148
00149
00150 ACE_SString (const char *s, size_type len, ACE_Allocator *alloc = 0);
00151
00152
00153 ACE_SString (const ACE_SString &);
00154
00155
00156 ACE_SString (char c, ACE_Allocator *alloc = 0);
00157
00158
00159 ~ACE_SString (void);
00160
00161
00162
00163 char operator [] (size_type slot) const;
00164
00165
00166
00167 char &operator [] (size_type slot);
00168
00169
00170 ACE_SString &operator = (const ACE_SString &);
00171
00172
00173
00174
00175
00176
00177 ACE_SString substring (size_type offset, size_type length = npos) const;
00178
00179
00180 ACE_SString substr (size_type offset, size_type length = npos) const;
00181
00182
00183 u_long hash (void) const;
00184
00185
00186 size_type length (void) const;
00187
00188
00189
00190 void rep (char *s);
00191
00192
00193 const char *rep (void) const;
00194
00195
00196 const char *fast_rep (void) const;
00197
00198
00199 const char *c_str (void) const;
00200
00201
00202
00203 size_type strstr (const ACE_SString &s) const;
00204
00205
00206
00207 size_type find (const ACE_SString &str, size_type pos = 0) const;
00208
00209
00210
00211 size_type find (const char *s, size_type pos = 0) const;
00212
00213
00214
00215 size_type find (char c, size_type pos = 0) const;
00216
00217
00218
00219 size_type rfind (char c, size_type pos = npos) const;
00220
00221
00222 bool operator == (const ACE_SString &s) const;
00223
00224
00225 bool operator < (const ACE_SString &s) const;
00226
00227
00228 bool operator > (const ACE_SString &s) const;
00229
00230
00231 bool operator != (const ACE_SString &s) const;
00232
00233
00234 int compare (const ACE_SString &s) const;
00235
00236
00237 void dump (void) const;
00238
00239
00240 ACE_ALLOC_HOOK_DECLARE;
00241
00242 private:
00243
00244 ACE_Allocator *allocator_;
00245
00246
00247 size_type len_;
00248
00249
00250 char *rep_;
00251 };
00252
00253 #if !defined (ACE_LACKS_IOSTREAM_TOTALLY)
00254 ACE_Export ACE_OSTREAM_TYPE &operator << (ACE_OSTREAM_TYPE &, const ACE_SString &);
00255 #endif
00256
00257
00258
00259 #if defined (ACE_USES_WCHAR)
00260 typedef ACE_WString ACE_TString;
00261 #else
00262 typedef ACE_CString ACE_TString;
00263 #endif
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277
00278 class ACE_Export ACE_Auto_String_Free
00279 {
00280 public:
00281 explicit ACE_Auto_String_Free (char* p = 0);
00282 ACE_Auto_String_Free (ACE_Auto_String_Free &rhs);
00283 ACE_Auto_String_Free& operator= (ACE_Auto_String_Free &rhs);
00284 ~ACE_Auto_String_Free (void);
00285
00286 char* operator* () const;
00287 char operator[] (size_t i) const;
00288 char* get (void) const;
00289 char* release (void);
00290 void reset (char* p = 0);
00291
00292 private:
00293 char* p_;
00294 };
00295
00296 ACE_END_VERSIONED_NAMESPACE_DECL
00297
00298 #if defined (__ACE_INLINE__)
00299 #include "ace/SString.inl"
00300 #endif
00301
00302 #include "ace/post.h"
00303 #endif