WvStreams
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
WvStringStar Class Reference

A ridiculous class needed because UniConf::operator->() needs to return a pointer, even though that pointer is going to be dereferenced immediately anyway. More...

#include <wvstring.h>

Inheritance diagram for WvStringStar:
Inheritance graph
[legend]

Public Member Functions

 WvStringStar (WvStringParm s)
 
WvFastStringoperator-> ()
 
 WvStringStar (WvStringParm s)
 
WvFastStringoperator-> ()
 
void setsize (size_t i)
 
void setsize (size_t i)
 
WvFastString offset (size_t i) const
 Returns a copy of string pointed i bytes into this.
 
WvFastString offset (size_t i) const
 Returns a copy of string pointed i bytes into this.
 
size_t len () const
 
size_t len () const
 
bool operator== (WvStringParm s2) const
 
bool operator== (const char *s2) const
 
bool operator== (WvStringParm s2) const
 
bool operator== (const char *s2) const
 
bool operator!= (WvStringParm s2) const
 
bool operator!= (const char *s2) const
 
bool operator!= (WvStringParm s2) const
 
bool operator!= (const char *s2) const
 
bool operator< (WvStringParm s2) const
 
bool operator< (const char *s2) const
 
bool operator< (WvStringParm s2) const
 
bool operator< (const char *s2) const
 
bool operator! () const
 the not operator is 'true' if string is empty
 
bool operator! () const
 the not operator is 'true' if string is empty
 
const char * operator+ (int i) const
 
const char * operator+ (int i) const
 
const char * operator- (int i) const
 
const char * operator- (int i) const
 
 operator const char * () const
 auto-convert WvString to (const char *), when needed.
 
 operator const char * () const
 auto-convert WvString to (const char *), when needed.
 
const char * cstr () const
 return a (const char *) for this string.
 
const char * cstr () const
 return a (const char *) for this string.
 
 operator QString () const
 return a Qt library QString containing the contents of this string.
 
 operator QString () const
 return a Qt library QString containing the contents of this string.
 
int num () const
 Return a stdc++ string with the contents of this string.
 
int num () const
 Return a stdc++ string with the contents of this string.
 
bool isnull () const
 returns true if this string is null
 
bool isnull () const
 returns true if this string is null
 
const WvFastStringifnull (WvStringParm defval) const
 returns either this string, or, if isnull(), the given string.
 
const WvFastStringifnull (WvStringParm defval) const
 returns either this string, or, if isnull(), the given string.
 

Static Public Member Functions

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.
 
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.
 

Static Public Attributes

static const WvFastString null
 

Protected Member Functions

void construct (const char *_str)
 
void construct (const char *_str)
 
void link (WvStringBuf *_buf, const char *_str)
 
void link (WvStringBuf *_buf, const char *_str)
 
void unlink ()
 
void unlink ()
 
WvStringBufalloc (size_t size)
 
WvStringBufalloc (size_t size)
 
void newbuf (size_t size)
 
void newbuf (size_t size)
 

Protected Attributes

WvStringBufbuf
 
char * str
 

Static Protected Attributes

static WvStringBuf nullbuf = { 0, 1 }
 

Detailed Description

A ridiculous class needed because UniConf::operator->() needs to return a pointer, even though that pointer is going to be dereferenced immediately anyway.

We can instantiate a temporary WvStringStar, which can then return its 'this' pointer.

Definition at line 420 of file debian/libwvstreams-dev/usr/include/wvstreams/wvstring.h.

Constructor & Destructor Documentation

◆ WvStringStar() [1/2]

WvStringStar::WvStringStar ( WvStringParm  s)
inline

◆ WvStringStar() [2/2]

WvStringStar::WvStringStar ( WvStringParm  s)
inline

Definition at line 423 of file include/wvstring.h.

Member Function Documentation

◆ operator->() [1/2]

WvFastString * WvStringStar::operator-> ( )
inline

◆ operator->() [2/2]

WvFastString * WvStringStar::operator-> ( )
inline

