OODuck  0.5
C Oriented Object framework with duck-typing support
String Class Reference

String utility class. More...

Inheritance diagram for String:
Object

Public Member Functions

void * __constructor__ (void *self, char *data)
 Build new string from data. More...
 
void * copy (const void *self)
 Copy string in a new String object. More...
 
void format (void *self, const char *fmt,...)
 Format String content. More...
 
size_t len (const void *self)
 Get String length. More...
 
const char * cstr (const void *self)
 Get String content. More...
 
- Public Member Functions inherited from Object
void * ref (void *self)
 Increment object's reference counter. More...
 
void unref (void *self)
 Decrement object's reference counter, if equals 0, delete the object. More...
 
bool equal (const void *self, const void *other)
 Check objects equality. More...
 

Detailed Description

String utility class.

Member Function Documentation

void * __constructor__ ( void *  self,
char *  data 
)

Build new string from data.

Parameters
selfString instance.
dataString content or NULL.
Returns
Initialized instance.
void * copy ( const void *  self)

Copy string in a new String object.

Parameters
selfString object to copy.
Returns
New String object.
const char * cstr ( const void *  self)

Get String content.

Parameters
selfString object.
Returns
Pointer to String content.
void format ( void *  self,
const char *  fmt,
  ... 
)

Format String content.

Parameters
selfString object.
fmtFormat string.
...Argument list used to format string.

Uses vasprintf().

size_t len ( const void *  self)

Get String length.

Parameters
selfString object.
Returns
String length.