mirror of
https://github.com/jezhiggins/arabica
synced 2024-12-27 21:58:30 +01:00
2fd1f52ace
started qnmae refactoring
66 lines
1.5 KiB
C++
66 lines
1.5 KiB
C++
#ifndef ARABICA_XML_QNAME_HPP
|
|
#define ARABICA_XML_QNAME_HPP
|
|
|
|
|
|
class QualifiedName
|
|
{
|
|
public:
|
|
QualifiedName(const std::string& localName) :
|
|
prefix_(),
|
|
localName_(localName),
|
|
namespaceUri_()
|
|
{
|
|
} // QualifiedName
|
|
|
|
QualifiedName(const std::string& prefix,
|
|
const std::string& localName,
|
|
const std::string& namespaceUri) :
|
|
prefix_(prefix),
|
|
localName_(localName),
|
|
namespaceUri_(namespaceUri)
|
|
{
|
|
} // QualifiedName
|
|
|
|
QualifiedName(const QualifiedName& rhs) :
|
|
prefix_(rhs.prefix_),
|
|
localName_(rhs.localName_),
|
|
namespaceUri_(rhs.namespaceUri_)
|
|
{
|
|
} // QualifiedName
|
|
|
|
QualifiedName& operator=(const QualifiedName& rhs)
|
|
{
|
|
QualifiedName qn(rhs);
|
|
std::swap(prefix_, qn.prefix_);
|
|
std::swap(localName_, qn.localName_);
|
|
std::swap(namespaceUri_, qn.namespaceUri_);
|
|
return *this;
|
|
} // operator=
|
|
|
|
bool operator==(const QualifiedName& rhs) const
|
|
{
|
|
return (localName_ == rhs.localName_) &&
|
|
(namespaceUri_ == rhs.namespaceUri_);
|
|
} // operator==
|
|
|
|
bool operator!=(const QualifiedName& rhs) const
|
|
{
|
|
return !(operator==(rhs));
|
|
} // operator!=
|
|
|
|
std::string clarkName() const
|
|
{
|
|
if(namespaceUri_.length() == 0)
|
|
return localName_;
|
|
return "{" + namespaceUri_ + "}" + localName_;
|
|
} // clarkName
|
|
|
|
private:
|
|
std::string prefix_;
|
|
std::string localName_;
|
|
std::string namespaceUri_;
|
|
|
|
QualifiedName();
|
|
}; // class QualifiedName
|
|
|
|
#endif
|