Definition at line 425 of file include/wvstring.h.

◆ setsize()

void WvFastString::setsize ( size_t  i)
inherited

Definition at line 25 of file wvstring.cc.

◆ offset() [1/2]

WvFastString WvFastString::offset ( size_t  i) const
inherited

Returns a copy of string pointed i bytes into this.

Will not make it point past the trailing null byte.

Definition at line 79 of file wvstring.cc.

◆ offset() [2/2]

WvFastString WvFastString::offset ( size_t  i) const
inherited

Returns a copy of string pointed i bytes into this.

Will not make it point past the trailing null byte.

◆ do_format()

void WvFastString::do_format ( WvFastString output,
const char *  format,
const WvFastString *const *  argv 
)
staticinherited

when this is called, we assume output.str == NULL; it will be filled.

Accept a printf-like format specifier (but more limited) and an array of WvStrings, and render them into another WvString.

For example: WvString x[] = {"foo", "blue", 1234}; WvString ret = WvString::do_format("%s%10.2s%-10s", x);

The 'ret' string will be: "foo bl1234 " Note that only 's' is supported, though integers can be rendered automatically into WvStrings. d, f, etc are not allowed!

This function is usually called from some other function which allocates the array automatically.

$ns (n > 0) is also supported for internationalization purposes. e.g. ("%$2s is arg2, and %$1s ia arg1", arg1, arg2)

Definition at line 497 of file wvstring.cc.

References WvFastString::cstr().

Referenced by WvFastString::WvFastString().

◆ len()

size_t WvFastString::len ( ) const
inherited

Definition at line 290 of file wvstring.cc.

◆ construct()

void WvFastString::construct ( const char *  _str)
protectedinherited

Definition at line 51 of file wvstring.cc.

◆ link()

void WvFastString::link ( WvStringBuf _buf,
const char *  _str 
)
protectedinherited

Definition at line 257 of file wvstring.cc.

◆ unlink()

void WvFastString::unlink ( )
protectedinherited

Definition at line 247 of file wvstring.cc.

◆ alloc()

WvStringBuf * WvFastString::alloc ( size_t  size)
protectedinherited

Definition at line 266 of file wvstring.cc.

◆ newbuf()

void WvFastString::newbuf ( size_t  size)
protectedinherited

Definition at line 296 of file wvstring.cc.

◆ operator==() [1/2]

bool WvFastString::operator== ( WvStringParm  s2) const
inherited

Definition at line 385 of file wvstring.cc.

◆ operator==() [2/2]

bool WvFastString::operator== ( const char *  s2) const
inherited

Definition at line 406 of file wvstring.cc.

◆ operator!=() [1/2]

bool WvFastString::operator!= ( WvStringParm  s2) const
inherited

Definition at line 391 of file wvstring.cc.

◆ operator!=() [2/2]

bool WvFastString::operator!= ( const char *  s2) const
inherited

Definition at line 412 of file wvstring.cc.

◆ operator<() [1/2]

bool WvFastString::operator< ( WvStringParm  s2) const
inherited

Definition at line 397 of file wvstring.cc.

◆ operator<() [2/2]

bool WvFastString::operator< ( const char *  s2) const
inherited

Definition at line 418 of file wvstring.cc.

◆ operator!()

bool WvFastString::operator! ( ) const
inherited

the not operator is 'true' if string is empty

Definition at line 428 of file wvstring.cc.

◆ operator+() [1/2]

const char * WvFastString::operator+ ( int  i) const
inlineinherited

◆ operator+() [2/2]

const char * WvFastString::operator+ ( int  i) const
inlineinherited

Definition at line 253 of file include/wvstring.h.

◆ operator-() [1/2]

const char * WvFastString::operator- ( int  i) const
inlineinherited

◆ operator-() [2/2]

const char * WvFastString::operator- ( int  i) const
inlineinherited

Definition at line 255 of file include/wvstring.h.

◆ operator const char *() [1/2]

WvFastString::operator const char * ( ) const
inlineinherited

