MongoType
MongoDB Collection Data Dump with BSON Types
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
BSONTypeMap.hpp
Go to the documentation of this file.
1
28
#ifndef BSONTYPEMAP_HPP_
29
#define BSONTYPEMAP_HPP_
30
31
namespace
mongotype {
32
33
//----------------------------------------------------------------------------
34
43
class
BSONTypeElement
{
47
string
name
;
51
string
description
;
52
53
public
:
57
BSONTypeElement
(
const
char
* pname =
""
,
const
char
* pdescription =
""
) :
58
name
(pname),
description
(pdescription) {
59
}
60
65
const
string
&
getName
()
const
{
66
return
name
;
67
}
68
73
const
string
&
getDesc
()
const
{
74
return
description
;
75
}
76
};
77
81
typedef
map<BSONType, const BSONTypeElement>
BSONTypeStringsMap
;
85
typedef
BSONTypeStringsMap::value_type
BSONTypeStringsMapPair
;
86
87
//----------------------------------------------------------------------------
88
95
class
BSONTypeMap
{
96
97
protected
:
101
const
BSONElement&
element
;
102
103
public
:
104
109
BSONTypeMap
(
const
BSONElement& e) :
110
element
(e) {
111
}
112
116
const
BSONTypeElement
&
lookup
(BSONType type);
117
121
const
BSONTypeElement
&
lookup
() {
122
return
lookup
(
element
.type());
123
}
124
129
string
to_string
() {
130
const
BSONTypeElement
& bsts =
lookup
();
131
string
s(
"("
);
132
s += bsts.
getName
();
133
s +=
"/"
;
134
s += bsts.
getDesc
();
135
s +=
")"
;
136
return
s;
137
}
138
143
OSTREAM_FRIEND
(
BSONTypeMap
& bstn) {
144
return
out << bstn.
to_string
();
145
}
146
};
147
148
//----------------------------------------------------------------------------
149
150
}
/* namespace mongotype */
151
#endif
/* BSONTYPEMAP_HPP_ */
include
BSONTypeMap.hpp
Generated on Mon Apr 28 2014 20:19:25 for MongoType by
1.8.3.1