Spinning Topp Logo BlackTopp Studios
inc
xpathvariable.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 _xpathvariable_h
57 #define _xpathvariable_h
58 
59 /// @file
60 /// @brief The XPathVariable class definition
61 
62 #include "datatypes.h"
63 #include "XML/xmlenumerations.h"
64 
65 
66 
67 namespace Mezzanine
68 {
69  namespace XML
70  {
71  class XPathNodeSet;
72 
73  /// @brief A single XPath variable
74  /// @details This is intended to be used as a single member of an @ref Mezzanine::XML::XPathVariableSet, and for moving data into and out of @ref Mezzanine::XML::XPathQuery.
76  {
77  friend class XPathVariableSet;
78 
79  protected:
80 
81  /// @internal
82  /// @brief What kind of data does this variable store
84 
85  /// @internal
86  /// @brief The Next Variable in a linked structure of XPathVariables.
88 
89  /// @brief Protected Default constructor to prevent default constrution.
90  XPathVariable();
91 
92  /// @brief Protected Copy Constructor, used to force noncopyable semantics
94 
95  /// @brief Protected assignment operator, used to force noncopyable semantics
96  /// @return Shouldn't be used, not supported.
97  XPathVariable& operator=(const XPathVariable&);
98 
99  public:
100  /// @brief Get the variable name
101  /// @returns The name of this variable or a null pointer if this this @ref XPathVariable is of an invalid type/
102  const Char8* Name() const;
103 
104  /// @brief Get variable type
105  /// @return The current Type of this @ref XPathVariable.
106  XPathValueType Type() const;
107 
108  // Get variable Value; no Type conversion is performed, default Value (false, NaN, empty string, empty node set) is returned on Type mismatch error
109  /// @brief Get this as a bool.
110  /// @details Get variable Value; Minimal Type conversion is performed, default Value (false, NaN, empty string, empty node set) is returned on Type mismatch error
111  /// @return This as a bool, with any appropriate downcasting.
112  bool GetBoole() const;
113 
114  /// @details Get variable Value; default Value (false, NaN, empty string, empty node set) is returned on Type mismatch error
115  /// @return This as a double.
116  /// @brief Get this as a double.
117  double GetNumber() const;
118 
119  /// @brief Get this as a c-string.
120  /// @details Get variable Value; default Value (false, NaN, empty string, empty node set) is returned on Type mismatch error
121  /// @return This as a c-string of char_t, without conversion.
122  const Char8* GetString() const;
123 
124  /// @brief Get this as a XPathNodeSet.
125  /// @details Get variable Value; no Type conversion is performed, if type of variable is not a XPathNodeSet then an XPathException is thrown
126  /// @throw XPathException on type mismatch or allocation error
127  /// @return A This as an XPathNodeSet, without conversion.
128  const XPathNodeSet& GetNodeSet() const;
129 
130  /// @brief Set variable Value; no Type conversion is performed.
131  /// @return True is returned on Success, false is returned on Type mismatch error.
132  /// @param Value The value to attempt to put into this.
133  bool Set(bool Value);
134 
135  /// @brief Set variable Value; no Type conversion is performed.
136  /// @param Value The value as a double to attempt to put into this.
137  /// @return True is return, false is returned on Type mismatch error.
138  bool Set(double Value);
139 
140  /// @brief Set variable Value; no Type conversion is performed.
141  /// @param Value The value as a char_t array to attempt to put into this.
142  /// @return True is return, false is returned on Type mismatch error.
143  bool Set(const Char8* Value);
144 
145  /// @brief Set variable Value; no Type conversion is performed.
146  /// @param Value The value to attempt to put into this.
147  /// @return True is return, false is returned on Type mismatch error.
148  bool Set(const XPathNodeSet& Value);
149  };
150  }
151 } // /namespace Mezzanine
152 
153 
154 
155 #endif // Include guard
156 
157 
158 /*
159  *
160  * Software, Files, Libraries and all other items referenced in this clause refers only
161  * to the contents of this file and associated documentation.
162  *
163  * Copyright © 2006-2012 Arseny Kapoulkine
164  *
165  * Permission is hereby granted, free of charge, to any person
166  * obtaining a copy of this software and associated documentation
167  * files (the "Software"), to deal in the Software without
168  * restriction, including without limitation the rights to use,
169  * copy, modify, merge, publish, distribute, sublicense, and/or sell
170  * copies of the Software, and to permit persons to whom the
171  * Software is furnished to do so, subject to the following
172  * conditions:
173  *
174  * The above copyright notice and this permission notice shall be
175  * included in all copies or substantial portions of the Software.
176  *
177  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
178  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
179  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
180  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
181  * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
182  * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
183  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
184  * OTHER DEALINGS IN THE SOFTWARE.
185  */
XPathValueType
XPathQuery return type.
A fixed sized collection of nodes that an XPathQuery can work on.
Definition: xpathnodeset.h:72
All the definitions for datatypes as well as some basic conversion functions are defined here...
A set of XPath variables.
char Char8
A datatype to represent one character.
Definition: datatypes.h:169
XPathValueType ValueType
What kind of data does this variable store.
Definition: xpathvariable.h:83
Enumerations and constant values used primarily in the XML system but useful for interacting with it ...
A single XPath variable.
Definition: xpathvariable.h:75
XPathVariable * NextVariable
The Next Variable in a linked structure of XPathVariables.
Definition: xpathvariable.h:87
#define MEZZ_LIB
Some platforms require special decorations to denote what is exported/imported in a share library...
The bulk of the engine components go in this namspace.
Definition: actor.cpp:56