auto-convert WvString to (const char *), when needed.

Definition at line 259 of file debian/libwvstreams-dev/usr/include/wvstreams/wvstring.h.

◆ operator const char *() [2/2]

WvFastString::operator const char * ( ) const
inlineinherited

auto-convert WvString to (const char *), when needed.

Definition at line 259 of file include/wvstring.h.

◆ cstr() [1/2]

const char * WvFastString::cstr ( ) const
inlineinherited

return a (const char *) for this string.

The typecast operator does this automatically when needed, but sometimes (especially with varargs like in printf()) that isn't convenient enough.

Definition at line 267 of file debian/libwvstreams-dev/usr/include/wvstreams/wvstring.h.

Referenced by WvBackslashEncoder::_encode(), WvCRL::decode(), WvX509::decode(), WvFastString::do_format(), UniRetryGen::exists(), UniPStoreGen::get(), UniRegistryGen::get(), UniRetryGen::get(), WvConstStringBuffer::reset(), UniPStoreGen::set(), UniRegistryGen::set(), UniReplicateGen::set(), WvStringMask::set(), spacecat(), UniConfGen::str2int(), substr(), WvLog::uwrite(), and WvStream::write().

◆ cstr() [2/2]

const char * WvFastString::cstr ( ) const
inlineinherited

return a (const char *) for this string.

The typecast operator does this automatically when needed, but sometimes (especially with varargs like in printf()) that isn't convenient enough.

Definition at line 267 of file include/wvstring.h.

◆ operator QString() [1/2]

WvFastString::operator QString ( ) const
inherited

return a Qt library QString containing the contents of this string.

You need to link to libwvqt.so if you use this.

Definition at line 42 of file wvqtstring.cc.

◆ operator QString() [2/2]

WvFastString::operator QString ( ) const
inherited

return a Qt library QString containing the contents of this string.

You need to link to libwvqt.so if you use this.

◆ num() [1/2]

int WvFastString::num ( ) const
inlineinherited

Return a stdc++ string with the contents of this string.

To use this, #include wvstdstring.h. used to convert WvString to int, when needed. we no longer provide a typecast, because it causes annoyance.

Definition at line 286 of file debian/libwvstreams-dev/usr/include/wvstreams/wvstring.h.

Referenced by WvDBusServerAuth::authorize(), UniConfDaemonConn::execute(), WvDBusMsg::Iter::get_int(), WvIPRouteList::get_kernel(), and WvDBusMsg::Iter::get_uint().

◆ num() [2/2]

int WvFastString::num ( ) const
inlineinherited

Return a stdc++ string with the contents of this string.

To use this, #include wvstdstring.h. used to convert WvString to int, when needed. we no longer provide a typecast, because it causes annoyance.

Definition at line 286 of file include/wvstring.h.

◆ isnull() [1/2]

bool WvFastString::isnull ( ) const
inlineinherited

◆ isnull() [2/2]

bool WvFastString::isnull ( ) const
inlineinherited

returns true if this string is null

Definition at line 290 of file include/wvstring.h.

◆ ifnull() [1/2]

const WvFastString & WvFastString::ifnull ( WvStringParm  defval) const
inlineinherited

returns either this string, or, if isnull(), the given string.

Definition at line 294 of file debian/libwvstreams-dev/usr/include/wvstreams/wvstring.h.

References WvFastString::isnull().

◆ ifnull() [2/2]

const WvFastString & WvFastString::ifnull ( WvStringParm  defval) const
inlineinherited

returns either this string, or, if isnull(), the given string.

Definition at line 294 of file include/wvstring.h.

References WvFastString::isnull().

Member Data Documentation

◆ buf

WvStringBuf * WvFastString::buf
protectedinherited

◆ str

char * WvFastString::str
protectedinherited

◆ nullbuf

WvStringBuf WvFastString::nullbuf = { 0, 1 }
staticprotectedinherited

◆ null

const WvFastString WvFastString::null
staticinherited

The documentation for this class was generated from the following files: