only style changes

This commit is contained in:
aleks-f
2013-03-17 13:34:36 -05:00
parent 95e713045e
commit 3d16ce00a2
35 changed files with 190 additions and 111 deletions

View File

@@ -35,15 +35,19 @@
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#ifndef MongoDB_BSONReader_INCLUDED #ifndef MongoDB_BSONReader_INCLUDED
#define MongoDB_BSONReader_INCLUDED #define MongoDB_BSONReader_INCLUDED
#include "Poco/MongoDB/MongoDB.h" #include "Poco/MongoDB/MongoDB.h"
#include "Poco/BinaryReader.h" #include "Poco/BinaryReader.h"
namespace Poco { namespace Poco {
namespace MongoDB { namespace MongoDB {
class MongoDB_API BSONReader class MongoDB_API BSONReader
/// Class for reading BSON from a Poco::BinaryReader /// Class for reading BSON from a Poco::BinaryReader
{ {
@@ -85,14 +89,8 @@ inline std::string BSONReader::readCString()
_reader >> c; _reader >> c;
if ( _reader.good() ) if ( _reader.good() )
{ {
if (c == 0x00) if (c == 0x00) return val;
{ else val += c;
return val;
}
else
{
val += c;
}
} }
} }
return val; return val;

View File

@@ -35,12 +35,15 @@
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#ifndef MongoDB_BSONWriter_INCLUDED #ifndef MongoDB_BSONWriter_INCLUDED
#define MongoDB_BSONWriter_INCLUDED #define MongoDB_BSONWriter_INCLUDED
#include "Poco/MongoDB/MongoDB.h" #include "Poco/MongoDB/MongoDB.h"
#include "Poco/BinaryWriter.h" #include "Poco/BinaryWriter.h"
namespace Poco { namespace Poco {
namespace MongoDB { namespace MongoDB {
@@ -82,6 +85,7 @@ inline void BSONWriter::writeCString(const std::string& value)
_writer << (unsigned char) 0x00; _writer << (unsigned char) 0x00;
} }
} } // namespace Poco::MongoDB } } // namespace Poco::MongoDB

View File

@@ -35,21 +35,24 @@
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#ifndef MongoDB_Binary_INCLUDED #ifndef MongoDB_Binary_INCLUDED
#define MongoDB_Binary_INCLUDED #define MongoDB_Binary_INCLUDED
#include "Poco/MongoDB/MongoDB.h" #include "Poco/MongoDB/MongoDB.h"
#include "Poco/MongoDB/Element.h" #include "Poco/MongoDB/Element.h"
#include "Poco/Base64Encoder.h" #include "Poco/Base64Encoder.h"
#include "Poco/Buffer.h" #include "Poco/Buffer.h"
#include "Poco/StreamCopier.h" #include "Poco/StreamCopier.h"
#include "Poco/MemoryStream.h" #include "Poco/MemoryStream.h"
#include <sstream> #include <sstream>
namespace Poco { namespace Poco {
namespace MongoDB { namespace MongoDB {
class MongoDB_API Binary class MongoDB_API Binary
/// Implements BSON Binary. It's a wrapper around a Poco::Buffer<unsigned char>. /// 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); _reader.readRaw((char*) to->buffer().begin(), size);
} }
template<> template<>
inline void BSONWriter::write<Binary::Ptr>(Binary::Ptr& from) 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 } } // namespace Poco::MongoDB
#endif // MongoDB_Binary_INCLUDED #endif // MongoDB_Binary_INCLUDED

View File

@@ -90,7 +90,14 @@ public:
Poco::SharedPtr<Poco::MongoDB::UpdateRequest> createUpdateRequest(const std::string& collectionName) const; Poco::SharedPtr<Poco::MongoDB::UpdateRequest> createUpdateRequest(const std::string& collectionName) const;
/// Creates an UpdateRequest. The collectionname must not contain the database name! /// 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. /// 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. /// 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); 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); 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); 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); return new Poco::MongoDB::UpdateRequest(_dbname + '.' + collectionName);
} }

View File

@@ -98,7 +98,7 @@ protected:
private: private:
Flags _flags; Flags _flags;
std::string _fullCollectionName; std::string _fullCollectionName;
Document _selector; Document _selector;
}; };
@@ -119,6 +119,7 @@ inline Document& DeleteRequest::selector()
return _selector; return _selector;
} }
} } // namespace Poco::MongoDB } } // namespace Poco::MongoDB

