[Orxonox-commit 630] r3162 - branches/pch/src/util

rgrieder at orxonox.net rgrieder at orxonox.net
Sun Jun 14 11:18:43 CEST 2009


Author: rgrieder
Date: 2009-06-14 11:18:43 +0200 (Sun, 14 Jun 2009)
New Revision: 3162

Modified:
   branches/pch/src/util/Exception.h
Log:
Added support to write exception messages like the following:
int number = 8;
ThrowException(General, "number = " << number);

Modified: branches/pch/src/util/Exception.h
===================================================================
--- branches/pch/src/util/Exception.h	2009-06-13 21:29:15 UTC (rev 3161)
+++ branches/pch/src/util/Exception.h	2009-06-14 09:18:43 UTC (rev 3162)
@@ -37,9 +37,9 @@
 
 #include "UtilPrereqs.h"
 
+#include <exception>
+#include <sstream>
 #include <string>
-#include <exception>
-#include <cassert>
 #include "Debug.h"
 
 namespace orxonox
@@ -120,6 +120,6 @@
     }
 
 #define ThrowException(type, description) \
-    throw InternalHandleException(type##Exception(description, __LINE__, __FILE__, __FUNCTIONNAME__))
+    throw InternalHandleException(type##Exception(static_cast<std::ostringstream&>(std::ostringstream().flush() << description).str(), __LINE__, __FILE__, __FUNCTIONNAME__))
 
 #endif /* _Exception_H__ */




More information about the Orxonox-commit mailing list