Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

autostr Class Reference

Just another "string" class. It has been written when the world was young enough. More...

#include <dsutil.h>

List of all members.

Public Methods

 autostr ()
 autostr (const char *src)
 autostr (char *src, int size)
 autostr (int size)
 ~autostr ()
char * sprintf (char *format,...)
char & operator[] (int i)
autostr & operator+ (char *ns)
autostr & operator+ (autostr &as)
autostr & operator= (char *src)
autostr & dup (char *src)
int size ()
void ncpy (char *src, int n)
char * c_str ()
 operator char * ()
 operator int ()
int operator== (char *ns)
int operator!= (char *ns)


Detailed Description

The main purpose of this class is create auto destried dynamic string,
See also:
std::AutoPtr
I don't try overgo GNU Strings but ...


Constructor & Destructor Documentation

autostr::autostr (    )  [inline]
 

Create empty autostr object

autostr::autostr (  const char *    src ) 
 

Create autostr object and copy src inside

Exceptions:
AutoStrException 

autostr::autostr (  char *    src,
int    size
) 
 

Create autostr object and copy substring of src of length size inside

Exceptions:
AutoStrException 

autostr::autostr (  int    size ) 
 

Create autostr object and allocate size bytes

Exceptions:
AutoStrException 

autostr::~autostr (    )  [inline]
 


Member Function Documentation

char* autostr::c_str (    )  [inline]
 

return pointer to str

autostr& autostr::dup (  char *    src )  [inline]
 

create another autostr object pointer to the same data

void autostr::ncpy (  char *    src,
int    n
) 
 

copy substring of src of length n inside

autostr::operator char * (    )  [inline]
 

autostr::operator int (    )  [inline]
 

return length of string, not size of object

int autostr::operator!= (  char *    ns )  [inline]
 

autostr& autostr::operator+ (  autostr &    as ) 
 

autostr & autostr::operator+ (  char *    ns ) 
 

append struing ns. Internal string copyed to new location. Very expensive operation.

autostr & autostr::operator= (  char *    src ) 
 

compare two autostr like strcmp(2)

int autostr::operator== (  char *    ns )  [inline]
 

do strcmp

char & autostr::operator[] (  int    i ) 
 

return i-th character from start if i > 0 and i-th character from and if i < 0

Exceptions:
AutoStrException 

int autostr::size (    )  [inline]
 

return size

char * autostr::sprintf (  char *    format,
...   
) 
 

see sprintf(2). Size of result not checked.


The documentation for this class was generated from the following files:
Generated on Mon May 16 18:26:59 2005 for libdms4 by doxygen1.3-rc2