diff options
| -rw-r--r-- | include/plist/Structure.h | 2 | ||||
| -rw-r--r-- | src/Structure.cpp | 13 |
2 files changed, 15 insertions, 0 deletions
diff --git a/include/plist/Structure.h b/include/plist/Structure.h index d85b17a..b7fbdb5 100644 --- a/include/plist/Structure.h +++ b/include/plist/Structure.h | |||
| @@ -44,6 +44,8 @@ public : | |||
| 44 | static Structure* FromXml(const std::string& xml); | 44 | static Structure* FromXml(const std::string& xml); |
| 45 | static Structure* FromBin(const std::vector<char>& bin); | 45 | static Structure* FromBin(const std::vector<char>& bin); |
| 46 | static Structure* FromBin(const char* bin, uint64_t size); | 46 | static Structure* FromBin(const char* bin, uint64_t size); |
| 47 | static Structure* FromMemory(const std::vector<char>& buf, plist_format_t* format = NULL); | ||
| 48 | static Structure* FromMemory(const char* buf, uint64_t size, plist_format_t* format = NULL); | ||
| 47 | 49 | ||
| 48 | protected: | 50 | protected: |
| 49 | Structure(Node* parent = NULL); | 51 | Structure(Node* parent = NULL); |
diff --git a/src/Structure.cpp b/src/Structure.cpp index f56b0e6..65e5ca8 100644 --- a/src/Structure.cpp +++ b/src/Structure.cpp | |||
| @@ -127,4 +127,17 @@ Structure* Structure::FromBin(const char* bin, uint64_t size) | |||
| 127 | return ImportStruct(root); | 127 | return ImportStruct(root); |
| 128 | } | 128 | } |
| 129 | 129 | ||
| 130 | Structure* Structure::FromMemory(const std::vector<char>& buf, plist_format_t *format) | ||
| 131 | { | ||
| 132 | return Structure::FromMemory(&buf[0], buf.size(), format); | ||
| 133 | } | ||
| 134 | |||
| 135 | Structure* Structure::FromMemory(const char* buf, uint64_t size, plist_format_t *format) | ||
| 136 | { | ||
| 137 | plist_t root = NULL; | ||
| 138 | plist_from_memory(buf, size, &root, format); | ||
| 139 | return ImportStruct(root); | ||
| 140 | } | ||
| 141 | |||
| 142 | |||
| 130 | } // namespace PList | 143 | } // namespace PList |
