merge some changes from develop branch; modernize and clean-up code; remove support for compiling without POCO_WIN32_UTF8

This commit is contained in:
Günter Obiltschnig
2020-01-09 10:08:09 +01:00
parent 7c177b6f89
commit 1bf40a0cd2
389 changed files with 3029 additions and 4111 deletions

View File

@@ -65,15 +65,15 @@ public:
DOMException(const DOMException& exc);
/// Creates a DOMException by copying another one.
~DOMException() throw();
~DOMException() noexcept;
/// Destroys the DOMException.
DOMException& operator = (const DOMException& exc);
const char* name() const throw();
const char* name() const noexcept;
/// Returns a static string describing the exception.
const char* className() const throw();
const char* className() const noexcept;
/// Returns the name of the exception class.
Poco::Exception* clone() const;

View File

@@ -58,7 +58,7 @@ class XML_API Document: public AbstractContainerNode, public DocumentEvent
/// context they were created.
{
public:
typedef Poco::AutoReleasePool<DOMObject> AutoReleasePool;
using AutoReleasePool = Poco::AutoReleasePool<DOMObject>;
explicit Document(NamePool* pNamePool = 0);
/// Creates a new document. If pNamePool == 0, the document

View File

@@ -44,15 +44,15 @@ public:
EventException(const EventException& exc);
/// Creates an EventException by copying another one.
~EventException() throw();
~EventException() noexcept;
/// Destroys the EventException.
EventException& operator = (const EventException& exc);
const char* name() const throw();
const char* name() const noexcept;
/// Returns a static string describing the exception.
const char* className() const throw();
const char* className() const noexcept;
/// Returns the name of the exception class.
unsigned short code() const;

View File

@@ -208,7 +208,7 @@ public:
/// Returns whether this node (if it is an element) has any attributes.
// Extensions
typedef Poco::XML::NamespaceSupport NSMap;
using NSMap = Poco::XML::NamespaceSupport;
virtual XMLString innerText() const = 0;
/// Returns a string containing the concatenated values of the node

View File

@@ -45,8 +45,8 @@ public:
XMLString type;
bool specified;
};
typedef std::vector<Attribute> AttributeVec;
typedef AttributeVec::const_iterator iterator;
using AttributeVec = std::vector<Attribute>;
using iterator = AttributeVec::const_iterator;
AttributesImpl();
/// Creates the AttributesImpl.
@@ -57,12 +57,18 @@ public:
AttributesImpl(const AttributesImpl& attributes);
/// Creates the AttributesImpl by copying another one.
AttributesImpl(AttributesImpl&& attributes) noexcept;
/// Creates the AttributesImpl by copying another one.
~AttributesImpl();
/// Destroys the AttributesImpl.
AttributesImpl& operator = (const AttributesImpl& attributes);
/// Assignment operator.
AttributesImpl& operator = (AttributesImpl&& attributes) noexcept;
/// Assignment operator.
int getIndex(const XMLString& name) const;
int getIndex(const XMLString& namespaceURI, const XMLString& localName) const;
int getLength() const;
@@ -154,9 +160,14 @@ protected:
Attribute* find(const XMLString& qname) const;
Attribute* find(const XMLString& namespaceURI, const XMLString& localName) const;
struct EmptyAttribute: Attribute
{
EmptyAttribute();
};
private:
AttributeVec _attributes;
Attribute _empty;
static EmptyAttribute _empty;
};

View File

@@ -40,7 +40,7 @@ class XML_API NamespaceSupport
/// must be invoked between each session.
{
public:
typedef std::set<XMLString> PrefixSet;
using PrefixSet = std::set<XMLString>;
NamespaceSupport();
/// Creates a NamespaceSupport object.

View File

@@ -98,16 +98,16 @@ public:
SAXParseException(const SAXParseException& exc);
/// Creates a new SAXParseException from another one.
~SAXParseException() throw();
~SAXParseException() noexcept;
/// Destroy the exception.
SAXParseException& operator = (const SAXParseException& exc);
/// Assignment operator.
const char* name() const throw();
const char* name() const noexcept;
/// Returns a static string describing the exception.
const char* className() const throw();
const char* className() const noexcept;
/// Returns the name of the exception class.
Poco::Exception* clone() const;

View File

@@ -46,12 +46,18 @@ public:
Name(const Name& name);
/// Copy constructor.
Name(Name&& name) noexcept;
/// Move constructor.
~Name();
/// Destroys the name.
Name& operator = (const Name& name);
/// Assignment operator.
Name& operator = (Name&& name) noexcept;
/// Move assignment.
void swap(Name& name);
/// Swaps the name with another one.

View File

@@ -42,6 +42,12 @@ public:
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);
QName(const QName& qname);
QName(QName&& qname) noexcept;
QName& operator = (const QName& qname);
QName& operator = (QName&& qname) noexcept;
void swap(QName& qname);
const std::string& namespaceURI() const;
/// Returns the namespace URI part of the name.

