Public Member Functions | Static Public Member Functions | List of all members
QCString::LSData Struct Reference
Inheritance diagram for QCString::LSData:
QCString::LSHeader

Public Member Functions

char * toStr ()
 
void dispose ()
 

Static Public Member Functions

static LSDatacreate (int size)
 
static LSDataresize (LSData *d, int size)
 

Additional Inherited Members

- Public Attributes inherited from QCString::LSHeader
int len
 
int refCount
 

Detailed Description

Definition at line 367 of file qcstring.h.

Member Function Documentation

static LSData* QCString::LSData::create ( int  size)
inlinestatic

Definition at line 376 of file qcstring.h.

377  {
378  LSData *data;
379  data = (LSData*)malloc(sizeof(LSHeader)+size);
380  data->len = size-1;
381  data->refCount = 0;
382  data->toStr()[size-1] = 0;
383  return data;
384  }
uint size() const
Definition: qcstring.h:201
const char * data() const
Definition: qcstring.h:207
void QCString::LSData::dispose ( )
inline

Definition at line 386 of file qcstring.h.

387  {
388  if (--refCount<0) free(this);
389  }
static LSData* QCString::LSData::resize ( LSData d,
int  size 
)
inlinestatic

Definition at line 393 of file qcstring.h.

394  {
395  if (d->len>0 && d->refCount==0) // non-const, non-empty
396  {
397  d = (LSData*)realloc(d,sizeof(LSHeader)+size);
398  d->len = size-1;
399  d->toStr()[size-1] = 0;
400  return d;
401  }
402  else // need to make a copy
403  {
404  LSData *newData = LSData::create(size);
405  int len = d->len;
406  if (len>=size) len=size-1;
407  memcpy(newData->toStr(),d->toStr(),len);
408  newData->toStr()[len]=0;
409  d->dispose();
410  return newData;
411  }
412  }
uint size() const
Definition: qcstring.h:201
static LSData * create(int size)
Definition: qcstring.h:376
char* QCString::LSData::toStr ( )
inline

Definition at line 369 of file qcstring.h.

370  {
371  return (char*)(this+1); // string data starts after the header
372  }

The documentation for this struct was generated from the following file: