#include <map.h>
|
| int | map () |
| | Allocate new memory of map. More...
|
| |
| int | map (const char *element,...) |
| | Allocate new memory of map with elements. More...
|
| |
| void | set (int id, const char *name, const T &value) |
| |
| const char * | get (int id, const char *name) |
| | Direct const access operator. More...
|
| |
| const char * | getkeybyid (int id, int num) |
| | Direct key access operator. More...
|
| |
| const char * | getvaluebyid (int id, int num) |
| | Direct value access operator. More...
|
| |
| int | size (int id) |
| | Get number of elements in the map. More...
|
| |
| int | erase (int id, const char *name) |
| | Erases an element from the map.
. More...
|
| |
| void | clear (int id) |
| | Clears the map and deletes all allocated memory. More...
|
| |
| bool | close (int id) |
| | free memory of map More...
|
| |
| void | log (int id) |
| | print all elements and value in log window More...
|
| |
| bool | save (int id, const char *filename, const char *option="xml") |
| | save all elements and value to file as xml or json More...
|
| |
| const char * | tostring (int id, const char *option="xml") |
| | save all elements and value to string buffer as xml or json More...
|
| |
Definition at line 7 of file map.h.
◆ map() [1/2]
Allocate new memory of map.
- Returns
- id >= 0 is successed, -1 is failed.
Must call map.close() for free memory.
◆ map() [2/2]
| int map::map |
( |
const char * |
element, |
|
|
|
... |
|
) |
| |
Allocate new memory of map with elements.
- Parameters
-
| element | data member on this map
|
- Returns
- id >= 0 is successed, -1 is failed.
Must call map.close() for free memory.
◆ clear()
| void map::clear |
( |
int |
id | ) |
|
Clears the map and deletes all allocated memory.
- Parameters
-
◆ close()
| bool map::close |
( |
int |
id | ) |
|
free memory of map
- Parameters
-
- Returns
- true is successed, false is failed.
◆ erase()
| int map::erase |
( |
int |
id, |
|
|
const char * |
name |
|
) |
| |
Erases an element from the map.
.
- Parameters
-
| id | map id. |
| name | Name of element to be operate. |
- Returns
- new size of array is successed, 0 is empty, -1 is failed.
◆ get()
| const char* map::get |
( |
int |
id, |
|
|
const char * |
name |
|
) |
| |
Direct const access operator.
- Parameters
-
| id | map id. |
| name | Name of element to be operate. |
- Returns
- Value from element name is successed, empty string is failed.
◆ getkeybyid()
| const char* map::getkeybyid |
( |
int |
id, |
|
|
int |
num |
|
) |
| |
Direct key access operator.
- Parameters
-
| id | map id. |
| num | id of element to be operate. |
- Returns
- Key from element id is successed, empty string is failed.
◆ getvaluebyid()
| const char* map::getvaluebyid |
( |
int |
id, |
|
|
int |
num |
|
) |
| |
Direct value access operator.
- Parameters
-
| id | map id. |
| num | id of element to be operate. |
- Returns
- Value from element id is successed, empty string is failed.
◆ log()
print all elements and value in log window
- Parameters
-
◆ save()
| bool map::save |
( |
int |
id, |
|
|
const char * |
filename, |
|
|
const char * |
option = "xml" |
|
) |
| |
save all elements and value to file as xml or json
- Parameters
-
| id | map id. |
| filename | filename want to save to disk. |
| option | file type xml or json. default: xml |
- Returns
- true is successed, false is failed.
◆ set()
| void map::set |
( |
int |
id, |
|
|
const char * |
name, |
|
|
const T & |
value |
|
) |
| |
Adds new element or set new data to element by name in map.
If name exist is update otherwise is adding.
- Parameters
-
| id | map id. |
| name | element name |
| value | data to add at map. |
◆ size()
Get number of elements in the map.
- Parameters
-
- Returns
- Size of elements in the map which are actually occupied. empty is 0.
◆ tostring()
| const char* map::tostring |
( |
int |
id, |
|
|
const char * |
option = "xml" |
|
) |
| |
save all elements and value to string buffer as xml or json
- Parameters
-
| id | map id. |
| option | file type xml or json. default: xml |
- Returns
- successed return map buffer in string format, otherwise is empty string.
The documentation for this class was generated from the following file: