Skip to content

Commit b8e9cc1

Browse files
committed
Implement toString
1 parent 7818a6c commit b8e9cc1

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

‎MongoDB/src/Array.cpp‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
3535
// DEALINGS IN THE SOFTWARE.
3636
//
37+
#include <sstream>
3738

3839
#include "Poco/MongoDB/Array.h"
3940

@@ -49,4 +50,22 @@ Array::~Array()
4950
{
5051
}
5152

53+
54+
std::string Array::toString() const
55+
{
56+
std::ostringstream oss;
57+
oss << "[" << std::endl;
58+
for(ElementSet::const_iterator it = _elements.begin(); it != _elements.end(); ++it)
59+
{
60+
if ( it != _elements.begin() )
61+
{
62+
oss << ", ";
63+
}
64+
oss << (*it)->toString();
65+
}
66+
oss << "]" << std::endl;
67+
return oss.str();
68+
}
69+
70+
5271
}} // Namespace Poco::Mongo

0 commit comments

Comments
 (0)