WvStreams
wvqtstring.cc
1 /*
2  * Worldvisions Weaver Software:
3  * Copyright (C) 1997-2002 Net Integration Technologies, Inc.
4  *
5  * Helper(s) to make WvString co-operate better with QString.
6  */
7 #include "wvstring.h"
8 #include <qstring.h>
9 
10 #include <stdio.h>
11 
12 WvFastString::WvFastString(const QString &s)
13 {
14 // fprintf(stderr, "ffqs: '%s'\n", s.latin1());
15 
16 #if 1
17  link(&nullbuf, NULL);
18  *this = WvString(s);
19 #else
20  // just copy the pointer - no need to allocate memory!
21  str = (char *)s.latin1(); // I promise not to change anything!
22  buf = NULL;
23 #endif
24 }
25 
26 
27 WvFastString::WvFastString(const QCString &s)
28 {
29 // fprintf(stderr, "ffqcs: '%s'\n", (const char *)s);
30 
31 #if 1
32  link(&nullbuf, NULL);
33  *this = WvString(s);
34 #else
35  // just copy the pointer - no need to allocate memory!
36  str = (char *)(const char *)s; // I promise not to change anything!
37  buf = NULL;
38 #endif
39 }
40 
41 
42 WvFastString::operator QString () const
43 {
44  return cstr();
45 }
46 
47 
48 WvString::WvString(const QString &s)
49 {
50 // fprintf(stderr, "ssqs: '%s'\n", s.latin1());
51 
52  link(&nullbuf, s);
53  unique();
54 }
55 
56 
57 WvString::WvString(const QCString &s)
58 {
59 // fprintf(stderr, "ssqcs: '%s'\n", (const char *)s);
60 
61  link(&nullbuf, s);
62  unique();
63 }
WvString
WvString is an implementation of a simple and efficient printable-string class.
Definition: wvstring.h:329
WvString::unique
WvString & unique()
make the buf and str pointers owned only by this WvString.
Definition: wvstring.cc:306
WvFastString::WvFastString
WvFastString()
Create an empty, NULL string.
Definition: wvstring.cc:33