Commit c1def164 authored by Bryan Berthou's avatar Bryan Berthou
Browse files

refs#16

In ElementaryUtils (trunk) :
- Add a clear() method in Formatter class.
parent 3116cb54
...@@ -10,9 +10,11 @@ ...@@ -10,9 +10,11 @@
*/ */
#include <iomanip> #include <iomanip>
#include <limits>
#include <sstream> #include <sstream>
#include <string> #include <string>
#include <limits>
#include "StringUtils.h"
namespace ElemUtils { namespace ElemUtils {
...@@ -64,6 +66,11 @@ public: ...@@ -64,6 +66,11 @@ public:
void print(); void print();
void clear() {
m_stream.clear();
m_stream.str(StringUtils::EMPTY);
}
private: private:
std::stringstream m_stream; std::stringstream m_stream;
......
...@@ -129,7 +129,7 @@ GenericType& ElemUtils::GenericType::operator =(const GenericType& rhs) { ...@@ -129,7 +129,7 @@ GenericType& ElemUtils::GenericType::operator =(const GenericType& rhs) {
} }
void ElemUtils::GenericType::setValue(const GenericType& value) { void ElemUtils::GenericType::setValue(const GenericType& value) {
// clear current stream then copy it from other object // clear current stream before adding new value
m_stream.clear(); m_stream.clear();
m_stream.str(StringUtils::EMPTY); m_stream.str(StringUtils::EMPTY);
m_stream << value.m_stream.str(); m_stream << value.m_stream.str();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment