#include <data.h>
Public Types | |
enum | DataType { dtError, dtId, dtNum, dtData, dtText } |
Public Member Functions | |
Data (Id attr, Id value, Data *pNext=NULL) | |
attr=Id | |
Data (Id attr, double number, Data *pNext=NULL) | |
attr=number | |
Data (Id attr, Data *pData, Data *pNext=NULL) | |
attr=Data | |
Data (Id attr, char *str, Data *pNext=NULL) | |
attr=text | |
bool | IsUnitNum () |
DataType | GetType () |
Id | GetAttr () |
Id | GetId () |
double | GetNum () |
Data * | GetData () |
Data * | GetNext () |
Data * | FindAttr (Id attr) |
Data * | FindData (Id data) |
void | Dump (FILE *fp=stdout, int indent=0) |
Recursive dump of Data. If indent==-1 separate with space not . | |
void | Print () |
Print the data field of a Data object. | |
void | AppendData (Data *p) |
Append list *p after end of this data. | |
void | Insert (Data *p) |
Insert single item after this Data item. | |
Static Public Member Functions | |
static Data * | Delete (Data **pp, Data *pData) |
Delete data item from a list of Data. Returns NULL if not found. | |
static Data * | BuildData (Data *p=NULL) |
Notes:
Responsibilities:
|
|
|
attr=Id
|
|
attr=number
|
|
attr=Data
|
|
attr=text
|
|
Append list *p after end of this data.
|
|
BuildData tokenizes and builds data strings. TODO: BuildData requires that strtok(NULL, " \n") will find data tokens. This is dependent on strtok's hidden global buffer, and it changes that strtok buffer. This modification of the hidden global buffer is a kinda icky side effect. Someday replace this with something better. |
|
Delete data item from a list of Data. Returns NULL if not found.
|
|
Recursive dump of Data. If indent==-1 separate with space not
|
|
|
|
Return pointer to Data item with data |
|
|
|
|
|
|
|
|
|
|
|
|
|
Insert single item after this Data item.
|
|
|
|
Print the data field of a Data object.
|