diff options
| author | 2025-02-28 00:17:57 +0800 | |
|---|---|---|
| committer | 2025-03-01 23:42:06 +0100 | |
| commit | d40f03e4090edafea75f04a1697ef0384231d333 (patch) | |
| tree | e3915131a791b3ce5669ee7938ff4eb4f2c5bbba /include/plist/Array.h | |
| parent | 02be84957d44ce68dcf81bada0d3250d4d81395a (diff) | |
| download | libplist-d40f03e4090edafea75f04a1697ef0384231d333.tar.gz libplist-d40f03e4090edafea75f04a1697ef0384231d333.tar.bz2 | |
C++: Add more convenience functions to the interface
Diffstat (limited to 'include/plist/Array.h')
| -rw-r--r-- | include/plist/Array.h | 10 |
1 files changed, 10 insertions, 0 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; |
