CXI
Loading...
Searching...
No Matches
Public Member Functions | List of all members
Property Class Reference

Creates and parses property values of different types. More...

Inheritance diagram for Property:
[legend]
Collaboration diagram for Property:
[legend]

Public Member Functions

 Property (void)
 
 Property (const char *data, int len)
 
 Property (const char *str)
 
 Property (int val, int len)
 
 Property (const ByteArray &ba)
 
 Property (const Property &prop)
 
virtual ~Property (void)
 
void clear (void)
 
char * getString (void)
 
void setString (const char *str)
 
const Propertyoperator= (const Property &prop)
 
- Public Member Functions inherited from ByteArray
 ByteArray (void)
 
 ByteArray (int len)
 
 ByteArray (const char *data, int len)
 
 ByteArray (const char *str)
 
 ByteArray (int val, int len)
 
 ByteArray (const ByteArray &ba)
 
virtual ~ByteArray (void)
 
void clear (void)
 
int length (void) const
 
char * get (void)
 
const char * get (void) const
 
void set (const char *data, int len)
 
void append (const char *data, int len)
 
void append (const ByteArray &ba)
 
void insert (const char *data, int len, int offset)
 
void fill (char value, int len, int offset)
 
int getInt (int def_val=0) const
 
void setInt (int val, int len)
 
void appendInt (int val, int len)
 
void getString (char *str, int max_size) const
 
void setString (const char *str)
 
void appendString (const char *str)
 
std::string toString (void) const
 
std::string toHexString (void) const
 
int compare (const ByteArray &ba) const
 
ByteArray sub (int offset, int len=-1) const
 
ByteArray lstrip (void) const
 
ByteArray rstrip (const std::set< char > &charsToBeStripped) const
 
void read (const char *filename)
 
void write (const char *filename) const
 
void xtrace (const char *text=0) const
 
ByteArrayoperator= (const ByteArray &ba)
 
const ByteArrayoperator+= (const ByteArray &ba)
 
const ByteArrayoperator|= (const ByteArray &ba)
 
const ByteArrayoperator^= (const ByteArray &ba)
 
char & operator[] (int idx)
 

Detailed Description

Creates and parses property values of different types.

The following example illustrates the usage of the Property class:

// set unicode string as key name property
wchar_t *name = L"Key Name";
int name_len = (wcslen(name) + 1) * 2;
Property prop = Property((char*)name, len);
PropertyList keyTemplate;
keyTemplate.set(CXI_PROP_KEY_NAME, prop);
// ...
printf("Name: %s", keyTemplate.getName()); // output: '{U}Key Name'
Creates and parses property values of different types.
Definition: sw/cxi_api_c/def/property.h:19
Property(void)
Definition: property.cpp:140
Constructs and parses key property lists, see Key Properties.
Definition: sw/cxi_api_c/def/propertylist.h:19
char * getName(void)
Definition: propertylist.cpp:268
void set(int idx, const Property &property)
Definition: propertylist.cpp:475
#define CXI_PROP_KEY_NAME
Key name (default: empty) [array<byte>].
Definition: fw/cxi/def/cxi_defs.h:41

Constructor & Destructor Documentation

◆ Property() [1/6]

Property ( void  )

Default Constructor: creates empty property value.

◆ Property() [2/6]

Property ( const char *  data,
int  len 
)

Overloaded Constructor: creates property value from given data.

Parameters
datapointer to data to be set
lenlength of data to be set

◆ Property() [3/6]

Property ( const char *  str)

Overloaded Constructor: creates property value from given C-string.

Parameters
strC-string to be set

◆ Property() [4/6]

Property ( int  val,
int  len 
)

Overloaded Constructor: creates property value from given integer.

Parameters
valinteger to be set
lennumber of bytes to be converted [1..4].

◆ Property() [5/6]

Property ( const ByteArray ba)

Overloaded Constructor: creates property value from given byte array.

Parameters
babyte array to be set

◆ Property() [6/6]

Property ( const Property prop)

Copy Constructor: create deep copy of property class

◆ ~Property()

~Property ( void  )
virtual

Destructor: frees internal resources

Member Function Documentation

◆ clear()

void clear ( void  )

Clears all internal resources

◆ getString()

char * getString ( void  )

Returns property string.

Returns
property value as zero terminated C-string

◆ setString()

void setString ( const char *  str)

Sets given string as property value.

Parameters
strstring to be set [zero terminated C-string]

◆ operator=()

const Property & operator= ( const Property prop)

Copies one instance of byte array to another.

Parameters
propsource property