25 #define WVSTRING_EXTRA 1
28 #define __WVS_F(n) WvStringParm __wvs_##n
29 #define __WVS_FORM(n) WvStringParm __wvs_##n = WvFastString::null
30 #define WVSTRING_FORMAT_DECL WvStringParm __wvs_format, \
31 WvStringParm __wvs_a0, \
32 __WVS_FORM( a1), __WVS_FORM( a2), __WVS_FORM( a3), \
33 __WVS_FORM( a4), __WVS_FORM( a5), __WVS_FORM( a6), \
34 __WVS_FORM( a7), __WVS_FORM( a8), __WVS_FORM( a9), \
35 __WVS_FORM(a10), __WVS_FORM(a11), __WVS_FORM(a12), \
36 __WVS_FORM(a13), __WVS_FORM(a14), __WVS_FORM(a15), \
37 __WVS_FORM(a16), __WVS_FORM(a17), __WVS_FORM(a18), \
39 #define WVSTRING_FORMAT_DEFN WvStringParm __wvs_format, \
40 WvStringParm __wvs_a0, \
41 __WVS_F( a1), __WVS_F( a2), __WVS_F( a3), \
42 __WVS_F( a4), __WVS_F( a5), __WVS_F( a6), \
43 __WVS_F( a7), __WVS_F( a8), __WVS_F( a9), \
44 __WVS_F(a10), __WVS_F(a11), __WVS_F(a12), \
45 __WVS_F(a13), __WVS_F(a14), __WVS_F(a15), \
46 __WVS_F(a16), __WVS_F(a17), __WVS_F(a18), \
48 #define WVSTRING_FORMAT_CALL __wvs_format, __wvs_a0, \
49 __wvs_a1, __wvs_a2, __wvs_a3, __wvs_a4, __wvs_a5, \
50 __wvs_a6, __wvs_a7, __wvs_a8, __wvs_a9, __wvs_a10, \
51 __wvs_a11, __wvs_a12, __wvs_a13, __wvs_a14, __wvs_a15, \
52 __wvs_a16, __wvs_a17, __wvs_a18, __wvs_a19
77 #define WVSTRINGBUF_SIZE(s) (s->data - (char *)s)
115 void setsize(
size_t i);
192 x[ 0] = (&__wvs_a0 != &
null)? &__wvs_a0 : 0;
193 x[ 1] = (&__wvs_a1 != &
null)? &__wvs_a1 : 0;
194 x[ 2] = (&__wvs_a2 != &
null)? &__wvs_a2 : 0;
195 x[ 3] = (&__wvs_a3 != &
null)? &__wvs_a3 : 0;
196 x[ 4] = (&__wvs_a4 != &
null)? &__wvs_a4 : 0;
197 x[ 5] = (&__wvs_a5 != &
null)? &__wvs_a5 : 0;
198 x[ 6] = (&__wvs_a6 != &
null)? &__wvs_a6 : 0;
199 x[ 7] = (&__wvs_a7 != &
null)? &__wvs_a7 : 0;
200 x[ 8] = (&__wvs_a8 != &
null)? &__wvs_a8 : 0;
201 x[ 9] = (&__wvs_a9 != &
null)? &__wvs_a9 : 0;
202 x[10] = (&__wvs_a10 != &
null)? &__wvs_a10 : 0;
203 x[11] = (&__wvs_a11 != &
null)? &__wvs_a11 : 0;
204 x[12] = (&__wvs_a12 != &
null)? &__wvs_a12 : 0;
205 x[13] = (&__wvs_a13 != &
null)? &__wvs_a13 : 0;
206 x[14] = (&__wvs_a14 != &
null)? &__wvs_a14 : 0;
207 x[15] = (&__wvs_a15 != &
null)? &__wvs_a15 : 0;
208 x[16] = (&__wvs_a16 != &
null)? &__wvs_a16 : 0;
209 x[17] = (&__wvs_a17 != &
null)? &__wvs_a17 : 0;
210 x[18] = (&__wvs_a18 != &
null)? &__wvs_a18 : 0;
211 x[19] = (&__wvs_a19 != &
null)? &__wvs_a19 : 0;
213 link(&nullbuf, NULL);
225 void construct(
const char *_str);
238 void newbuf(
size_t size);
242 bool operator== (WvStringParm s2)
const;
243 bool operator!= (WvStringParm s2)
const;
244 bool operator< (WvStringParm s2)
const;
245 bool operator== (
const char *s2)
const;
246 bool operator!= (
const char *s2)
const;
247 bool operator< (
const char *s2)
const;
253 const char *operator+ (
int i)
const
255 const char *operator- (
int i)
const
259 operator const char*()
const
274 operator QString()
const;
287 {
return str ? atoi(str) : 0; }
291 {
return str == NULL; }
295 {
return isnull() ? defval : *
this; }
353 { copy_constructor(s); }
355 { copy_constructor(s); }
376 inline WvString(
const std::string &s);
382 WvString &append(WVSTRING_FORMAT_DECL)
383 {
return append(
WvString(WVSTRING_FORMAT_CALL)); }
387 WvString &operator= (
const char *s2)
402 inline void construct(
const char *_str)
404 link(&nullbuf, _str);
430 inline bool operator== (
const char *s1, WvStringParm s2)
436 inline bool operator!= (
const char *s1, WvStringParm s2)
441 #endif // __WVSTRING_H
char * edit()
make the string editable, and return a non-const (char*)
bool operator!() const
the not operator is 'true' if string is empty
WvFastString offset(size_t i) const
Returns a copy of string pointed i bytes into this.
WvString is an implementation of a simple and efficient printable-string class.
bool isnull() const
returns true if this string is null
const char * cstr() const
return a (const char *) for this string.
bool is_unique() const
returns true if this string is already unique()
A ridiculous class needed because UniConf::operator->() needs to return a pointer,...
WvString & unique()
make the buf and str pointers owned only by this WvString.
const WvFastString & ifnull(WvStringParm defval) const
returns either this string, or, if isnull(), the given string.
WvString(const WvString &s)
Magic copy constructor for "fast" char* strings.
static void do_format(WvFastString &output, const char *format, const WvFastString *const *a)
when this is called, we assume output.str == NULL; it will be filled.
WvFastString(WVSTRING_FORMAT_DECL)
Now, you're probably thinking to yourself: Boy, does this ever look ridiculous.
WvFastString()
Create an empty, NULL string.
A WvFastString acts exactly like a WvString, but can take (const char *) strings without needing to a...
int num() const
Return a stdc++ string with the contents of this string.