3D Repo Bouncer  1.4
repo_bson_element.h
1 
23 #pragma once
24 #if defined(_WIN32) || defined(_WIN64)
25 #include <WinSock2.h>
26 #include <Windows.h>
27 
28 #endif
29 #include <mongo/bson/bson.h>
30 
31 #include "../../../repo_bouncer_global.h"
32 #include "../../../lib/repo_log.h"
33 namespace repo {
34  namespace core {
35  namespace model {
36  //type of element
37  enum class REPO_API_EXPORT ElementType{
38  ARRAY, UUID, BINARY, BOOL, DATE,
39  OBJECTID, DOUBLE, INT, LONG, OBJECT, STRING, UNKNOWN
40  };
41  class REPO_API_EXPORT RepoBSONElement :
42  public mongo::BSONElement
43  {
44  public:
45 
49  RepoBSONElement() : mongo::BSONElement(){}
50 
55  RepoBSONElement(mongo::BSONElement ele) : mongo::BSONElement(ele){}
56 
60  ~RepoBSONElement();
61 
66  ElementType type() const;
67 
68  std::vector<RepoBSONElement> Array()
69  {
70  repoInfo << " HI";
71  //FIXME: potentially slow.
72  //This is done so we can hide mongo representation from the bouncer world.
73  std::vector<RepoBSONElement> arr;
74 
75  if (!eoo())
76  {
77  std::vector<mongo::BSONElement> mongoArr = mongo::BSONElement::Array();
78  arr.reserve(mongoArr.size());
79 
80  for (auto const &ele : mongoArr)
81  {
82  arr.push_back(RepoBSONElement(ele));
83  }
84  }
85 
86  return arr;
87  }
88  };
89  }// end namespace model
90  } // end namespace core
91 } // end namespace repo
Definition: repo_bson_element.h:41
RepoBSONElement()
Definition: repo_bson_element.h:49
Definition: repo_connection_pool_mongo.h:32
RepoBSONElement(mongo::BSONElement ele)
Definition: repo_bson_element.h:55