View File

@@ -28,8 +28,8 @@ namespace XML {
// The byte input stream is always a narrow stream.
typedef std::istream XMLByteInputStream;
typedef std::ostream XMLByteOutputStream;
using XMLByteInputStream = std::istream;
using XMLByteOutputStream = std::ostream;
//
@@ -49,8 +49,8 @@ typedef std::ostream XMLByteOutputStream;
#if defined(XML_UNICODE_WCHAR_T)
// Unicode - use wide streams
typedef std::wistream XMLCharInputStream;
typedef std::wostream XMLCharOutputStream;
using XMLCharInputStream = std::wistream;
using XMLCharOutputStream = std::wostream;
#elif defined(XML_UNICODE)
@@ -59,8 +59,8 @@ typedef std::ostream XMLByteOutputStream;
#else
// Characters are UTF-8 encoded
typedef std::istream XMLCharInputStream;
typedef std::ostream XMLCharOutputStream;
using XMLCharInputStream = std::istream;
using XMLCharOutputStream = std::ostream;
#endif

View File

@@ -105,7 +105,7 @@ public:
EV_EOF
};
typedef unsigned short FeatureType;
using FeatureType = unsigned short;
/// If both receive_attributes_event and RECEIVE_ATTRIBUTE_MAP are
/// specified, then RECEIVE_ATTRIBUTES_EVENT is assumed.
@@ -116,20 +116,20 @@ public:
static const FeatureType RECEIVE_NAMESPACE_DECLS = 0x0010;
static const FeatureType RECEIVE_DEFAULT = RECEIVE_ELEMENTS | RECEIVE_CHARACTERS | RECEIVE_ATTRIBUTE_MAP;
struct XML_API AttributeValueType
struct AttributeValueType
{
std::string value;
mutable bool handled;
};
typedef std::map<QName, AttributeValueType> AttributeMapType;
using AttributeMapType = std::map<QName, AttributeValueType>;
struct XML_API Iterator
// C++11 range-based for support. Generally, the iterator interface
// doesn't make much sense for the XMLStreamParser so for now we have an
// implementation that is just enough to the range-based for.
{
typedef EventType value_type;
using value_type = EventType;
Iterator(XMLStreamParser* p = 0, EventType e = EV_EOF):
_parser(p),
@@ -575,7 +575,7 @@ inline void XMLStreamParser::content(Content c)
if (!_elementState.empty() && _elementState.back().depth == _depth)
_elementState.back().content = c;
else
_elementState.push_back(ElementEntry(_depth, c));
_elementState.emplace_back(_depth, c);
}

View File

@@ -35,7 +35,7 @@ public:
XMLStreamParserException(const XMLStreamParser&, const std::string& description);
virtual ~XMLStreamParserException() throw ();
const char* name() const throw();
const char* name() const noexcept;
Poco::UInt64 line() const;
Poco::UInt64 column() const;
const std::string& description() const;

View File

@@ -43,8 +43,8 @@ namespace XML {
#if defined(XML_UNICODE_WCHAR_T)
// Unicode - use wchar_t
typedef wchar_t XMLChar;
typedef std::wstring XMLString;
using XMLChar = wchar_t;
using XMLString = std::wstring;
std::string fromXMLString(const XMLString& str);
/// Converts an XMLString into an UTF-8 encoded
@@ -63,8 +63,8 @@ namespace XML {
#else
// Characters are UTF-8 encoded
typedef char XMLChar;
typedef std::string XMLString;
using XMLChar = char;
using XMLString = std::string;
inline const std::string& fromXMLString(const XMLString& str)
{

View File

@@ -280,7 +280,7 @@ public:
protected:
typedef std::map<XMLString, XMLString> AttributeMap;
typedef std::map<XMLString, std::pair<XMLString, XMLString> > CanonicalAttributeMap;
typedef std::map<XMLString, std::pair<XMLString, XMLString>> CanonicalAttributeMap;
void writeStartElement(const XMLString& namespaceURI, const XMLString& localName, const XMLString& qname, const Attributes& attributes);
void writeCanonicalStartElement(const XMLString& namespaceURI, const XMLString& localName, const XMLString& qname, const Attributes& attributes);