Date: Thursday, February 8, 2007 @ 15:39:00
  Author: gilles
    Path: /cvsroot/carob/carob

Modified: include/CarobException.hpp (1.55 -> 1.56) src/CarobException.cpp
          (1.30 -> 1.31)

(no change)
Unified formatting with the rest of the project


----------------------------+
 include/CarobException.hpp |   22 ++++---
 src/CarobException.cpp     |  130 +++++++++++++++++++++----------------------
 2 files changed, 79 insertions(+), 73 deletions(-)


Index: carob/include/CarobException.hpp
diff -u carob/include/CarobException.hpp:1.55 
carob/include/CarobException.hpp:1.56
--- carob/include/CarobException.hpp:1.55       Thu Feb  8 15:25:10 2007
+++ carob/include/CarobException.hpp    Thu Feb  8 15:39:00 2007
@@ -42,7 +42,7 @@
 class StackTraceElement;
 class DriverSocket;
 
-/** Exceptions' backtrace consisting in a vector a trace strings */
+/** Exceptions' backtrace consisting in a vector of trace strings */
 // redefine the default ctor to get the current backtrace
 class BackTrace : public std::vector<std::string>
 {
@@ -50,13 +50,17 @@
   BackTrace();
 };
 
-std::wostream&
-operator<< (std::wostream& outstream, const BackTrace& bt);
+/**
+ * Backtrace printer
+ */
+std::wostream& operator<< (std::wostream& outstream, const BackTrace& bt);
 
 typedef std::vector<StackTraceElement> StackTrace;
 
-std::wostream&
-operator<< (std::wostream& outstream, const StackTrace& st);
+/**
+ * Stacktrace printer
+ */
+std::wostream& operator<< (std::wostream& outstream, const StackTrace& st);
 
 /**
  * Mother class of all exceptions send by the driver defining common exception 
@@ -154,8 +158,10 @@
   CarobException & operator =( CarobException & forbidden);
 };
 
-std::wostream&
-operator<<(std::wostream& outstream, const CarobException& ce);
+/**
+ * CarobException printer
+ */
+std::wostream& operator<<(std::wostream& outstream, const CarobException& ce);
 
 
 /**
@@ -279,6 +285,7 @@
     : DriverException(s, state)
   { };
 };
+
 /** Errors */
 const std::wstring CONV_NUM_RANGE(L"22003");
 const std::wstring CONV_DATE_INVALID(L"22007");
@@ -292,7 +299,6 @@
 const std::wstring CONV_STRING_TRUNC(L"01004");
 const std::wstring CONV_NUM_TRUNC(L"01S07"); // missing from standard
 
-
 /**
  * Generic exception for types or feature not implemented yet.
  */
Index: carob/src/CarobException.cpp
diff -u carob/src/CarobException.cpp:1.30 carob/src/CarobException.cpp:1.31
--- carob/src/CarobException.cpp:1.30   Thu Feb  8 15:25:10 2007
+++ carob/src/CarobException.cpp        Thu Feb  8 15:39:00 2007
@@ -154,79 +154,79 @@
 }
 
 
-std::wostream&
-CarobNS::operator<< (std::wostream& oss, const CarobNS::StackTraceElement& ste)
+std::wostream& CarobNS::operator<< (std::wostream& oss, const 
CarobNS::StackTraceElement& ste)
 {
-    oss << L"at " << ste.declaringClass << L"." << ste.methodName
-        << L"(" << ste.fileName << L":" << ste.lineNumber << L")";
-    return oss;
+  oss << L"at " << ste.declaringClass << L"." << ste.methodName
+      << L"(" << ste.fileName << L":" << ste.lineNumber << L")";
+  return oss;
 }
 
-std::wostream&
-CarobNS::operator<< (std::wostream& outstream, const CarobNS::StackTrace& st)
+std::wostream& CarobNS::operator<< (std::wostream& outstream, const 
CarobNS::StackTrace& st)
 {
-    if (st.size() == 0)
-        outstream << L"  (empty/no remote stack trace)" << std::endl;
-    else {
-        for (CarobNS::StackTrace::const_iterator s = st.begin(); s != 
st.end(); s++)
-            outstream << *s << std::endl;
-    }
+  if (st.size() == 0)
+    outstream << L"  (empty/no remote stack trace)" << std::endl;
+  else
+  {
+    for (CarobNS::StackTrace::const_iterator s = st.begin(); s != st.end(); 
s++)
+        outstream << *s << std::endl;
+  }
 
   return outstream;
 }
 
