aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/poco/XML/include/Poco/XML/QName.h
blob: 5dc4fe8d14e2a1e118e3f6f374f3518097b147b3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
// 
// QName.h 
// 
// Library: XML 
// Package: XML 
// Module:  QName 
// 
// Definition of the QName class. 
// 
// Copyright (c) 2015, Applied Informatics Software Engineering GmbH. 
// and Contributors. 
// 
// Based on libstudxml (http://www.codesynthesis.com/projects/libstudxml/). 
// Copyright (c) 2009-2013 Code Synthesis Tools CC. 
// 
// SPDX-License-Identifier:	BSL-1.0 
// 
 
 
#ifndef XML_QName_INCLUDED 
#define XML_QName_INCLUDED 
 
 
#include "Poco/XML/XML.h" 
#include <string> 
#include <iosfwd> 
 
 
namespace Poco { 
namespace XML { 
 
 
class XML_API QName 
	/// This class represents a qualified XML name in the stream parser. 
	/// 
	/// Note that the optional prefix is just a "syntactic sugar". In 
	/// particular, it is ignored by the comparison operators and the 
	/// std::ostream insertion operator. 
{ 
public: 
	QName(); 
	QName(const std::string& name); 
	QName(const std::string& ns, const std::string& name); 
	QName(const std::string& ns, const std::string& name, const std::string& prefix); 
 
	const std::string& namespaceURI() const; 
		/// Returns the namespace URI part of the name. 
 
	const std::string& localName() const; 
		/// Returns the local part of the name. 
		 
	const std::string& prefix() const; 
		/// Returns the namespace prefix of the name. 
		 
	std::string& namespaceURI(); 
		/// Returns the namespace URI part of the name. 
 
	std::string& localName(); 
		/// Returns the local part of the name. 
 
	std::string& prefix(); 
		/// Returns the namespace prefix of the name. 
 
	std::string toString() const; 
		/// Returns a printable representation in the [<namespace>#]<name> form. 
	 
public: 
	friend bool operator < (const QName& x, const QName& y) 
	{ 
		return x._ns < y._ns || (x._ns == y._ns && x._name < y._name); 
	} 
 
	friend bool operator == (const QName& x, const QName& y) 
	{ 
		return x._ns == y._ns && x._name == y._name; 
	} 
 
	friend bool operator != (const QName& x, const QName& y) 
	{ 
		return !(x == y); 
	} 
 
private: 
	std::string _ns; 
	std::string _name; 
	std::string _prefix; 
}; 
 
 
// 
// inlines 
// 
inline const std::string& QName::namespaceURI() const 
{ 
	return _ns; 
} 
 
 
inline const std::string& QName::localName() const 
{ 
	return _name; 
} 
 
 
inline const std::string& QName::prefix() const 
{ 
	return _prefix; 
} 
 
 
inline std::string& QName::namespaceURI() 
{ 
	return _ns; 
} 
 
 
inline std::string& QName::localName() 
{ 
	return _name; 
} 
 
 
inline std::string& QName::prefix() 
{ 
	return _prefix; 
} 
 
 
XML_API std::ostream& operator << (std::ostream&, const QName&); 
 
 
} } // namespace Poco::XML 
 
 
#endif // XML_QName_INCLUDED