From 09028eea155188068eda8d39cd464d4338744b9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnter=20Obiltschnig?= Date: Sat, 25 Jan 2020 14:29:54 +0100 Subject: [PATCH] C++1x-ification --- MongoDB/include/Poco/MongoDB/Array.h | 2 +- MongoDB/include/Poco/MongoDB/Binary.h | 12 ++++++------ MongoDB/include/Poco/MongoDB/Connection.h | 2 +- MongoDB/include/Poco/MongoDB/Document.h | 6 +++--- MongoDB/include/Poco/MongoDB/Element.h | 16 ++++++++-------- MongoDB/include/Poco/MongoDB/JavaScriptCode.h | 2 +- MongoDB/include/Poco/MongoDB/ObjectId.h | 10 +++++----- MongoDB/include/Poco/MongoDB/RegularExpression.h | 2 +- 8 files changed, 26 insertions(+), 26 deletions(-) diff --git a/MongoDB/include/Poco/MongoDB/Array.h b/MongoDB/include/Poco/MongoDB/Array.h index ee306bb01..55e262840 100644 --- a/MongoDB/include/Poco/MongoDB/Array.h +++ b/MongoDB/include/Poco/MongoDB/Array.h @@ -31,7 +31,7 @@ class MongoDB_API Array: public Document /// This class represents a BSON Array. { public: - typedef SharedPtr Ptr; + using Ptr = SharedPtr; Array(); /// Creates an empty Array. diff --git a/MongoDB/include/Poco/MongoDB/Binary.h b/MongoDB/include/Poco/MongoDB/Binary.h index 02b6baf1b..5e9eb58f2 100644 --- a/MongoDB/include/Poco/MongoDB/Binary.h +++ b/MongoDB/include/Poco/MongoDB/Binary.h @@ -38,7 +38,7 @@ class MongoDB_API Binary /// A Binary stores its data in a Poco::Buffer. { public: - typedef SharedPtr Ptr; + using Ptr = SharedPtr; Binary(); /// Creates an empty Binary with subtype 0. @@ -48,12 +48,12 @@ public: Binary(const UUID& uuid); /// Creates a Binary containing an UUID. - + Binary(const std::string& data, unsigned char subtype = 0); /// Creates a Binary with the contents of the given string and the given subtype. - + Binary(const void* data, Poco::Int32 size, unsigned char subtype = 0); - /// Creates a Binary with the contents of the given buffer and the given subtype. + /// Creates a Binary with the contents of the given buffer and the given subtype. virtual ~Binary(); /// Destroys the Binary. @@ -69,7 +69,7 @@ public: std::string toString(int indent = 0) const; /// Returns the contents of the Binary as Base64-encoded string. - + std::string toRawString() const; /// Returns the raw content of the Binary as a string. @@ -135,7 +135,7 @@ inline void BSONReader::read(Binary::Ptr& to) unsigned char subtype; _reader >> subtype; to->subtype(subtype); - + _reader.readRaw((char*) to->buffer().begin(), size); } diff --git a/MongoDB/include/Poco/MongoDB/Connection.h b/MongoDB/include/Poco/MongoDB/Connection.h index 202ae9071..870be2a7c 100644 --- a/MongoDB/include/Poco/MongoDB/Connection.h +++ b/MongoDB/include/Poco/MongoDB/Connection.h @@ -37,7 +37,7 @@ class MongoDB_API Connection /// for more information on the wire protocol. { public: - typedef Poco::SharedPtr Ptr; + using Ptr = Poco::SharedPtr; class MongoDB_API SocketFactory { diff --git a/MongoDB/include/Poco/MongoDB/Document.h b/MongoDB/include/Poco/MongoDB/Document.h index 674a1f789..5be1a33c8 100644 --- a/MongoDB/include/Poco/MongoDB/Document.h +++ b/MongoDB/include/Poco/MongoDB/Document.h @@ -33,7 +33,7 @@ namespace MongoDB { class ElementFindByName { public: - ElementFindByName(const std::string& name): + ElementFindByName(const std::string& name): _name(name) { } @@ -52,8 +52,8 @@ class MongoDB_API Document /// Represents a MongoDB (BSON) document. { public: - typedef SharedPtr Ptr; - typedef std::vector Vector; + using Ptr = SharedPtr; + using Vector = std::vector; Document(); /// Creates an empty Document. diff --git a/MongoDB/include/Poco/MongoDB/Element.h b/MongoDB/include/Poco/MongoDB/Element.h index e6a41c401..47a9fae7e 100644 --- a/MongoDB/include/Poco/MongoDB/Element.h +++ b/MongoDB/include/Poco/MongoDB/Element.h @@ -43,7 +43,7 @@ class MongoDB_API Element /// Represents an Element of a Document or an Array. { public: - typedef Poco::SharedPtr Ptr; + using Ptr = Poco::SharedPtr; explicit Element(const std::string& name); /// Creates the Element with the given name. @@ -78,10 +78,10 @@ inline const std::string& Element::name() const } -typedef std::list ElementSet; +using ElementSet = std::list; -template +template struct ElementTraits { }; @@ -259,7 +259,7 @@ inline void BSONWriter::write(Timestamp& from) } -typedef Nullable NullValue; +using NullValue = Nullable; // BSON Null Value @@ -288,7 +288,7 @@ inline void BSONWriter::write(NullValue& from) } -struct BSONTimestamp +struct BSONTimestamp { Poco::Timestamp ts; Poco::Int32 inc; @@ -355,7 +355,7 @@ class ConcreteElement: public Element { public: ConcreteElement(const std::string& name, const T& init): - Element(name), + Element(name), _value(init) { } @@ -364,7 +364,7 @@ public: { } - + T value() const { return _value; @@ -376,7 +376,7 @@ public: return ElementTraits::toString(_value, indent); } - + int type() const { return ElementTraits::TypeId; diff --git a/MongoDB/include/Poco/MongoDB/JavaScriptCode.h b/MongoDB/include/Poco/MongoDB/JavaScriptCode.h index 6401743b8..3ec98354a 100644 --- a/MongoDB/include/Poco/MongoDB/JavaScriptCode.h +++ b/MongoDB/include/Poco/MongoDB/JavaScriptCode.h @@ -33,7 +33,7 @@ class MongoDB_API JavaScriptCode /// Represents JavaScript type in BSON. { public: - typedef SharedPtr Ptr; + using Ptr = SharedPtr; JavaScriptCode(); /// Creates an empty JavaScriptCode object. diff --git a/MongoDB/include/Poco/MongoDB/ObjectId.h b/MongoDB/include/Poco/MongoDB/ObjectId.h index 659047c95..d67581946 100644 --- a/MongoDB/include/Poco/MongoDB/ObjectId.h +++ b/MongoDB/include/Poco/MongoDB/ObjectId.h @@ -42,10 +42,10 @@ class MongoDB_API ObjectId /// as its value. { public: - typedef SharedPtr Ptr; + using Ptr = SharedPtr; explicit ObjectId(const std::string& id); - /// Creates an ObjectId from a string. + /// Creates an ObjectId from a string. /// /// The string must contain a hexadecimal representation /// of an object ID. This means a string of 24 characters. @@ -61,15 +61,15 @@ public: std::string toString(const std::string& fmt = "%02x") const; /// Returns the id in string format. The fmt parameter - /// specifies the formatting used for individual members + /// specifies the formatting used for individual members /// of the ID char array. private: ObjectId(); - static int fromHex(char c); + static int fromHex(char c); static char fromHex(const char* c); - + unsigned char _id[12]; friend class BSONWriter; diff --git a/MongoDB/include/Poco/MongoDB/RegularExpression.h b/MongoDB/include/Poco/MongoDB/RegularExpression.h index 49ef3b00b..a30d7bde7 100644 --- a/MongoDB/include/Poco/MongoDB/RegularExpression.h +++ b/MongoDB/include/Poco/MongoDB/RegularExpression.h @@ -31,7 +31,7 @@ class MongoDB_API RegularExpression /// Represents a regular expression in BSON format. { public: - typedef SharedPtr Ptr; + using Ptr = SharedPtr; RegularExpression(); /// Creates an empty RegularExpression.