mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-26 02:18:04 +01:00
only style changes
This commit is contained in:
@@ -35,15 +35,19 @@
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#ifndef MongoDB_BSONReader_INCLUDED
|
||||
#define MongoDB_BSONReader_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/MongoDB/MongoDB.h"
|
||||
#include "Poco/BinaryReader.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace MongoDB {
|
||||
|
||||
|
||||
class MongoDB_API BSONReader
|
||||
/// Class for reading BSON from a Poco::BinaryReader
|
||||
{
|
||||
@@ -85,14 +89,8 @@ inline std::string BSONReader::readCString()
|
||||
_reader >> c;
|
||||
if ( _reader.good() )
|
||||
{
|
||||
if (c == 0x00)
|
||||
{
|
||||
return val;
|
||||
}
|
||||
else
|
||||
{
|
||||
val += c;
|
||||
}
|
||||
if (c == 0x00) return val;
|
||||
else val += c;
|
||||
}
|
||||
}
|
||||
return val;
|
||||
|
||||
@@ -35,12 +35,15 @@
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#ifndef MongoDB_BSONWriter_INCLUDED
|
||||
#define MongoDB_BSONWriter_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/MongoDB/MongoDB.h"
|
||||
#include "Poco/BinaryWriter.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace MongoDB {
|
||||
|
||||
@@ -82,6 +85,7 @@ inline void BSONWriter::writeCString(const std::string& value)
|
||||
_writer << (unsigned char) 0x00;
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::MongoDB
|
||||
|
||||
|
||||
|
||||
@@ -35,21 +35,24 @@
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#ifndef MongoDB_Binary_INCLUDED
|
||||
#define MongoDB_Binary_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/MongoDB/MongoDB.h"
|
||||
#include "Poco/MongoDB/Element.h"
|
||||
#include "Poco/Base64Encoder.h"
|
||||
#include "Poco/Buffer.h"
|
||||
#include "Poco/StreamCopier.h"
|
||||
#include "Poco/MemoryStream.h"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace MongoDB {
|
||||
|
||||
|
||||
class MongoDB_API Binary
|
||||
/// Implements BSON Binary. It's a wrapper around a Poco::Buffer<unsigned char>.
|
||||
{
|
||||
@@ -130,6 +133,7 @@ inline void BSONReader::read<Binary::Ptr>(Binary::Ptr& to)
|
||||
_reader.readRaw((char*) to->buffer().begin(), size);
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
inline void BSONWriter::write<Binary::Ptr>(Binary::Ptr& from)
|
||||
{
|
||||
@@ -140,4 +144,5 @@ inline void BSONWriter::write<Binary::Ptr>(Binary::Ptr& from)
|
||||
|
||||
} } // namespace Poco::MongoDB
|
||||
|
||||
|
||||
#endif // MongoDB_Binary_INCLUDED
|
||||
|
||||
@@ -90,7 +90,14 @@ public:
|
||||
Poco::SharedPtr<Poco::MongoDB::UpdateRequest> createUpdateRequest(const std::string& collectionName) const;
|
||||
/// Creates an UpdateRequest. The collectionname must not contain the database name!
|
||||
|
||||
Poco::MongoDB::Document::Ptr ensureIndex(Connection& connection, const std::string& collection, const std::string& indexName, Poco::MongoDB::Document::Ptr keys, bool unique = false, bool background = false, int version = 0, int ttl = 0);
|
||||
Poco::MongoDB::Document::Ptr ensureIndex(Connection& connection,
|
||||
const std::string& collection,
|
||||
const std::string& indexName,
|
||||
Poco::MongoDB::Document::Ptr keys,
|
||||
bool unique = false,
|
||||
bool background = false,
|
||||
int version = 0,
|
||||
int ttl = 0);
|
||||
/// Creates an index. The document returned is the result of a getLastError call.
|
||||
/// For more info look at the ensureIndex information on the MongoDB website.
|
||||
|
||||
@@ -114,25 +121,29 @@ inline Poco::SharedPtr<Poco::MongoDB::QueryRequest> Database::createCommand() co
|
||||
}
|
||||
|
||||
|
||||
inline Poco::SharedPtr<Poco::MongoDB::DeleteRequest> Database::createDeleteRequest(const std::string& collectionName) const
|
||||
inline Poco::SharedPtr<Poco::MongoDB::DeleteRequest>
|
||||
Database::createDeleteRequest(const std::string& collectionName) const
|
||||
{
|
||||
return new Poco::MongoDB::DeleteRequest(_dbname + '.' + collectionName);
|
||||
}
|
||||
|
||||
|
||||
inline Poco::SharedPtr<Poco::MongoDB::InsertRequest> Database::createInsertRequest(const std::string& collectionName) const
|
||||
inline Poco::SharedPtr<Poco::MongoDB::InsertRequest>
|
||||
Database::createInsertRequest(const std::string& collectionName) const
|
||||
{
|
||||
return new Poco::MongoDB::InsertRequest(_dbname + '.' + collectionName);
|
||||
}
|
||||
|
||||
|
||||
inline Poco::SharedPtr<Poco::MongoDB::QueryRequest> Database::createQueryRequest(const std::string& collectionName) const
|
||||
inline Poco::SharedPtr<Poco::MongoDB::QueryRequest>
|
||||
Database::createQueryRequest(const std::string& collectionName) const
|
||||
{
|
||||
return new Poco::MongoDB::QueryRequest(_dbname + '.' + collectionName);
|
||||
}
|
||||
|
||||
|
||||
inline Poco::SharedPtr<Poco::MongoDB::UpdateRequest> Database::createUpdateRequest(const std::string& collectionName) const
|
||||
inline Poco::SharedPtr<Poco::MongoDB::UpdateRequest>
|
||||
Database::createUpdateRequest(const std::string& collectionName) const
|
||||
{
|
||||
return new Poco::MongoDB::UpdateRequest(_dbname + '.' + collectionName);
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ protected:
|
||||
private:
|
||||
Flags _flags;
|
||||
std::string _fullCollectionName;
|
||||
Document _selector;
|
||||
Document _selector;
|
||||
};
|
||||
|
||||
|
||||
@@ -119,6 +119,7 @@ inline Document& DeleteRequest::selector()
|
||||
return _selector;
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::MongoDB
|
||||
|
||||
|
||||
|
||||
@@ -67,6 +67,7 @@ private:
|
||||
std::string _name;
|
||||
};
|
||||
|
||||
|
||||
class MongoDB_API Document
|
||||
/// Represents a BSON document
|
||||
{
|
||||
@@ -270,6 +271,7 @@ inline void BSONReader::read<Document::Ptr>(Document::Ptr& to)
|
||||
to->read(_reader);
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
inline void BSONWriter::write<Document::Ptr>(Document::Ptr& from)
|
||||
{
|
||||
|
||||
@@ -35,13 +35,10 @@
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#ifndef MongoDB_Element_INCLUDED
|
||||
#define MongoDB_Element_INCLUDED
|
||||
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
#include <set>
|
||||
|
||||
#include "Poco/BinaryReader.h"
|
||||
#include "Poco/BinaryWriter.h"
|
||||
@@ -53,6 +50,11 @@
|
||||
#include "Poco/MongoDB/MongoDB.h"
|
||||
#include "Poco/MongoDB/BSONReader.h"
|
||||
#include "Poco/MongoDB/BSONWriter.h"
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
#include <set>
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace MongoDB {
|
||||
@@ -129,7 +131,7 @@ struct ElementTraits<double>
|
||||
|
||||
// BSON UTF-8 string
|
||||
// spec: int32 (byte*) "\x00"
|
||||
// int32 is the number bytes in byte* + 1 (for trailing "\x00"
|
||||
// int32 is the number bytes in byte* + 1 (for trailing "\x00")
|
||||
template<>
|
||||
struct ElementTraits<std::string>
|
||||
{
|
||||
@@ -226,6 +228,7 @@ inline void BSONReader::read<bool>(bool& to)
|
||||
to = b != 0;
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
inline void BSONWriter::write<bool>(bool& from)
|
||||
{
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#ifndef MongoDB_GetMoreRequest_INCLUDED
|
||||
#define MongoDB_GetMoreRequest_INCLUDED
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#ifndef MongoDB_KillCursorsRequest_INCLUDED
|
||||
#define MongoDB_KillCursorsRequest_INCLUDED
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#ifndef MongoDB_Message_INCLUDED
|
||||
#define MongoDB_Message_INCLUDED
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#ifndef MongoDB_MessageHeader_INCLUDED
|
||||
#define MongoDB_MessageHeader_INCLUDED
|
||||
|
||||
@@ -43,9 +44,6 @@
|
||||
#include "Poco/MongoDB/MessageHeader.h"
|
||||
|
||||
|
||||
#define MSG_HEADER_SIZE 16
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace MongoDB {
|
||||
|
||||
@@ -55,6 +53,8 @@ class MongoDB_API MessageHeader
|
||||
/// or response of MongoDB
|
||||
{
|
||||
public:
|
||||
static const unsigned int MSG_HEADER_SIZE = 16;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
Reply = 1
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#ifndef MongoDB_ObjectId_INCLUDED
|
||||
#define MongoDB_ObjectId_INCLUDED
|
||||
|
||||
@@ -47,6 +48,7 @@
|
||||
namespace Poco {
|
||||
namespace MongoDB {
|
||||
|
||||
|
||||
class MongoDB_API ObjectId
|
||||
/// ObjectId is a 12-byte BSON type, constructed using:
|
||||
///
|
||||
|
||||
@@ -119,6 +119,7 @@ inline bool ResponseMessage::hasDocuments() const
|
||||
return _documents.size() > 0;
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::MongoDB
|
||||
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ public:
|
||||
|
||||
void flags(Flags flags);
|
||||
/// Sets the flags
|
||||
|
||||
|
||||
protected:
|
||||
void buildRequest(BinaryWriter& writer);
|
||||
|
||||
@@ -124,4 +124,5 @@ inline Document& UpdateRequest::update()
|
||||
|
||||
} } // namespace Poco::MongoDB
|
||||
|
||||
|
||||
#endif //MongoDB_UpdateRequest_INCLUDED
|
||||
|
||||
Reference in New Issue
Block a user