-std::wostream&
-CarobNS::operator<< (std::wostream& outstream, const CarobNS::BackTrace& 
stvect)
-{  
-    for (CarobNS::BackTrace::const_iterator btframe = stvect.begin();
-         btframe != stvect.end(); btframe++) {
+std::wostream& CarobNS::operator<< (std::wostream& outstream, const 
CarobNS::BackTrace& stvect)
+{
+  for (CarobNS::BackTrace::const_iterator btframe = stvect.begin();
+      btframe != stvect.end(); btframe++)
+  {
 
-        std::string sframe(*btframe);
+    std::string sframe(*btframe);
 
 #ifdef CAROB_CXX_DEMANGLING
-        typedef std::string::size_type ssize;
-
-        ssize start(sframe.find('('));
-        ssize end(sframe.find('+'));
-
-        if (std::string::npos != start && std::string::npos != end)
-        {   
-            start++;
-            ssize len(end-start);
-            
-            std::string mangled(sframe.substr(start, len));
-
-            int status;
-            char *demangled(abi::__cxa_demangle(mangled.c_str(), 0, 0, 
&status));
-
-            if (demangled) {
-                sframe.replace(start, len, demangled);
-                free(demangled);
-            }
-        }
+    typedef std::string::size_type ssize;
+  
+    ssize start(sframe.find('('));
+    ssize end(sframe.find('+'));
+  
+    if (std::string::npos != start && std::string::npos != end)
+    {   
+      start++;
+      ssize len(end-start);
+      
+      std::string mangled(sframe.substr(start, len));
+  
+      int status;
+      char *demangled(abi::__cxa_demangle(mangled.c_str(), 0, 0, &status));
+  
+      if (demangled)
+      {
+        sframe.replace(start, len, demangled);
+        free(demangled);
+      }
+    }
 #endif
-        // not demangled frames is better than nothing: always print
-        outstream << CarobNS::StaticCodecs::fromASCII(sframe) << std::endl;
+    // not demangled frames is better than nothing: always print
+    outstream << CarobNS::StaticCodecs::fromASCII(sframe) << std::endl;
   }
 
   return outstream;
 }
 
 
-std::wostream&
-CarobNS::operator<<(std::wostream& woss, const CarobNS::CarobException& ce)
+std::wostream& CarobNS::operator<<(std::wostream& woss, const 
CarobNS::CarobException& ce)
 {
-    woss << ce.description();
-    woss << L"; SQL state: " << ce.getSQLState() << std::endl;
-    woss << ce.getBackTrace();
-    woss << L"      -- remote stack -- " << std::endl;
-    woss <<  ce.getStackTrace();
-
-    const CarobNS::CarobException* nextex_p = ce.getNext();
-    
-    if (nextex_p != NULL) {
-        woss << L"   ---  chained CarobException  --- ";
-        woss << *nextex_p;
+  woss << ce.description();
+  woss << L"; SQL state: " << ce.getSQLState() << std::endl;
+  woss << ce.getBackTrace();
+  woss << L"      -- remote stack -- " << std::endl;
+  woss <<  ce.getStackTrace();
+
+  const CarobNS::CarobException* nextex_p = ce.getNext();
+  
+  if (nextex_p != NULL)
+  {
+    woss << L"   ---  chained CarobException  --- ";
+    woss << *nextex_p;
   }
 
   return woss;
@@ -234,30 +234,30 @@
 
 
 // temporary fix for CAROB-56
-namespace {
-
-class STC {
+namespace
+{
+  class STC
+  {
     std::unexpected_handler old;
-public:
+  public:
     STC()
     {
-        old = std::set_unexpected(UnexpectedException::convertUnexpected);
+      old = std::set_unexpected(UnexpectedException::convertUnexpected);
     }
     ~STC()
     {
-        std::set_unexpected(old);
+      std::set_unexpected(old);
     }
-};
-
-// brutal
-STC install_our_global_handler;
+  };
 
+  // brutal
+  STC install_our_global_handler;
 }
 
 /*
  * Local Variables:
  * c-file-style: "bsd"
- * c-basic-offset: 4
+ * c-basic-offset: 2
  * indent-tabs-mode: nil
  * End:
  */

_______________________________________________
Carob-commits mailing list
[email protected]
https://forge.continuent.org/mailman/listinfo/carob-commits

Reply via email to