Browse Source

Result DBO print helper method

develop
Robin Thoni 8 years ago
parent
commit
91024e1250
2 changed files with 9 additions and 0 deletions
  1. 2
    0
      src/DBO/Result.h
  2. 7
    0
      src/DBO/Result.hxx

+ 2
- 0
src/DBO/Result.h View File

@@ -27,6 +27,8 @@ public:
27 27
     template<class U>
28 28
     friend std::ostream& operator<<(std::ostream& os, const Result<U>& res);
29 29
 
30
+    const Result<T>& print() const;
31
+
30 32
 private:
31 33
     Result();
32 34
 

+ 7
- 0
src/DBO/Result.hxx View File

@@ -88,4 +88,11 @@ std::ostream& operator<<(std::ostream& os, const Result<U>& res)
88 88
         os << "Error: " << (res._error.empty() ? "Unknown error" : res._error);
89 89
     }
90 90
     return os;
91
+}
92
+
93
+template<class T>
94
+const Result<T>& Result<T>::print() const
95
+{
96
+    (_success ? std::cout : std::cerr) << *this << std::endl;
97
+    return *this;
91 98
 }

Loading…
Cancel
Save