From 6c15f857c4bd2fd691887784354300b1abb7cf29 Mon Sep 17 00:00:00 2001
From: Luc Hermitte <luc.hermitte@c-s.fr>
Date: Fri, 20 Apr 2012 15:27:16 +0200
Subject: [PATCH] ENH: OTB-134/OGR: printf-self

---
 .../OGRAdapters/otbOGRFeatureWrapper.cxx                  | 6 ++++--
 Code/UtilitiesAdapters/OGRAdapters/otbOGRLayerWrapper.h   | 8 ++++----
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/Code/UtilitiesAdapters/OGRAdapters/otbOGRFeatureWrapper.cxx b/Code/UtilitiesAdapters/OGRAdapters/otbOGRFeatureWrapper.cxx
index bf73dea0ec..8b2d5aa57a 100644
--- a/Code/UtilitiesAdapters/OGRAdapters/otbOGRFeatureWrapper.cxx
+++ b/Code/UtilitiesAdapters/OGRAdapters/otbOGRFeatureWrapper.cxx
@@ -66,9 +66,11 @@ void otb::ogr::Feature::PrintSelf(std::ostream & os, itk::Indent indent) const
   os << indent << "+";
   os << " " << nbFields << " fields\n";
   for (int i=0; i!=nbFields; ++i) {
+    OGRFieldDefn & field = *const_cast<Feature*>(this)->ogr().GetFieldDefnRef(i);
     os << indent << "|" << one_indent << "+ ";
-    os << const_cast<Feature*>(this)->ogr().GetFieldDefnRef(i)->GetType() << ": " // << *this
-      << "\n";
+    os << field.GetNameRef() << ": ";
+    os << "(" << OGRFieldDefn::GetFieldTypeName(field.GetType()) << ")";
+    os << "\n";
   }
 }
 
diff --git a/Code/UtilitiesAdapters/OGRAdapters/otbOGRLayerWrapper.h b/Code/UtilitiesAdapters/OGRAdapters/otbOGRLayerWrapper.h
index 1b86974620..235fda9970 100644
--- a/Code/UtilitiesAdapters/OGRAdapters/otbOGRLayerWrapper.h
+++ b/Code/UtilitiesAdapters/OGRAdapters/otbOGRLayerWrapper.h
@@ -15,8 +15,8 @@ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
 PURPOSE.  See the above copyright notices for more information.
 
 =========================================================================*/
-#ifndef __otbLayer_h
-#define __otbLayer_h
+#ifndef __otbLayerWrapper_h
+#define __otbLayerWrapper_h
 
 // #include <iosfwd> // std::ostream&
 #include <boost/shared_ptr.hpp>
@@ -232,7 +232,7 @@ private:
 } } // end namespace otb::ogr
 
 #ifndef OTB_MANUAL_INSTANTIATION
-// #include "otbLayer.txx"
+// #include "otbLayerWrapper.txx"
 #endif
 
-#endif // __otbLayer_h
+#endif // __otbLayerWrapper_h
-- 
GitLab