diff options
Diffstat (limited to 'src/Array.cpp')
| -rw-r--r-- | src/Array.cpp | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/src/Array.cpp b/src/Array.cpp index dbb1239..bdd26e1 100644 --- a/src/Array.cpp +++ b/src/Array.cpp | |||
| @@ -7,15 +7,15 @@ | |||
| 7 | * modify it under the terms of the GNU Lesser General Public | 7 | * modify it under the terms of the GNU Lesser General Public |
| 8 | * License as published by the Free Software Foundation; either | 8 | * License as published by the Free Software Foundation; either |
| 9 | * version 2.1 of the License, or (at your option) any later version. | 9 | * version 2.1 of the License, or (at your option) any later version. |
| 10 | * | 10 | * |
| 11 | * This library is distributed in the hope that it will be useful, | 11 | * This library is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 | * Lesser General Public License for more details. | 14 | * Lesser General Public License for more details. |
| 15 | * | 15 | * |
| 16 | * You should have received a copy of the GNU Lesser General Public | 16 | * You should have received a copy of the GNU Lesser General Public |
| 17 | * License along with this library; if not, write to the Free Software | 17 | * License along with this library; if not, write to the Free Software |
| 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 19 | */ | 19 | */ |
| 20 | 20 | ||
| 21 | #include <stdlib.h> | 21 | #include <stdlib.h> |
| @@ -37,7 +37,7 @@ Array::Array(plist_t node, Node* parent) : Structure(parent) | |||
| 37 | 37 | ||
| 38 | for (uint32_t i = 0; i < size; i++) | 38 | for (uint32_t i = 0; i < size; i++) |
| 39 | { | 39 | { |
| 40 | plist_t subnode = plist_array_get_item(_node, i); | 40 | plist_t subnode = plist_array_get_item(_node, i); |
| 41 | _array.push_back( Utils::FromPlist(subnode, this) ); | 41 | _array.push_back( Utils::FromPlist(subnode, this) ); |
| 42 | } | 42 | } |
| 43 | } | 43 | } |
| @@ -50,7 +50,7 @@ Array::Array(PList::Array& a) : Structure() | |||
| 50 | 50 | ||
| 51 | for (uint32_t i = 0; i < size; i++) | 51 | for (uint32_t i = 0; i < size; i++) |
| 52 | { | 52 | { |
| 53 | plist_t subnode = plist_array_get_item(_node, i); | 53 | plist_t subnode = plist_array_get_item(_node, i); |
| 54 | _array.push_back( Utils::FromPlist(subnode, this) ); | 54 | _array.push_back( Utils::FromPlist(subnode, this) ); |
| 55 | } | 55 | } |
| 56 | } | 56 | } |
| @@ -60,7 +60,7 @@ Array& Array::operator=(PList::Array& a) | |||
| 60 | plist_free(_node); | 60 | plist_free(_node); |
| 61 | for (unsigned int it = 0; it < _array.size(); it++) | 61 | for (unsigned int it = 0; it < _array.size(); it++) |
| 62 | { | 62 | { |
| 63 | delete _array.at(it); | 63 | delete _array.at(it); |
| 64 | } | 64 | } |
| 65 | _array.clear(); | 65 | _array.clear(); |
| 66 | 66 | ||
| @@ -69,7 +69,7 @@ Array& Array::operator=(PList::Array& a) | |||
| 69 | 69 | ||
| 70 | for (uint32_t i = 0; i < size; i++) | 70 | for (uint32_t i = 0; i < size; i++) |
| 71 | { | 71 | { |
| 72 | plist_t subnode = plist_array_get_item(_node, i); | 72 | plist_t subnode = plist_array_get_item(_node, i); |
| 73 | _array.push_back( Utils::FromPlist(subnode, this) ); | 73 | _array.push_back( Utils::FromPlist(subnode, this) ); |
| 74 | } | 74 | } |
| 75 | return *this; | 75 | return *this; |
| @@ -77,11 +77,11 @@ Array& Array::operator=(PList::Array& a) | |||
| 77 | 77 | ||
| 78 | Array::~Array() | 78 | Array::~Array() |
| 79 | { | 79 | { |
| 80 | for (unsigned int it = 0; it < _array.size(); it++) | 80 | for (unsigned int it = 0; it < _array.size(); it++) |
| 81 | { | 81 | { |
| 82 | delete (_array.at(it)); | 82 | delete (_array.at(it)); |
| 83 | } | 83 | } |
| 84 | _array.clear(); | 84 | _array.clear(); |
| 85 | } | 85 | } |
| 86 | 86 | ||
| 87 | Node* Array::Clone() | 87 | Node* Array::Clone() |
| @@ -98,10 +98,10 @@ void Array::Append(Node* node) | |||
| 98 | { | 98 | { |
| 99 | if (node) | 99 | if (node) |
| 100 | { | 100 | { |
| 101 | Node* clone = node->Clone(); | 101 | Node* clone = node->Clone(); |
| 102 | clone->SetParent(this); | 102 | clone->SetParent(this); |
| 103 | plist_array_append_item(_node, clone->GetPlist()); | 103 | plist_array_append_item(_node, clone->GetPlist()); |
| 104 | _array.push_back(clone); | 104 | _array.push_back(clone); |
| 105 | } | 105 | } |
| 106 | } | 106 | } |
| 107 | 107 | ||
| @@ -109,12 +109,12 @@ void Array::Insert(Node* node, unsigned int pos) | |||
| 109 | { | 109 | { |
| 110 | if (node) | 110 | if (node) |
| 111 | { | 111 | { |
| 112 | Node* clone = node->Clone(); | 112 | Node* clone = node->Clone(); |
| 113 | clone->SetParent(this); | 113 | clone->SetParent(this); |
| 114 | plist_array_insert_item(_node, clone->GetPlist(), pos); | 114 | plist_array_insert_item(_node, clone->GetPlist(), pos); |
| 115 | std::vector<Node*>::iterator it = _array.begin(); | 115 | std::vector<Node*>::iterator it = _array.begin(); |
| 116 | it += pos; | 116 | it += pos; |
| 117 | _array.insert(it, clone); | 117 | _array.insert(it, clone); |
| 118 | } | 118 | } |
| 119 | } | 119 | } |
| 120 | 120 | ||
| @@ -122,12 +122,12 @@ void Array::Remove(Node* node) | |||
| 122 | { | 122 | { |
| 123 | if (node) | 123 | if (node) |
| 124 | { | 124 | { |
| 125 | uint32_t pos = plist_array_get_item_index(node->GetPlist()); | 125 | uint32_t pos = plist_array_get_item_index(node->GetPlist()); |
| 126 | plist_array_remove_item(_node, pos); | 126 | plist_array_remove_item(_node, pos); |
| 127 | std::vector<Node*>::iterator it = _array.begin(); | 127 | std::vector<Node*>::iterator it = _array.begin(); |
| 128 | it += pos; | 128 | it += pos; |
| 129 | _array.erase(it); | 129 | _array.erase(it); |
| 130 | delete node; | 130 | delete node; |
| 131 | } | 131 | } |
| 132 | } | 132 | } |
| 133 | 133 | ||