View File

@@ -67,6 +67,7 @@ private:
std::string _name; std::string _name;
}; };
class MongoDB_API Document class MongoDB_API Document
/// Represents a BSON document /// Represents a BSON document
{ {
@@ -270,6 +271,7 @@ inline void BSONReader::read<Document::Ptr>(Document::Ptr& to)
to->read(_reader); to->read(_reader);
} }
template<> template<>
inline void BSONWriter::write<Document::Ptr>(Document::Ptr& from) inline void BSONWriter::write<Document::Ptr>(Document::Ptr& from)
{ {

View File

@@ -35,13 +35,10 @@
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#ifndef MongoDB_Element_INCLUDED #ifndef MongoDB_Element_INCLUDED
#define MongoDB_Element_INCLUDED #define MongoDB_Element_INCLUDED
#include <string>
#include <sstream>
#include <iomanip>
#include <set>
#include "Poco/BinaryReader.h" #include "Poco/BinaryReader.h"
#include "Poco/BinaryWriter.h" #include "Poco/BinaryWriter.h"
@@ -53,6 +50,11 @@
#include "Poco/MongoDB/MongoDB.h" #include "Poco/MongoDB/MongoDB.h"
#include "Poco/MongoDB/BSONReader.h" #include "Poco/MongoDB/BSONReader.h"
#include "Poco/MongoDB/BSONWriter.h" #include "Poco/MongoDB/BSONWriter.h"
#include <string>
#include <sstream>
#include <iomanip>
#include <set>
namespace Poco { namespace Poco {
namespace MongoDB { namespace MongoDB {
@@ -129,7 +131,7 @@ struct ElementTraits<double>
// BSON UTF-8 string // BSON UTF-8 string
// spec: int32 (byte*) "\x00" // 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<> template<>
struct ElementTraits<std::string> struct ElementTraits<std::string>
{ {
@@ -226,6 +228,7 @@ inline void BSONReader::read<bool>(bool& to)
to = b != 0; to = b != 0;
} }
template<> template<>
inline void BSONWriter::write<bool>(bool& from) inline void BSONWriter::write<bool>(bool& from)
{ {

View File

@@ -35,6 +35,7 @@
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#ifndef MongoDB_GetMoreRequest_INCLUDED #ifndef MongoDB_GetMoreRequest_INCLUDED
#define MongoDB_GetMoreRequest_INCLUDED #define MongoDB_GetMoreRequest_INCLUDED

View File

@@ -35,6 +35,7 @@
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#ifndef MongoDB_KillCursorsRequest_INCLUDED #ifndef MongoDB_KillCursorsRequest_INCLUDED
#define MongoDB_KillCursorsRequest_INCLUDED #define MongoDB_KillCursorsRequest_INCLUDED

View File

@@ -35,6 +35,7 @@
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#ifndef MongoDB_Message_INCLUDED #ifndef MongoDB_Message_INCLUDED
#define MongoDB_Message_INCLUDED #define MongoDB_Message_INCLUDED

View File

@@ -35,6 +35,7 @@
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#ifndef MongoDB_MessageHeader_INCLUDED #ifndef MongoDB_MessageHeader_INCLUDED
#define MongoDB_MessageHeader_INCLUDED #define MongoDB_MessageHeader_INCLUDED
@@ -43,9 +44,6 @@
#include "Poco/MongoDB/MessageHeader.h" #include "Poco/MongoDB/MessageHeader.h"
#define MSG_HEADER_SIZE 16
namespace Poco { namespace Poco {
namespace MongoDB { namespace MongoDB {
@@ -55,6 +53,8 @@ class MongoDB_API MessageHeader
/// or response of MongoDB /// or response of MongoDB
{ {
public: public:
static const unsigned int MSG_HEADER_SIZE = 16;
typedef enum typedef enum
{ {
Reply = 1 Reply = 1

View File

@@ -35,6 +35,7 @@
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#ifndef MongoDB_ObjectId_INCLUDED #ifndef MongoDB_ObjectId_INCLUDED
#define MongoDB_ObjectId_INCLUDED #define MongoDB_ObjectId_INCLUDED
@@ -47,6 +48,7 @@
namespace Poco { namespace Poco {
namespace MongoDB { namespace MongoDB {
class MongoDB_API ObjectId class MongoDB_API ObjectId
/// ObjectId is a 12-byte BSON type, constructed using: /// ObjectId is a 12-byte BSON type, constructed using:
/// ///

View File

@@ -119,6 +119,7 @@ inline bool ResponseMessage::hasDocuments() const
return _documents.size() > 0; return _documents.size() > 0;
} }
} } // namespace Poco::MongoDB } } // namespace Poco::MongoDB

View File

@@ -88,7 +88,7 @@ public:
void flags(Flags flags); void flags(Flags flags);
/// Sets the flags /// Sets the flags
protected: protected:
void buildRequest(BinaryWriter& writer); void buildRequest(BinaryWriter& writer);
@@ -124,4 +124,5 @@ inline Document& UpdateRequest::update()
} } // namespace Poco::MongoDB } } // namespace Poco::MongoDB
#endif //MongoDB_UpdateRequest_INCLUDED #endif //MongoDB_UpdateRequest_INCLUDED

View File

@@ -34,13 +34,16 @@
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#include <sstream>
#include "Poco/MongoDB/Array.h" #include "Poco/MongoDB/Array.h"
#include <sstream>
namespace Poco { namespace Poco {
namespace MongoDB { namespace MongoDB {
Array::Array() : Document() Array::Array() : Document()
{ {
} }

View File

@@ -35,8 +35,10 @@
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#include "Poco/MongoDB/Binary.h" #include "Poco/MongoDB/Binary.h"
namespace Poco { namespace Poco {
namespace MongoDB { namespace MongoDB {

View File

@@ -34,15 +34,16 @@
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#include <iostream>
#include "Poco/Net/SocketStream.h" #include "Poco/Net/SocketStream.h"
#include "Poco/MongoDB/Connection.h" #include "Poco/MongoDB/Connection.h"
#include <iostream>
namespace Poco {
namespace MongoDB {
namespace Poco
{
namespace MongoDB
{
Connection::Connection() : _address(), _socket() Connection::Connection() : _address(), _socket()
{ {
@@ -54,6 +55,7 @@ Connection::Connection(const std::string& hostAndPort) : _address(hostAndPort),
connect(); connect();
} }
Connection::Connection(const std::string& host, int port) : _address(host, port), _socket() Connection::Connection(const std::string& host, int port) : _address(host, port), _socket()
{ {
connect(); connect();
@@ -90,6 +92,7 @@ void Connection::connect(const std::string& hostAndPort)
connect(); connect();
} }
void Connection::connect(const std::string& host, int port) void Connection::connect(const std::string& host, int port)
{ {
_address = Net::SocketAddress(host, port); _address = Net::SocketAddress(host, port);
@@ -103,17 +106,20 @@ void Connection::connect(const Net::SocketAddress& addrs)
connect(); connect();
} }
void Connection::disconnect() void Connection::disconnect()
{ {
_socket.close(); _socket.close();
} }
void Connection::sendRequest(RequestMessage& request) void Connection::sendRequest(RequestMessage& request)
{ {
Net::SocketOutputStream sos(_socket); Net::SocketOutputStream sos(_socket);
request.send(sos); request.send(sos);
} }
void Connection::sendRequest(RequestMessage& request, ResponseMessage& response) void Connection::sendRequest(RequestMessage& request, ResponseMessage& response)
{ {
sendRequest(request); sendRequest(request);

View File

@@ -35,14 +35,14 @@
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#include "Poco/MongoDB/Cursor.h" #include "Poco/MongoDB/Cursor.h"
#include "Poco/MongoDB/GetMoreRequest.h" #include "Poco/MongoDB/GetMoreRequest.h"
#include "Poco/MongoDB/KillCursorsRequest.h" #include "Poco/MongoDB/KillCursorsRequest.h"
namespace Poco
{ namespace Poco {
namespace MongoDB namespace MongoDB {
{
Cursor::Cursor(const std::string& db, const std::string& collection, QueryRequest::Flags flags) Cursor::Cursor(const std::string& db, const std::string& collection, QueryRequest::Flags flags)
@@ -91,5 +91,5 @@ void Cursor::kill(Connection& connection)
_response.clear(); _response.clear();
} }
} } // Namespace Poco::MongoDB
} } // Namespace Poco::MongoDB

View File

@@ -35,12 +35,12 @@
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#include "Poco/MongoDB/Database.h" #include "Poco/MongoDB/Database.h"
namespace Poco
{ namespace Poco {
namespace MongoDB namespace MongoDB {
{
Database::Database( const std::string& db) : _dbname(db) Database::Database( const std::string& db) : _dbname(db)
@@ -126,6 +126,7 @@ Document::Ptr Database::getLastErrorDoc(Connection& connection) const
return errorDoc; return errorDoc;
} }
std::string Database::getLastError(Connection& connection) const std::string Database::getLastError(Connection& connection) const
{ {
Document::Ptr errorDoc = getLastErrorDoc(connection); Document::Ptr errorDoc = getLastErrorDoc(connection);

View File

@@ -35,12 +35,12 @@
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#include "Poco/MongoDB/DeleteRequest.h" #include "Poco/MongoDB/DeleteRequest.h"
namespace Poco
{ namespace Poco {
namespace MongoDB namespace MongoDB {
{
DeleteRequest::DeleteRequest(const std::string& collectionName, DeleteRequest::Flags flags) DeleteRequest::DeleteRequest(const std::string& collectionName, DeleteRequest::Flags flags)
@@ -65,6 +65,7 @@ DeleteRequest::~DeleteRequest()
{ {
} }
void DeleteRequest::buildRequest(BinaryWriter& writer) void DeleteRequest::buildRequest(BinaryWriter& writer)
{ {
writer << 0; // 0 - reserved for future use writer << 0; // 0 - reserved for future use
@@ -74,4 +75,4 @@ void DeleteRequest::buildRequest(BinaryWriter& writer)
} }
}} // Namespace MongoDB } } // namespace Poco::MongoDB

View File

@@ -35,7 +35,6 @@
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#include <sstream>
#include "Poco/MongoDB/Document.h" #include "Poco/MongoDB/Document.h"
#include "Poco/MongoDB/Binary.h" #include "Poco/MongoDB/Binary.h"
@@ -43,17 +42,18 @@
#include "Poco/MongoDB/Array.h" #include "Poco/MongoDB/Array.h"
#include "Poco/MongoDB/RegularExpression.h" #include "Poco/MongoDB/RegularExpression.h"
#include "Poco/MongoDB/JavaScriptCode.h" #include "Poco/MongoDB/JavaScriptCode.h"
#include <sstream>
namespace Poco
{ namespace Poco {
namespace MongoDB namespace MongoDB {
{
Document::Document() Document::Document()
{ {
} }
Document::~Document() Document::~Document()
{ {
} }
@@ -198,14 +198,14 @@ void Document::write(BinaryWriter& writer)
Poco::BinaryWriter tempWriter(sstream); Poco::BinaryWriter tempWriter(sstream);
for(ElementSet::iterator it = _elements.begin(); it != _elements.end(); ++it) for(ElementSet::iterator it = _elements.begin(); it != _elements.end(); ++it)
{ {
tempWriter << (unsigned char) (*it)->type(); tempWriter << static_cast<unsigned char>((*it)->type());
BSONWriter(tempWriter).writeCString((*it)->name()); BSONWriter(tempWriter).writeCString((*it)->name());
Element::Ptr element = *it; Element::Ptr element = *it;
element->write(tempWriter); element->write(tempWriter);
} }
tempWriter.flush(); tempWriter.flush();
Poco::Int32 len = 5 + sstream.tellp(); /* 5 = sizeof(len) + 0-byte */ Poco::Int32 len = static_cast<Poco::Int32>(5 + sstream.tellp()); /* 5 = sizeof(len) + 0-byte */
writer << len; writer << len;
writer.writeRaw(sstream.str()); writer.writeRaw(sstream.str());
} }

View File

@@ -35,17 +35,19 @@
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#include "Poco/MongoDB/Element.h" #include "Poco/MongoDB/Element.h"
namespace Poco
{ namespace Poco {
namespace MongoDB namespace MongoDB {
{
Element::Element(const std::string& name) : _name(name) Element::Element(const std::string& name) : _name(name)
{ {
} }
Element::~Element() Element::~Element()
{ {
} }

View File

@@ -35,13 +35,13 @@
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#include "Poco/MongoDB/GetMoreRequest.h" #include "Poco/MongoDB/GetMoreRequest.h"
#include "Poco/MongoDB/Element.h" #include "Poco/MongoDB/Element.h"
namespace Poco
{ namespace Poco {
namespace MongoDB namespace MongoDB {
{
GetMoreRequest::GetMoreRequest(const std::string& collectionName, Int64 cursorID) GetMoreRequest::GetMoreRequest(const std::string& collectionName, Int64 cursorID)
@@ -52,10 +52,12 @@ GetMoreRequest::GetMoreRequest(const std::string& collectionName, Int64 cursorID
{ {
} }
GetMoreRequest::~GetMoreRequest() GetMoreRequest::~GetMoreRequest()
{ {
} }
void GetMoreRequest::buildRequest(BinaryWriter& writer) void GetMoreRequest::buildRequest(BinaryWriter& writer)
{ {
writer << 0; // 0 - reserved for future use writer << 0; // 0 - reserved for future use
@@ -65,4 +67,4 @@ void GetMoreRequest::buildRequest(BinaryWriter& writer)
} }
}} // Namespace MongoDB } } // namespace Poco::MongoDB

View File

@@ -35,12 +35,12 @@
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#include "Poco/MongoDB/InsertRequest.h" #include "Poco/MongoDB/InsertRequest.h"
namespace Poco
{ namespace Poco {
namespace MongoDB namespace MongoDB {
{
InsertRequest::InsertRequest(const std::string& collectionName, Flags flags) InsertRequest::InsertRequest(const std::string& collectionName, Flags flags)
@@ -50,10 +50,12 @@ InsertRequest::InsertRequest(const std::string& collectionName, Flags flags)
{ {
} }
InsertRequest::~InsertRequest() InsertRequest::~InsertRequest()
{ {
} }
void InsertRequest::buildRequest(BinaryWriter& writer) void InsertRequest::buildRequest(BinaryWriter& writer)
{ {
//TODO: throw exception when no document is added //TODO: throw exception when no document is added
@@ -67,4 +69,5 @@ void InsertRequest::buildRequest(BinaryWriter& writer)
} }
} }
}} // Namespace MongoDB
} } // namespace Poco::MongoDB

View File

@@ -34,8 +34,11 @@
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#include "Poco/MongoDB/JavaScriptCode.h" #include "Poco/MongoDB/JavaScriptCode.h"
namespace Poco { namespace Poco {
namespace MongoDB { namespace MongoDB {
@@ -45,8 +48,10 @@ JavaScriptCode::JavaScriptCode()
} }
JavaScriptCode::~JavaScriptCode() JavaScriptCode::~JavaScriptCode()
{ {
} }
} } // namespace Poco::MongoDB } } // namespace Poco::MongoDB

View File

@@ -35,12 +35,12 @@
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#include "Poco/MongoDB/KillCursorsRequest.h" #include "Poco/MongoDB/KillCursorsRequest.h"
namespace Poco
{ namespace Poco {
namespace MongoDB namespace MongoDB {
{
KillCursorsRequest::KillCursorsRequest() KillCursorsRequest::KillCursorsRequest()
@@ -48,10 +48,12 @@ KillCursorsRequest::KillCursorsRequest()
{ {
} }
KillCursorsRequest::~KillCursorsRequest() KillCursorsRequest::~KillCursorsRequest()
{ {
} }
void KillCursorsRequest::buildRequest(BinaryWriter& writer) void KillCursorsRequest::buildRequest(BinaryWriter& writer)
{ {
writer << 0; // 0 - reserved for future use writer << 0; // 0 - reserved for future use
@@ -63,4 +65,4 @@ void KillCursorsRequest::buildRequest(BinaryWriter& writer)
} }
}} // Namespace MongoDB } } // namespace Poco::MongoDB

View File

@@ -35,20 +35,22 @@
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#include "Poco/MongoDB/Message.h" #include "Poco/MongoDB/Message.h"
namespace Poco
{ namespace Poco {
namespace MongoDB namespace MongoDB {
{
Message::Message(MessageHeader::OpCode opcode) : _header(opcode) Message::Message(MessageHeader::OpCode opcode) : _header(opcode)
{ {
} }
Message::~Message() Message::~Message()
{ {
} }
}} // Namespace MongoDB
} } // namespace Poco::MongoDB

View File

@@ -34,25 +34,28 @@
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#include "Poco/MongoDB/Message.h"
#include "Poco/MongoDB/Message.h"
#include "Poco/Exception.h" #include "Poco/Exception.h"
#include "Poco/Net/SocketStream.h" #include "Poco/Net/SocketStream.h"
#include "Poco/StreamCopier.h" #include "Poco/StreamCopier.h"
namespace Poco
{ namespace Poco {
namespace MongoDB namespace MongoDB {
{
MessageHeader::MessageHeader(OpCode opCode) : _messageLength(0), _requestID(0), _responseTo(0), _opCode(opCode) MessageHeader::MessageHeader(OpCode opCode) : _messageLength(0), _requestID(0), _responseTo(0), _opCode(opCode)
{ {
} }
MessageHeader::~MessageHeader() MessageHeader::~MessageHeader()
{ {
} }
void MessageHeader::read(BinaryReader& reader) void MessageHeader::read(BinaryReader& reader)
{ {
reader >> _messageLength; reader >> _messageLength;
@@ -69,6 +72,7 @@ void MessageHeader::read(BinaryReader& reader)
} }
} }
void MessageHeader::write(BinaryWriter& writer) void MessageHeader::write(BinaryWriter& writer)
{ {
writer << _messageLength; writer << _messageLength;
@@ -77,4 +81,5 @@ void MessageHeader::write(BinaryWriter& writer)
writer << (Int32) _opCode; writer << (Int32) _opCode;
} }
}} // Namespace MongoDB
} } // namespace Poco::MongoDB

View File

@@ -35,14 +35,14 @@
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#include "Poco/MongoDB/ObjectId.h"
#include "Poco/MongoDB/ObjectId.h"
#include "Poco/Format.h" #include "Poco/Format.h"
namespace Poco
{ namespace Poco {
namespace MongoDB namespace MongoDB {
{
ObjectId::ObjectId() ObjectId::ObjectId()
{ {

View File

@@ -35,12 +35,12 @@
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#include "Poco/MongoDB/QueryRequest.h" #include "Poco/MongoDB/QueryRequest.h"
namespace Poco
{ namespace Poco {
namespace MongoDB namespace MongoDB {
{
QueryRequest::QueryRequest(const std::string& collectionName, QueryRequest::Flags flags) QueryRequest::QueryRequest(const std::string& collectionName, QueryRequest::Flags flags)
@@ -59,6 +59,7 @@ QueryRequest::~QueryRequest()
{ {
} }
void QueryRequest::buildRequest(BinaryWriter& writer) void QueryRequest::buildRequest(BinaryWriter& writer)
{ {
writer << _flags; writer << _flags;
@@ -74,4 +75,4 @@ void QueryRequest::buildRequest(BinaryWriter& writer)
} }
}} // Namespace MongoDB } } // namespace Poco::MongoDB

View File

@@ -35,9 +35,10 @@
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#include <sstream>
#include "Poco/MongoDB/RegularExpression.h" #include "Poco/MongoDB/RegularExpression.h"
#include <sstream>
namespace Poco { namespace Poco {
namespace MongoDB { namespace MongoDB {
@@ -88,4 +89,5 @@ SharedPtr<Poco::RegularExpression> RegularExpression::createRE() const
return new Poco::RegularExpression(_pattern, options); return new Poco::RegularExpression(_pattern, options);
} }
} } // namespace Poco::MongoDB } } // namespace Poco::MongoDB

View File

@@ -34,19 +34,21 @@
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#include "Poco/MongoDB/ReplicaSet.h" #include "Poco/MongoDB/ReplicaSet.h"
#include "Poco/MongoDB/QueryRequest.h" #include "Poco/MongoDB/QueryRequest.h"
#include "Poco/MongoDB/ResponseMessage.h" #include "Poco/MongoDB/ResponseMessage.h"
namespace Poco namespace Poco {
{ namespace MongoDB {
namespace MongoDB
{
ReplicaSet::ReplicaSet(const std::vector<Net::SocketAddress> &addresses) : _addresses(addresses) ReplicaSet::ReplicaSet(const std::vector<Net::SocketAddress> &addresses) : _addresses(addresses)
{ {
} }
ReplicaSet::~ReplicaSet() ReplicaSet::~ReplicaSet()
{ {
} }
@@ -68,6 +70,7 @@ Connection::Ptr ReplicaSet::findMaster()
return master; return master;
} }
Connection::Ptr ReplicaSet::isMaster(const Net::SocketAddress& address) Connection::Ptr ReplicaSet::isMaster(const Net::SocketAddress& address)
{ {
Connection::Ptr conn = new Connection(); Connection::Ptr conn = new Connection();

View File

@@ -35,20 +35,21 @@
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#include "Poco/MongoDB/RequestMessage.h" #include "Poco/MongoDB/RequestMessage.h"
#include "Poco/Net/SocketStream.h" #include "Poco/Net/SocketStream.h"
#include "Poco/StreamCopier.h" #include "Poco/StreamCopier.h"
namespace Poco
{ namespace Poco {
namespace MongoDB namespace MongoDB {
{
RequestMessage::RequestMessage(MessageHeader::OpCode opcode) : Message(opcode) RequestMessage::RequestMessage(MessageHeader::OpCode opcode) : Message(opcode)
{ {
} }
RequestMessage::~RequestMessage() RequestMessage::~RequestMessage()
{ {
} }
@@ -69,4 +70,5 @@ void RequestMessage::send(std::ostream& ostr)
ostr.flush(); ostr.flush();
} }
}} // Namespace MongoDB
} } // namespace Poco::MongoDB

View File

@@ -35,18 +35,20 @@
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#include "Poco/MongoDB/ResponseMessage.h" #include "Poco/MongoDB/ResponseMessage.h"
#include "Poco/Net/SocketStream.h" #include "Poco/Net/SocketStream.h"
namespace Poco
{ namespace Poco {
namespace MongoDB namespace MongoDB {
{
ResponseMessage::ResponseMessage() : Message(MessageHeader::Reply), _responseFlags(0), _cursorID(0), _startingFrom(0), _numberReturned(0) ResponseMessage::ResponseMessage() : Message(MessageHeader::Reply), _responseFlags(0), _cursorID(0), _startingFrom(0), _numberReturned(0)
{ {
} }
ResponseMessage::~ResponseMessage() ResponseMessage::~ResponseMessage()
{ {
} }
@@ -83,4 +85,5 @@ void ResponseMessage::read(std::istream& istr)
} }
} }
}} // Namespace MongoDB
} } // namespace Poco::MongoDB

View File

@@ -35,12 +35,12 @@
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#include "Poco/MongoDB/UpdateRequest.h" #include "Poco/MongoDB/UpdateRequest.h"
namespace Poco
{ namespace Poco {
namespace MongoDB namespace MongoDB {
{
UpdateRequest::UpdateRequest(const std::string& collectionName, UpdateRequest::Flags flags) UpdateRequest::UpdateRequest(const std::string& collectionName, UpdateRequest::Flags flags)
@@ -52,10 +52,12 @@ UpdateRequest::UpdateRequest(const std::string& collectionName, UpdateRequest::F
{ {
} }
UpdateRequest::~UpdateRequest() UpdateRequest::~UpdateRequest()
{ {
} }
void UpdateRequest::buildRequest(BinaryWriter& writer) void UpdateRequest::buildRequest(BinaryWriter& writer)
{ {
writer << 0; // 0 - reserved for future use writer << 0; // 0 - reserved for future use
@@ -65,4 +67,5 @@ void UpdateRequest::buildRequest(BinaryWriter& writer)
_update.write(writer); _update.write(writer);
} }
}} // Namespace MongoDB
} } // namespace Poco::MongoDB