Static Public Member Functions |
static string & | quoteString (string &s) |
| Replaces all single quotes (') in the string with quoted single quotes (\').
|
static string & | unquoteString (string &s) |
| Replaces all quotes single quotes (\') in the string with single quotes (') Reverses what quoteString did.
|
Default constructor |
- Parameters:
-
|
| PData (PData *owner=NULL) |
| Default constructor.
|
Conversion constructors |
These constructors make PData objects that represent their argument values and types.
- Parameters:
-
|
| PData (int v, PData *owner=NULL) |
| Conversion constructor.
|
| PData (long v, PData *owner=NULL) |
| Conversion constructor.
|
| PData (float v, PData *owner=NULL) |
| Conversion constructor.
|
| PData (double v, PData *owner=NULL) |
| Conversion constructor.
|
| PData (string v, PData *owner=NULL) |
| Conversion constructor.
|
Copy constructor |
|
| PData (const PData &v, PData *owner=NULL) |
| Copy constructor.
|
Command constructors |
These construct new PData objects via a three different methods, "eval", "init" and "raw", corresponding to the PData.eval(), PData.init() and PData.raw() methods which do the same thing after construction.
|
| PData (const char *command, const char *evalstring, int len=-1) |
| Command constructor.
|
| PData (const char *command, string evalstring) |
| Command constructor.
|
| PData (string command, string evalstring) |
| Command constructor.
|
Assignment operators |
Each of these sets the value of the PData object, changing its type as appropriate.
Each of them returns the value just set.
|
int | operator= (int v) |
| Assignment operator. Overwrites the type of the PData.
|
long | operator= (long v) |
| Assignment operator. Overwrites the type of the PData.
|
float | operator= (float v) |
| Assignment operator. Overwrites the type of the PData.
|
double | operator= (double v) |
| Assignment operator. Overwrites the type of the PData.
|
string | operator= (string v) |
| Assignment operator. Overwrites the type of the PData.
|
PData & | operator= (PData &v) |
| Assignment operator. Overwrites the type of the PData.
|
int | set (int v) |
| Assignment operator. Overwrites the type of the PData.
|
long | set (long v) |
| Assignment operator. Overwrites the type of the PData.
|
float | set (float v) |
| Assignment operator. Overwrites the type of the PData.
|
double | set (double v) |
| Assignment operator. Overwrites the type of the PData.
|
string | set (string v) |
| Assignment operator. Overwrites the type of the PData.
|
PData & | set (PData &v) |
| Assignment operator. Overwrites the type of the PData.
|
String evaluation functions |
Each of these returns a reference to the PData object it is called on.
|
PData & | eval (string evalstring) |
| Evaluate a representation string and make it the new value of this PData.
|
PData & | eval (const char *evalstring, int len=-1) |
| Evaluate a representation string and make it the new value of this PData.
|
PData & | init (string typestring) |
| Initialize the PData to the given type (int, float, string, list, map).
|
PData & | init (const char *typestring, int len=-1) |
| Initialize the PData to the given type (int, float, string, list, map).
|
PData & | raw (string rawbytes) |
| Initialize the PData to hold a string of raw bytes.
|
PData & | raw (const char *rawbytes, int len=-1) |
| Initialize the PData to hold a string of raw bytes.
|
Conversion operators |
Each of these casts a pdata to a type (if possible, throw exception otherwise)
|
| operator int () |
| Perform a type-cast.
|
| operator long () |
| Perform a type-cast.
|
| operator float () |
| Perform a type-cast.
|
| operator double () |
| Perform a type-cast.
|
| operator string () |
| Perform a type-cast.
|
int | getInt () |
| Extract the value held by the PData.
|
long | getLong () |
| Extract the value held by the PData.
|
float | getFloat () |
| Extract the value held by the PData.
|
double | getDouble () |
| Extract the value held by the PData.
|
string | getString () |
| Extract the value held by the PData.
|
Extraction operators |
|
PData & | operator[] (string index) |
| Get the map value corresponding to a given key; adds the key/value if not already present..
|
PData & | operator[] (const char *index) |
| Get the map value corresponding to a given key; adds the key/value if not already present..
|
PData & | operator[] (int index) |
| Get the list value corresponding to a given index.
|
PData & | get (string index) |
| Get the map value corresponding to a given key; adds the key/value if not already present..
|
PData & | get (const char *index) |
| Get the map value corresponding to a given key; adds the key/value if not already present..
|
PData & | get (int index) |
| Get the list value corresponding to a given index.
|
Manipulations |
|
void | clear () |
| Clear the PData but retain its type.
|
void | setNull () |
| Clear the PData, change its type to null.
|
void | append (const PData &v) |
| Append to a list.
|
void | erase (int index) |
| Erase a given list index.
|
void | erase (string index) |
| Erase a given map key/value pair.
|
void | erase (const char *index) |
| Erase a given map key/value pair.
|
void | resize (int size) |
| Resize a list.
|
Information |
|
string | getType () |
| Get the type of a PData.
|
int | getTypeEnum () |
| Get the type enum of a PData (compare against enums in PDataNull.h).
|
int | size () |
| Get the number of elements in a list or map.
|
int | isRaw () |
| Return 1 if this PData holds only raw bytes.
|
long | getIndex () |
int | has (const PData &v) |
| Return 1 if a given PData is present in a list.
|
int | hasKey (const char *v) |
| Return 1 if a given key string is present in a map.
|
vector< string > | keys () |
| Return a vector of keys in a map.
|
void | iterateKeys () |
| Begin iterating over the map's keys, in case you can't get access to C++ vectors from your favorite language.
|
int | hasNextKey () |
| Return 1 if there is another key in the map's iterator.
|
string | getNextKey () |
| Get the next key in the map.
|
int | operator== (const PData &v) |
| Check value equivalence of two PData's.
|
int | equals (const PData &v) |
| Check value equivalence of two PData's.
|
int | find (const PData &v) |
| Return the index at which something is found in a list.
|
Output functions |
|
string | toString () |
| Output to string.
|
void | exportBuffer (void(*receiveCallback)(const char *buffer, int size)) |
| Export the output buffer for the purpose of efficient parsing by another thread.
|
char * | insertTransmit (char *buf_start, char *buf_end) |
| Insert string representation into given char buffer.
|
int | getTransmitSize () |
| Return the size of the transmit buffer, not including a trailing null, i.e.
|
ostream & | operator<< (ostream &o, PData &p) |
| Output to ostream.
|