diff --git a/include/plist/plist.h b/include/plist/plist.h index 546e108..f565acb 100644 --- a/include/plist/plist.h +++ b/include/plist/plist.h @@ -111,6 +111,15 @@ extern "C" PLIST_API plist_t plist_new_array(void); /** + * Create a new plist_t type #PLIST_KEY + * + * @param val the key value, encoded in UTF8. + * @return the created item + * @sa #plist_type + */ + PLIST_API plist_t plist_new_key(const char *val); + + /** * Create a new plist_t type #PLIST_STRING * * @param val the sting value, encoded in UTF8. diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0de4c8c..ad7362b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -19,6 +19,7 @@ SET(libplist++_SRC String.cpp Date.cpp Data.cpp + Key.cpp Structure.cpp Array.cpp Dictionary.cpp diff --git a/src/Node.cpp b/src/Node.cpp index 9bf50ee..4fcb087 100644 --- a/src/Node.cpp +++ b/src/Node.cpp @@ -27,6 +27,7 @@ #include #include #include +#include #include #include @@ -59,6 +60,9 @@ Node::Node(plist_type type, Node* parent) : _parent(parent) case PLIST_STRING: _node = plist_new_string(""); break; + case PLIST_KEY: + _node = plist_new_key(""); + break; case PLIST_DATA: _node = plist_new_data(NULL,0); break; @@ -71,7 +75,6 @@ Node::Node(plist_type type, Node* parent) : _parent(parent) case PLIST_DICT: _node = plist_new_dict(); break; - case PLIST_KEY: case PLIST_NONE: default: break; @@ -130,6 +133,9 @@ Node* Node::FromPlist(plist_t node, Node* parent) case PLIST_STRING: ret = new String(node, parent); break; + case PLIST_KEY: + ret = new Key(node, parent); + break; case PLIST_DATE: ret = new Date(node, parent); break; diff --git a/src/plist.c b/src/plist.c index dcaf601..680b99e 100644 --- a/src/plist.c +++ b/src/plist.c @@ -101,8 +101,7 @@ plist_t plist_new_array(void) return plist_new_node(data); } -//These nodes should not be handled by users -static plist_t plist_new_key(const char *val) +plist_t plist_new_key(const char *val) { plist_data_t data = plist_new_plist_data(); data->type = PLIST_KEY;