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
     template<class U>
27
     template<class U>
28
     friend std::ostream& operator<<(std::ostream& os, const Result<U>& res);
28
     friend std::ostream& operator<<(std::ostream& os, const Result<U>& res);
29
 
29
 
30
+    const Result<T>& print() const;
31
+
30
 private:
32
 private:
31
     Result();
33
     Result();
32
 
34
 

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

88
         os << "Error: " << (res._error.empty() ? "Unknown error" : res._error);
88
         os << "Error: " << (res._error.empty() ? "Unknown error" : res._error);
89
     }
89
     }
90
     return os;
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