mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-29 12:18:01 +01:00
Add UUID support
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
#include "Poco/Buffer.h"
|
||||
#include "Poco/StreamCopier.h"
|
||||
#include "Poco/MemoryStream.h"
|
||||
#include "Poco/UUID.h"
|
||||
#include <sstream>
|
||||
|
||||
|
||||
@@ -45,6 +46,9 @@ public:
|
||||
Binary(Poco::Int32 size, unsigned char subtype);
|
||||
/// Constructor
|
||||
|
||||
Binary(const UUID& uuid);
|
||||
/// Constructor for setting a UUID in a binary element
|
||||
|
||||
virtual ~Binary();
|
||||
/// Destructor
|
||||
|
||||
@@ -60,6 +64,10 @@ public:
|
||||
std::string toString(int indent = 0) const;
|
||||
/// Returns the binary encoded in Base64
|
||||
|
||||
UUID uuid() const;
|
||||
/// Returns the UUID when the binary subtype is 0x04.
|
||||
/// Otherwise BadCastException will be thrown
|
||||
|
||||
private:
|
||||
Buffer<unsigned char> _buffer;
|
||||
unsigned char _subtype;
|
||||
@@ -109,7 +117,7 @@ inline void BSONReader::read<Binary::Ptr>(Binary::Ptr& to)
|
||||
unsigned char subtype;
|
||||
_reader >> subtype;
|
||||
to->subtype(subtype);
|
||||
|
||||
|
||||
_reader.readRaw((char*) to->buffer().begin(), size);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user