Spinning Topp Logo BlackTopp Studios
inc
attributeiterator.h
Go to the documentation of this file.
1 // © Copyright 2010 - 2016 BlackTopp Studios Inc.
2 /* This file is part of The Mezzanine Engine.
3 
4  The Mezzanine Engine is free software: you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation, either version 3 of the License, or
7  (at your option) any later version.
8 
9  The Mezzanine Engine is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with The Mezzanine Engine. If not, see <http://www.gnu.org/licenses/>.
16 */
17 /* The original authors have included a copy of the license specified above in the
18  'Docs' folder. See 'gpl.txt'
19 */
20 /* We welcome the use of the Mezzanine engine to anyone, including companies who wish to
21  Build professional software and charge for their product.
22 
23  However there are some practical restrictions, so if your project involves
24  any of the following you should contact us and we will try to work something
25  out:
26  - DRM or Copy Protection of any kind(except Copyrights)
27  - Software Patents You Do Not Wish to Freely License
28  - Any Kind of Linking to Non-GPL licensed Works
29  - Are Currently In Violation of Another Copyright Holder's GPL License
30  - If You want to change our code and not add a few hundred MB of stuff to
31  your distribution
32 
33  These and other limitations could cause serious legal problems if you ignore
34  them, so it is best to simply contact us or the Free Software Foundation, if
35  you have any questions.
36 
37  Joseph Toppi - toppij@gmail.com
38  John Blackwood - makoenergy02@gmail.com
39 */
40 /*
41  *
42  * Software, Files, Libraries and all other items referenced in this clause refers only
43  * to the contents of this file and associated documentation.
44  *
45  * Pugixml parser - version 1.0
46  * --------------------------------------------------------
47  * Copyright © 2006-2012, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)
48  * Report bugs and download new versions at http://pugixml.org/
49  *
50  * This library is distributed under the MIT License. See notice at the end
51  * of this file.
52  *
53  * This work is based on the pugxml parser, which is:
54  * Copyright © 2003, by Kristen Wegner (kristen@tima.net)
55  */
56 #ifndef _xmlattributeiterator_h
57 #define _xmlattributeiterator_h
58 
59 /// @file
60 /// @brief Contains the defintion of the AttributeIterator class
61 
62 #include "datatypes.h"
63 #include "XML/node.h"
64 
65 
66 
67 namespace Mezzanine
68 {
69  namespace XML
70  {
71 
72  // Attribute iterator (a bidirectional iterator over a collection of Attribute)
73  /// @brief Attribute iterator (a bidirectional iterator over a collection of Attribute).
74  /// @see This behaves similar to XML::NodeIterator
76  {
77  friend class Node;
78 
79  private:
80 
81  /// @internal
82  /// @brief The @ref XML::Attribute this points to.
83  mutable Attribute TargetAttribute;
84 
85  /// @internal
86  /// @brief The @ref XML::Node that is the parent of the @ref XML::Attribute pointed to by @ref TargetAttribute
87  Node ParentNode;
88 
89  /// @brief Internal Constructor, almost a copy construtor
90  /// @param ref Some of the internal data from another @ref AttributeIterator specifically the Attribute it points to.
91  /// @param ParentNode Some of the interal data from another @ref AttributeIterator specifically the parent of the Node it points to.
92  AttributeIterator(AttributeStruct* ref, NodeStruct* GetParent);
93 
94  public:
95 
96  /// @brief An Iterator trait
97  typedef ptrdiff_t difference_type;
98  /// @brief An Iterator trait
100  /// @brief An Iterator trait
101  typedef Attribute* pointer;
102  /// @brief An Iterator trait
104  /// @brief An Iterator trait
105  typedef std::bidirectional_iterator_tag iterator_category;
106 
107  /// @brief Default Constructor, makes a blank iterator
109 
110  // Construct an iterator which points to the specified attribute
111  /// @brief Construct an iterator which points to the specified node
112  /// @param GetParent A Node that contains the Attribute this iterator will point to.
113  /// @param attr The Attribute this iterator points to.
114  AttributeIterator(const Attribute& attr, const Node& GetParent);
115 
116  /// @brief Compares this AttributeIterator to another AttributeIterator for equality
117  /// @param rhs The Right Hand Side AttributeIterator
118  /// @return True if the internal data stored in the Attribute this AttributeIterator refers to is the same as the metadata in the other AttributeIterator's Attribute, false otherwise.
119  bool operator==(const AttributeIterator& rhs) const;
120 
121  /// @brief Compares this AttributeIterator to another AttributeIterator for inequality
122  /// @param rhs The Right Hand Side AttributeIterator.
123  /// @return False if the internal data stored in Node this AttributeIterator refers to is the same as the metadata in the other AttributeIterator's Attribute, True otherwise.
124  bool operator!=(const AttributeIterator& rhs) const;
125 
126  /// @brief Deferences this Iterator
127  /// @return a Attribute reference to the Attribute pointed at by this AttributeIterator.
128  Attribute& operator*() const;
129 
130  /// @brief Get the pointer the Attribute this points to.
131  /// @return A pointer to the Attribute this AttributeIterator references.
132  Attribute* operator->() const;
133 
134  /// @brief Increment the iterator to the next member of the container.
135  /// @return Returns a const AttributeIterator.
136  const AttributeIterator& operator++();
137 
138  /// @brief Increment the iterator to the next member of the container.
139  /// @return Returns a AttributeIterator.
140  AttributeIterator operator++(int);
141 
142  /// @brief Decrement the iterator to the next member of the container.
143  /// @return Returns a const AttributeIterator.
144  const AttributeIterator& operator--();
145 
146  /// @brief Decrement the iterator to the next member of the container.
147  /// @return Returns a AttributeIterator.
148  AttributeIterator operator--(int);
149  };
150 
151  }
152 } // /namespace Mezzanine
153 
154 
155 
156 #endif // Include guard
157 
158 
159 /*
160  *
161  * Software, Files, Libraries and all other items referenced in this clause refers only
162  * to the contents of this file and associated documentation.
163  *
164  * Copyright © 2006-2012 Arseny Kapoulkine
165  *
166  * Permission is hereby granted, free of charge, to any person
167  * obtaining a copy of this software and associated documentation
168  * files (the "Software"), to deal in the Software without
169  * restriction, including without limitation the rights to use,
170  * copy, modify, merge, publish, distribute, sublicense, and/or sell
171  * copies of the Software, and to permit persons to whom the
172  * Software is furnished to do so, subject to the following
173  * conditions:
174  *
175  * The above copyright notice and this permission notice shall be
176  * included in all copies or substantial portions of the Software.
177  *
178  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
179  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
180  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
181  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
182  * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
183  * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
184  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
185  * OTHER DEALINGS IN THE SOFTWARE.
186  */
A light-weight handle for manipulating attributes in DOM tree.
Definition: attribute.h:74
This defines the Mezzanine::XML::Node one of the central XML classes.
Attribute & reference
An Iterator trait.
All the definitions for datatypes as well as some basic conversion functions are defined here...
ptrdiff_t difference_type
An Iterator trait.
Attribute * pointer
An Iterator trait.
A light-weight handle for manipulating nodes in DOM tree.
Definition: node.h:89
Mezzanine::Vector3 operator*(const btVector3 &Vec, const Mezzanine::Vector3 &lhs)
Right Hand Multiplication Operator for Bullet Vectors with a Mezzanine::Vector3.
Definition: vector3.cpp:651
Attribute iterator (a bidirectional iterator over a collection of Attribute).
std::bidirectional_iterator_tag iterator_category
An Iterator trait.
#define MEZZ_LIB
Some platforms require special decorations to denote what is exported/imported in a share library...
Attribute value_type
An Iterator trait.
The bulk of the engine components go in this namspace.
Definition: actor.cpp:56