QName.h
Go to the documentation of this file.
1 /* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2 
3  This file is part of the TerraLib - a Framework for building GIS enabled applications.
4 
5  TerraLib is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  TerraLib is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with TerraLib. See COPYING. If not, write to
17  TerraLib Team at <terralib-team@terralib.org>.
18  */
19 
20 /*!
21  \file QName.h
22 
23  \brief A class to deal with XML qualified names.
24 */
25 
26 #ifndef __TERRALIB_XSD_INTERNAL_QNAME_H
27 #define __TERRALIB_XSD_INTERNAL_QNAME_H
28 
29 // TerraLib
30 #include "Config.h"
31 
32 // STL
33 #include <string>
34 
35 namespace te
36 {
37  namespace xsd
38  {
39  /*!
40  \class QName
41 
42  \brief A class to be used to represent XML qualified names.
43 
44  Since URI references can be long and may contain prohibited characters for element/attribute naming,
45  QNames are used to create a mapping between the URI and a namespace prefix.
46  The mapping enables the abbreviation of URIs, therefore it achieves a more convenient way to write XML documents.
47  For more details see: http://www.w3.org/TR/REC-xml-names/#ns-qualnames.
48  */
50  {
51  public:
52 
53  /*! \brief Constructor. */
54  QName();
55 
56  /*!
57  \brief Constructor.
58 
59  \param prefix The namespace prefix part of the qualified name.
60  \param localPart The local part of the qualified name.
61  */
62  QName(const std::string& prefix, const std::string& localPart);
63 
64  /*!
65  \brief Copy constructor.
66 
67  \param rhs Right-hand-side object.
68  */
69  QName(const QName& rhs);
70 
71  /*! \brief Destructor. */
72  ~QName();
73 
74  /*!
75  \brief Assignment operator.
76 
77  \param rhs Right-hand-side object.
78 
79  \return A reference to this object.
80  */
81  QName& operator=(const QName& rhs);
82 
83  /*!
84  \brief It returns the qualified name based on prefix and local part.
85 
86  \return The qualified name.
87  */
88  std::string getQualifiedName() const;
89 
90  /*!
91  \brief It returns the namespace prefix part of the qualified name.
92 
93  \return The namespace prefix part of the qualified name.
94  */
95  const std::string& getPrefix() const;
96 
97  /*!
98  \brief It returns the local part of the qualified name.
99 
100  \return The local part of the qualified name.
101  */
102  const std::string& getLocalPart() const;
103 
104  /*!
105  \brief It sets the namespace prefix part of the qualified name.
106 
107  \param prefix The namespace prefix part of the qualified name.
108  */
109  void setPrefix(const std::string& prefix);
110 
111  /*!
112  \brief It sets the local part of the qualified name.
113 
114  \param localPart The local part of the qualified name.
115  */
116  void setLocalPart(const std::string& localPart);
117 
118  private:
119 
120  std::string m_prefix; //!< The namespace prefix part of the qualified name. It must be associated with a namespace URI reference in the namespace declaration.
121  std::string m_localPart; //!< The local part of the qualified name.
122  };
123 
124  } // end namespace xsd
125 } // end namespace te
126 
127 #endif // __TERRALIB_XSD_INTERNAL_QNAME_H
Configuration flags for the XSD Module of TerraLib.
std::string m_prefix
The namespace prefix part of the qualified name. It must be associated with a namespace URI reference...
Definition: QName.h:120
URI C++ Library.
std::string m_localPart
The local part of the qualified name.
Definition: QName.h:121
#define TEXSDEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:57
A class to be used to represent XML qualified names.
Definition: QName.h:49