WvStreams
wvqtstring.cc
00001 /*
00002  * Worldvisions Weaver Software:
00003  *   Copyright (C) 1997-2002 Net Integration Technologies, Inc.
00004  * 
00005  * Helper(s) to make WvString co-operate better with QString.
00006  */
00007 #include "wvstring.h"
00008 #include <qstring.h>
00009 
00010 #include <stdio.h>
00011 
00012 WvFastString::WvFastString(const QString &s)
00013 {
00014 //    fprintf(stderr, "ffqs: '%s'\n", s.latin1());
00015     
00016 #if 1
00017     link(&nullbuf, NULL);
00018     *this = WvString(s);
00019 #else
00020     // just copy the pointer - no need to allocate memory!
00021     str = (char *)s.latin1(); // I promise not to change anything!
00022     buf = NULL;
00023 #endif
00024 }
00025 
00026 
00027 WvFastString::WvFastString(const QCString &s)
00028 {
00029 //    fprintf(stderr, "ffqcs: '%s'\n", (const char *)s);
00030     
00031 #if 1
00032     link(&nullbuf, NULL);
00033     *this = WvString(s);
00034 #else
00035     // just copy the pointer - no need to allocate memory!
00036     str = (char *)(const char *)s; // I promise not to change anything!
00037     buf = NULL;
00038 #endif
00039 }
00040 
00041 
00042 WvFastString::operator QString () const
00043 {
00044     return cstr();
00045 }
00046 
00047 
00048 WvString::WvString(const QString &s)
00049 {
00050 //    fprintf(stderr, "ssqs: '%s'\n", s.latin1());
00051     
00052     link(&nullbuf, s);
00053     unique();
00054 }
00055 
00056 
00057 WvString::WvString(const QCString &s)
00058 {
00059 // fprintf(stderr, "ssqcs: '%s'\n", (const char *)s);
00060     
00061     link(&nullbuf, s);
00062     unique();
00063 }