Version: 8.3.0
YACS::ENGINE::StringOnHeap Class Reference

#include <Any.hxx>

Collaboration diagram for YACS::ENGINE::StringOnHeap:

Private Member Functions

 StringOnHeap (const char *val)
 
 StringOnHeap (const std::string &val)
 
 StringOnHeap (char *val, Deallocator deAlloc)
 
bool operator== (const StringOnHeap &other) const
 
StringOnHeapdeepCopy () const
 
const char * cStr () const
 
 ~StringOnHeap ()
 

Private Attributes

char * _str
 
Deallocator _dealloc
 

Friends

class Any
 
class AtomAny
 
class ArrayAny
 

Detailed Description

Definition at line 45 of file Any.hxx.

Constructor & Destructor Documentation

StringOnHeap::StringOnHeap ( const char *  val)
private

Definition at line 34 of file Any.cxx.

Referenced by deepCopy().

34  :_dealloc(0),_str(strdup(val))
35 {
36 }
StringOnHeap::StringOnHeap ( const std::string &  val)
private

Definition at line 38 of file Any.cxx.

38  :_dealloc(0),_str(strdup(val.c_str()))
39 {
40 }
StringOnHeap::StringOnHeap ( char *  val,
Deallocator  deAlloc 
)
private
Note
: no copy is performed if a deallocator is given.
Parameters
val: String in C format that is NOT copied if deAlloc != 0
deAlloc: pointer on function to deallocate val after last use.

Definition at line 49 of file Any.cxx.

References _str.

49  :_dealloc(deAlloc)
50 {
51  if(deAlloc)
52  _str=val;
53  else
54  _str=strdup(val);
55 }
StringOnHeap::~StringOnHeap ( )
private

Definition at line 67 of file Any.cxx.

References _dealloc, and _str.

68 {
69  if(_dealloc)
70  _dealloc(_str);
71  else
72  free(_str);
73 }

Member Function Documentation

const char* YACS::ENGINE::StringOnHeap::cStr ( ) const
inlineprivate

Definition at line 56 of file Any.hxx.

Referenced by YACS::ENGINE::AtomAny::getStringValue().

56 { return _str; }
StringOnHeap * StringOnHeap::deepCopy ( ) const
private

Definition at line 62 of file Any.cxx.

References _str, and StringOnHeap().

Referenced by YACS::ENGINE::AtomAny::putMyReprAtPlace().

63 {
64  return new StringOnHeap(_str);
65 }
bool StringOnHeap::operator== ( const StringOnHeap other) const
private

Definition at line 57 of file Any.cxx.

References _str.

58 {
59  return strcmp(_str, other._str)==0;
60 }

Friends And Related Function Documentation

friend class Any
friend

Definition at line 47 of file Any.hxx.

friend class ArrayAny
friend

Definition at line 49 of file Any.hxx.

friend class AtomAny
friend

Definition at line 48 of file Any.hxx.

Member Data Documentation

Deallocator YACS::ENGINE::StringOnHeap::_dealloc
private

Definition at line 60 of file Any.hxx.

Referenced by ~StringOnHeap().

char* YACS::ENGINE::StringOnHeap::_str
private

Definition at line 59 of file Any.hxx.

Referenced by deepCopy(), operator==(), StringOnHeap(), and ~StringOnHeap().


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