C++1x-ification

This commit is contained in:
Günter Obiltschnig 2020-01-25 14:29:54 +01:00
parent 850f22b098
commit 09028eea15
8 changed files with 26 additions and 26 deletions

View File

@ -31,7 +31,7 @@ class MongoDB_API Array: public Document
/// This class represents a BSON Array. /// This class represents a BSON Array.
{ {
public: public:
typedef SharedPtr<Array> Ptr; using Ptr = SharedPtr<Array>;
Array(); Array();
/// Creates an empty Array. /// Creates an empty Array.

View File

@ -38,7 +38,7 @@ class MongoDB_API Binary
/// A Binary stores its data in a Poco::Buffer<unsigned char>. /// A Binary stores its data in a Poco::Buffer<unsigned char>.
{ {
public: public:
typedef SharedPtr<Binary> Ptr; using Ptr = SharedPtr<Binary>;
Binary(); Binary();
/// Creates an empty Binary with subtype 0. /// Creates an empty Binary with subtype 0.
@ -48,12 +48,12 @@ public:
Binary(const UUID& uuid); Binary(const UUID& uuid);
/// Creates a Binary containing an UUID. /// Creates a Binary containing an UUID.
Binary(const std::string& data, unsigned char subtype = 0); Binary(const std::string& data, unsigned char subtype = 0);
/// Creates a Binary with the contents of the given string and the given subtype. /// 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); 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(); virtual ~Binary();
/// Destroys the Binary. /// Destroys the Binary.
@ -69,7 +69,7 @@ public:
std::string toString(int indent = 0) const; std::string toString(int indent = 0) const;
/// Returns the contents of the Binary as Base64-encoded string. /// Returns the contents of the Binary as Base64-encoded string.
std::string toRawString() const; std::string toRawString() const;
/// Returns the raw content of the Binary as a string. /// Returns the raw content of the Binary as a string.
@ -135,7 +135,7 @@ inline void BSONReader::read<Binary::Ptr>(Binary::Ptr& to)
unsigned char subtype; unsigned char subtype;
_reader >> subtype; _reader >> subtype;
to->subtype(subtype); to->subtype(subtype);
_reader.readRaw((char*) to->buffer().begin(), size); _reader.readRaw((char*) to->buffer().begin(), size);
} }

View File

@ -37,7 +37,7 @@ class MongoDB_API Connection
/// for more information on the wire protocol. /// for more information on the wire protocol.
{ {
public: public:
typedef Poco::SharedPtr<Connection> Ptr; using Ptr = Poco::SharedPtr<Connection>;
class MongoDB_API SocketFactory class MongoDB_API SocketFactory
{ {

View File

@ -33,7 +33,7 @@ namespace MongoDB {
class ElementFindByName class ElementFindByName
{ {
public: public:
ElementFindByName(const std::string& name): ElementFindByName(const std::string& name):
_name(name) _name(name)
{ {
} }
@ -52,8 +52,8 @@ class MongoDB_API Document
/// Represents a MongoDB (BSON) document. /// Represents a MongoDB (BSON) document.
{ {
public: public:
typedef SharedPtr<Document> Ptr; using Ptr = SharedPtr<Document>;
typedef std::vector<Document::Ptr> Vector; using Vector = std::vector<Document::Ptr>;
Document(); Document();
/// Creates an empty Document. /// Creates an empty Document.

View File

@ -43,7 +43,7 @@ class MongoDB_API Element
/// Represents an Element of a Document or an Array. /// Represents an Element of a Document or an Array.
{ {
public: public:
typedef Poco::SharedPtr<Element> Ptr; using Ptr = Poco::SharedPtr<Element>;
explicit Element(const std::string& name); explicit Element(const std::string& name);
/// Creates the Element with the given name. /// Creates the Element with the given name.
@ -78,10 +78,10 @@ inline const std::string& Element::name() const
} }
typedef std::list<Element::Ptr> ElementSet; using ElementSet = std::list<Element::Ptr>;
template<typename T> template<typename T>
struct ElementTraits struct ElementTraits
{ {
}; };
@ -259,7 +259,7 @@ inline void BSONWriter::write<Timestamp>(Timestamp& from)
} }
typedef Nullable<unsigned char> NullValue; using NullValue = Nullable<unsigned char>;
// BSON Null Value // BSON Null Value
@ -288,7 +288,7 @@ inline void BSONWriter::write<NullValue>(NullValue& from)
} }
struct BSONTimestamp struct BSONTimestamp
{ {
Poco::Timestamp ts; Poco::Timestamp ts;
Poco::Int32 inc; Poco::Int32 inc;
@ -355,7 +355,7 @@ class ConcreteElement: public Element
{ {
public: public:
ConcreteElement(const std::string& name, const T& init): ConcreteElement(const std::string& name, const T& init):
Element(name), Element(name),
_value(init) _value(init)
{ {
} }
@ -364,7 +364,7 @@ public:
{ {
} }
T value() const T value() const
{ {
return _value; return _value;
@ -376,7 +376,7 @@ public:
return ElementTraits<T>::toString(_value, indent); return ElementTraits<T>::toString(_value, indent);
} }
int type() const int type() const
{ {
return ElementTraits<T>::TypeId; return ElementTraits<T>::TypeId;

View File

@ -33,7 +33,7 @@ class MongoDB_API JavaScriptCode
/// Represents JavaScript type in BSON. /// Represents JavaScript type in BSON.
{ {
public: public:
typedef SharedPtr<JavaScriptCode> Ptr; using Ptr = SharedPtr<JavaScriptCode>;
JavaScriptCode(); JavaScriptCode();
/// Creates an empty JavaScriptCode object. /// Creates an empty JavaScriptCode object.

View File

@ -42,10 +42,10 @@ class MongoDB_API ObjectId
/// as its value. /// as its value.
{ {
public: public:
typedef SharedPtr<ObjectId> Ptr; using Ptr = SharedPtr<ObjectId>;
explicit ObjectId(const std::string& id); 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 /// The string must contain a hexadecimal representation
/// of an object ID. This means a string of 24 characters. /// 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; std::string toString(const std::string& fmt = "%02x") const;
/// Returns the id in string format. The fmt parameter /// 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. /// of the ID char array.
private: private:
ObjectId(); ObjectId();
static int fromHex(char c); static int fromHex(char c);
static char fromHex(const char* c); static char fromHex(const char* c);
unsigned char _id[12]; unsigned char _id[12];
friend class BSONWriter; friend class BSONWriter;

View File

@ -31,7 +31,7 @@ class MongoDB_API RegularExpression
/// Represents a regular expression in BSON format. /// Represents a regular expression in BSON format.
{ {
public: public:
typedef SharedPtr<RegularExpression> Ptr; using Ptr = SharedPtr<RegularExpression>;
RegularExpression(); RegularExpression();
/// Creates an empty RegularExpression. /// Creates an empty RegularExpression.