[Liblas-commits] hg-main-tree: fix default option printing

liblas-commits at liblas.org liblas-commits at liblas.org
Fri Aug 12 12:41:08 EDT 2011


details:   http://hg.libpc.orghg-main-tree/rev/af3c273a58c0
changeset: 1060:af3c273a58c0
user:      Michael P. Gerlek <mpg at flaxen.com>
date:      Fri Aug 12 09:40:55 2011 -0700
description:
fix default option printing

diffstat:

 apps/Application.cpp |  8 ++++++--
 apps/Application.hpp |  2 +-
 2 files changed, 7 insertions(+), 3 deletions(-)

diffs (37 lines):

diff -r 1e491f1d3674 -r af3c273a58c0 apps/Application.cpp
--- a/apps/Application.cpp	Thu Aug 11 18:02:50 2011 -0700
+++ b/apps/Application.cpp	Fri Aug 12 09:40:55 2011 -0700
@@ -145,7 +145,11 @@
 
 boost::uint8_t Application::getVerboseLevel() const
 {
-    return m_verboseLevel;
+    // verboseLevel is really a u8 value, but we have to store it in a u32
+    // object because if we don't then program_options prints the default
+    // value as an unsigned char (thanks, lexical_cast!)
+    const boost::uint8_t v = static_cast<boost::uint8_t>(m_verboseLevel & 0x000000ff);
+    return v;
 }
 
 
@@ -200,7 +204,7 @@
     basic_options->add_options()
         ("help,h", "produce help message")
         ("debug,d", po::value<bool>(&m_isDebug)->zero_tokens(), "Enable debug mode")
-        ("verbose,v", po::value<boost::uint8_t>(&m_verboseLevel)->default_value(0), "Set verbose message level (default is 0)")
+        ("verbose,v", po::value<boost::uint32_t>(&m_verboseLevel)->default_value(0), "Set verbose message level (default is 0)")
         ("version", "Show version info")
         ("timer", "Show execution time")
         ;
diff -r 1e491f1d3674 -r af3c273a58c0 apps/Application.hpp
--- a/apps/Application.hpp	Thu Aug 11 18:02:50 2011 -0700
+++ b/apps/Application.hpp	Fri Aug 12 09:40:55 2011 -0700
@@ -89,7 +89,7 @@
     void addBasicOptionSet();
 
     bool m_isDebug;
-    boost::uint8_t m_verboseLevel;
+    boost::uint32_t m_verboseLevel;
     const int m_argc;
     char** m_argv;
     const std::string m_appName;


More information about the Liblas-commits mailing list