Add some handy "short-cut" functions
This commit is contained in:
Родитель
382dbd5637
Коммит
6a8b2c5a48
|
@ -60,14 +60,6 @@ public:
|
|||
/// Destructor
|
||||
|
||||
|
||||
void read(std::istream& istr);
|
||||
/// Reads the response from the stream
|
||||
|
||||
|
||||
Document::Vector& documents();
|
||||
/// Returns the retrieved documents
|
||||
|
||||
|
||||
Int64 cursorID() const;
|
||||
/// Returns the cursor id
|
||||
|
||||
|
@ -75,6 +67,27 @@ public:
|
|||
void clear();
|
||||
/// Clears the response
|
||||
|
||||
|
||||
size_t count() const;
|
||||
/// Returns the number of documents in the response
|
||||
|
||||
|
||||
Document::Vector& documents();
|
||||
/// Returns the retrieved documents
|
||||
|
||||
|
||||
bool empty() const;
|
||||
/// Returns true when the response doesn't contain any documents
|
||||
|
||||
|
||||
bool hasDocuments() const;
|
||||
/// Returns true when there is at least one document
|
||||
|
||||
|
||||
void read(std::istream& istr);
|
||||
/// Reads the response from the stream
|
||||
|
||||
|
||||
private:
|
||||
|
||||
Int32 _responseFlags;
|
||||
|
@ -93,9 +106,15 @@ private:
|
|||
};
|
||||
|
||||
|
||||
inline Document::Vector& ResponseMessage::documents()
|
||||
inline size_t ResponseMessage::count() const
|
||||
{
|
||||
return _documents;
|
||||
return _documents.size();
|
||||
}
|
||||
|
||||
|
||||
inline bool ResponseMessage::empty() const
|
||||
{
|
||||
return _documents.size() == 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -105,6 +124,17 @@ inline Int64 ResponseMessage::cursorID() const
|
|||
}
|
||||
|
||||
|
||||
inline Document::Vector& ResponseMessage::documents()
|
||||
{
|
||||
return _documents;
|
||||
}
|
||||
|
||||
|
||||
inline bool ResponseMessage::hasDocuments() const
|
||||
{
|
||||
return _documents.size() > 0;
|
||||
}
|
||||
|
||||
}} // Namespace Poco::MongoDB
|
||||
|
||||
#endif //_MongoDB_ResponseMessage_included
|
||||
|
|
Загрузка…
Ссылка в новой задаче