Permalink
Browse files

only style changes

  • Loading branch information...
aleks-f committed Mar 17, 2013
1 parent 95e7130 commit 3d16ce00a23e048d8992014f308b2670fa033c90
Showing with 190 additions and 111 deletions.
  1. +6 −8 MongoDB/include/Poco/MongoDB/BSONReader.h
  2. +4 −0 MongoDB/include/Poco/MongoDB/BSONWriter.h
  3. +6 −1 MongoDB/include/Poco/MongoDB/Binary.h
  4. +16 −5 MongoDB/include/Poco/MongoDB/Database.h
  5. +2 −1 MongoDB/include/Poco/MongoDB/DeleteRequest.h
  6. +2 −0 MongoDB/include/Poco/MongoDB/Document.h
  7. +8 −5 MongoDB/include/Poco/MongoDB/Element.h
  8. +1 −0 MongoDB/include/Poco/MongoDB/GetMoreRequest.h
  9. +1 −0 MongoDB/include/Poco/MongoDB/KillCursorsRequest.h
  10. +1 −0 MongoDB/include/Poco/MongoDB/Message.h
  11. +3 −3 MongoDB/include/Poco/MongoDB/MessageHeader.h
  12. +2 −0 MongoDB/include/Poco/MongoDB/ObjectId.h
  13. +1 −0 MongoDB/include/Poco/MongoDB/ResponseMessage.h
  14. +2 −1 MongoDB/include/Poco/MongoDB/UpdateRequest.h
  15. +4 −1 MongoDB/src/Array.cpp
  16. +2 −0 MongoDB/src/Binary.cpp
  17. +11 −5 MongoDB/src/Connection.cpp
  18. +5 −5 MongoDB/src/Cursor.cpp
  19. +5 −4 MongoDB/src/Database.cpp
  20. +6 −5 MongoDB/src/DeleteRequest.cpp
  21. +7 −7 MongoDB/src/Document.cpp
  22. +6 −4 MongoDB/src/Element.cpp
  23. +7 −5 MongoDB/src/GetMoreRequest.cpp
  24. +8 −5 MongoDB/src/InsertRequest.cpp
  25. +5 −0 MongoDB/src/JavaScriptCode.cpp
  26. +7 −5 MongoDB/src/KillCursorsRequest.cpp
  27. +7 −5 MongoDB/src/Message.cpp
  28. +11 −6 MongoDB/src/MessageHeader.cpp
  29. +5 −5 MongoDB/src/ObjectId.cpp
  30. +6 −5 MongoDB/src/QueryRequest.cpp
  31. +3 −1 MongoDB/src/RegularExpression.cpp
  32. +7 −4 MongoDB/src/ReplicaSet.cpp
  33. +7 −5 MongoDB/src/RequestMessage.cpp
  34. +8 −5 MongoDB/src/ResponseMessage.cpp
  35. +8 −5 MongoDB/src/UpdateRequest.cpp
@@ -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 @@ class MongoDB_API Database
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 @@ class MongoDB_API DeleteRequest : public RequestMessage
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 @@ class ElementFindByName
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 @@ class UpdateRequest : public RequestMessage
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
View
@@ -34,13 +34,16 @@
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
-#include <sstream>
+
#include "Poco/MongoDB/Array.h"
+#include <sstream>
+
namespace Poco {
namespace MongoDB {
+
Array::Array() : Document()
{
}
View
@@ -35,8 +35,10 @@
// DEALINGS IN THE SOFTWARE.
//
+
#include "Poco/MongoDB/Binary.h"
+
namespace Poco {
namespace MongoDB {
Oops, something went wrong.

0 comments on commit 3d16ce0

Please sign in to comment.