aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/poco/XML/src/QName.cpp
blob: 276b1c3fc471c9b43c5b33e4f996219039180625 (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
//
// QName.cpp
//
// Library: XML
// Package: XML
// Module:  QName
//
// 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
//


#include "Poco/XML/QName.h"
#include <ostream>


namespace Poco {
namespace XML {


QName::QName()
{
}


QName::QName(const std::string& name) :
	_name(name)
{
}


QName::QName(const std::string& ns, const std::string& name) :
	_ns(ns),
	_name(name)
{
}


QName::QName(const std::string& ns, const std::string& name, const std::string& prefix) :
	_ns(ns),
	_name(name),
	_prefix(prefix)
{
}


std::string QName::toString() const
{
	std::string r;
	if (!_ns.empty())
	{
		r += _ns;
		r += '#';
	}

	r += _name;
	return r;
}


std::ostream& operator << (std::ostream& os, const QName& qn)
{
	return os << qn.toString();
}


} } // namespace Poco::XML