diff options
Diffstat (limited to 'include/plist')
| -rw-r--r-- | include/plist/Array.h | 10 | ||||
| -rw-r--r-- | include/plist/Dictionary.h | 7 | ||||
| -rw-r--r-- | include/plist/Structure.h | 1 |
3 files changed, 16 insertions, 2 deletions
diff --git a/include/plist/Array.h b/include/plist/Array.h index 0239c78..34ddd6f 100644 --- a/include/plist/Array.h +++ b/include/plist/Array.h | |||
| @@ -57,6 +57,16 @@ public : | |||
| 57 | void Remove(Node* node); | 57 | void Remove(Node* node); |
| 58 | void Remove(unsigned int pos); | 58 | void Remove(unsigned int pos); |
| 59 | unsigned int GetNodeIndex(Node* node) const; | 59 | unsigned int GetNodeIndex(Node* node) const; |
| 60 | template <typename T> | ||
| 61 | T* at(unsigned int index) | ||
| 62 | { | ||
| 63 | return (T*)(_array.at(index)); | ||
| 64 | } | ||
| 65 | template <typename T> | ||
| 66 | T* At(unsigned int index) | ||
| 67 | { | ||
| 68 | return (T*)(_array.at(index)); | ||
| 69 | } | ||
| 60 | 70 | ||
| 61 | private : | 71 | private : |
| 62 | std::vector<Node*> _array; | 72 | std::vector<Node*> _array; |
diff --git a/include/plist/Dictionary.h b/include/plist/Dictionary.h index 583a430..fc7e558 100644 --- a/include/plist/Dictionary.h +++ b/include/plist/Dictionary.h | |||
| @@ -60,11 +60,14 @@ public : | |||
| 60 | void Remove(Node* node); | 60 | void Remove(Node* node); |
| 61 | void Remove(const std::string& key); | 61 | void Remove(const std::string& key); |
| 62 | std::string GetNodeKey(Node* node); | 62 | std::string GetNodeKey(Node* node); |
| 63 | template <typename T> | ||
| 64 | T* Get(const std::string& key) | ||
| 65 | { | ||
| 66 | return (T*)(_map[key]); | ||
| 67 | } | ||
| 63 | 68 | ||
| 64 | private : | 69 | private : |
| 65 | std::map<std::string,Node*> _map; | 70 | std::map<std::string,Node*> _map; |
| 66 | |||
| 67 | |||
| 68 | }; | 71 | }; |
| 69 | 72 | ||
| 70 | }; | 73 | }; |
diff --git a/include/plist/Structure.h b/include/plist/Structure.h index eded8b2..d85b17a 100644 --- a/include/plist/Structure.h +++ b/include/plist/Structure.h | |||
| @@ -43,6 +43,7 @@ public : | |||
| 43 | 43 | ||
| 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 | 47 | ||
| 47 | protected: | 48 | protected: |
| 48 | Structure(Node* parent = NULL); | 49 | Structure(Node* parent = NULL); |
