2013-02-02 21:52:49 +01:00
|
|
|
//
|
|
|
|
// Binary.cpp
|
|
|
|
//
|
|
|
|
// $Id$
|
|
|
|
//
|
|
|
|
// Library: MongoDB
|
|
|
|
// Package: MongoDB
|
|
|
|
// Module: Binary
|
|
|
|
//
|
|
|
|
// Implementation of the Binary class.
|
|
|
|
//
|
|
|
|
// Copyright (c) 2012, Applied Informatics Software Engineering GmbH.
|
|
|
|
// and Contributors.
|
|
|
|
//
|
2014-05-04 21:02:42 +02:00
|
|
|
// SPDX-License-Identifier: BSL-1.0
|
2013-02-02 21:52:49 +01:00
|
|
|
//
|
|
|
|
|
2013-03-17 19:34:36 +01:00
|
|
|
|
2013-02-02 21:52:49 +01:00
|
|
|
#include "Poco/MongoDB/Binary.h"
|
|
|
|
|
2013-03-17 19:34:36 +01:00
|
|
|
|
2013-02-13 19:10:57 +01:00
|
|
|
namespace Poco {
|
|
|
|
namespace MongoDB {
|
2013-02-02 21:52:49 +01:00
|
|
|
|
|
|
|
|
|
|
|
Binary::Binary() : _buffer(0)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Binary::Binary(Poco::Int32 size, unsigned char subtype) : _buffer(size), _subtype(subtype)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-02-13 19:10:57 +01:00
|
|
|
|
2013-02-02 21:52:49 +01:00
|
|
|
Binary::~Binary()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-02-13 19:10:57 +01:00
|
|
|
|
2013-02-15 22:32:24 +01:00
|
|
|
std::string Binary::toString(int indent) const
|
2013-02-02 21:52:49 +01:00
|
|
|
{
|
2013-02-13 19:10:57 +01:00
|
|
|
std::ostringstream oss;
|
|
|
|
Base64Encoder encoder(oss);
|
|
|
|
MemoryInputStream mis((const char*) _buffer.begin(), _buffer.size());
|
|
|
|
StreamCopier::copyStream(mis, encoder);
|
|
|
|
return oss.str();
|
2013-02-02 21:52:49 +01:00
|
|
|
}
|
|
|
|
|
2013-02-13 19:10:57 +01:00
|
|
|
|
2013-03-12 04:49:54 +01:00
|
|
|
} } // namespace Poco::MongoDB
|