From b8e9cc1e2310a11826494d2aecbc7c4d917d336a Mon Sep 17 00:00:00 2001 From: fbraem Date: Thu, 14 Feb 2013 22:50:55 +0100 Subject: [PATCH] Implement toString --- MongoDB/src/Array.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/MongoDB/src/Array.cpp b/MongoDB/src/Array.cpp index c69364f94..0bf3f968e 100644 --- a/MongoDB/src/Array.cpp +++ b/MongoDB/src/Array.cpp @@ -34,6 +34,7 @@ // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. // +#include #include "Poco/MongoDB/Array.h" @@ -49,4 +50,22 @@ Array::~Array() { } + +std::string Array::toString() const +{ + std::ostringstream oss; + oss << "[" << std::endl; + for(ElementSet::const_iterator it = _elements.begin(); it != _elements.end(); ++it) + { + if ( it != _elements.begin() ) + { + oss << ", "; + } + oss << (*it)->toString(); + } + oss << "]" << std::endl; + return oss.str(); +} + + }} // Namespace Poco::Mongo