File tree Expand file tree Collapse file tree 2 files changed +26
-12
lines changed
Expand file tree Collapse file tree 2 files changed +26
-12
lines changed Original file line number Diff line number Diff line change @@ -52,19 +52,18 @@ public :
5252 const_iterator End () const ;
5353 const_iterator end () const ;
5454 size_t size () const ;
55- void Append (Node* node);
56- void Insert (Node* node, unsigned int pos);
55+ void Append (const Node& node);
56+ void Append (const Node* node);
57+ void Insert (const Node& node, unsigned int pos);
58+ void Insert (const Node* node, unsigned int pos);
5759 void Remove (Node* node);
5860 void Remove (unsigned int pos);
59- unsigned int GetNodeIndex (Node* node) const ;
60- template <typename T>
61- T* at (unsigned int index)
62- {
61+ unsigned int GetNodeIndex (const Node& node) const ;
62+ unsigned int GetNodeIndex (const Node* node) const ;
63+ template <typename T> T* at (unsigned int index) {
6364 return (T*)(_array.at (index));
6465 }
65- template <typename T>
66- T* At (unsigned int index)
67- {
66+ template <typename T> T* At (unsigned int index) {
6867 return (T*)(_array.at (index));
6968 }
7069
Original file line number Diff line number Diff line change @@ -134,7 +134,7 @@ size_t Array::size() const {
134134 return _array.size ();
135135}
136136
137- void Array::Append (Node* node)
137+ void Array::Append (const Node* node)
138138{
139139 if (node)
140140 {
@@ -145,7 +145,12 @@ void Array::Append(Node* node)
145145 }
146146}
147147
148- void Array::Insert (Node* node, unsigned int pos)
148+ void Array::Append (const Node& node)
149+ {
150+ Append (&node);
151+ }
152+
153+ void Array::Insert (const Node* node, unsigned int pos)
149154{
150155 if (node)
151156 {
@@ -158,6 +163,11 @@ void Array::Insert(Node* node, unsigned int pos)
158163 }
159164}
160165
166+ void Array::Insert (const Node &node, unsigned int pos)
167+ {
168+ Insert (&node, pos);
169+ }
170+
161171void Array::Remove (Node* node)
162172{
163173 if (node)
@@ -183,10 +193,15 @@ void Array::Remove(unsigned int pos)
183193 _array.erase (it);
184194}
185195
186- unsigned int Array::GetNodeIndex (Node* node) const
196+ unsigned int Array::GetNodeIndex (const Node* node) const
187197{
188198 std::vector<Node*>::const_iterator it = std::find (_array.begin (), _array.end (), node);
189199 return std::distance (_array.begin (), it);
190200}
191201
202+ unsigned int Array::GetNodeIndex (const Node& node) const
203+ {
204+ return GetNodeIndex (&node);
205+ }
206+
192207} // namespace PList
You can’t perform that action at this time.
0 commit comments