[Liblas-commits] hg: add locale support to las2txt
liblas-commits at liblas.org
liblas-commits at liblas.org
Thu Jan 20 23:35:03 EST 2011
details: http://hg.liblas.orghg/rev/163628f814ba
changeset: 2802:163628f814ba
user: Howard Butler <hobu.inc at gmail.com>
date: Thu Jan 20 22:34:32 2011 -0600
description:
add locale support to las2txt
Subject: hg: use appropriate numeric types for number output
details: http://hg.liblas.orghg/rev/3d25d8f60b35
changeset: 2803:3d25d8f60b35
user: Howard Butler <hobu.inc at gmail.com>
date: Thu Jan 20 22:34:52 2011 -0600
description:
use appropriate numeric types for number output
diffstat:
apps/lasinfo.cpp | 16 +++++++++++++++-
src/header.cpp | 4 ++--
src/utility.cpp | 4 ++--
3 files changed, 19 insertions(+), 5 deletions(-)
diffs (89 lines):
diff -r 614df6944ee9 -r 3d25d8f60b35 apps/lasinfo.cpp
--- a/apps/lasinfo.cpp Thu Jan 20 14:20:58 2011 -0600
+++ b/apps/lasinfo.cpp Thu Jan 20 22:34:52 2011 -0600
@@ -15,6 +15,8 @@
#include <boost/cstdint.hpp>
#include <boost/foreach.hpp>
+#include <locale>
+
using namespace liblas;
using namespace std;
@@ -106,6 +108,7 @@
bool output_xml = false;
bool output_json = false;
bool show_point = false;
+ bool use_locale = false;
boost::uint32_t point = 0;
std::vector<liblas::FilterPtr> filters;
@@ -134,7 +137,7 @@
("xml", po::value<bool>(&output_xml)->zero_tokens()->implicit_value(true), "Output as XML")
("point,p", po::value<boost::uint32_t>(&point), "Display a point with a given id. --point 44")
- // ("json", po::value<bool>(&output_json)->zero_tokens()->implicit_value(true), "Output summary as JSON")
+ ("locale", po::value<bool>(&use_locale)->zero_tokens()->implicit_value(true), "Use the environment's locale for output")
// --xml
// --json
@@ -207,6 +210,11 @@
}
else
{
+ if (use_locale)
+ {
+ std::locale l("");
+ std::cout.imbue(l);
+ }
std::cout << p << std::endl;
exit(0);
}
@@ -251,6 +259,12 @@
return 0;
}
+ if (use_locale)
+ {
+ std::locale l("");
+ std::cout.imbue(l);
+ }
+
std::cout << header << std::endl;
if (show_vlrs)
PrintVLRs(std::cout, header);
diff -r 614df6944ee9 -r 3d25d8f60b35 src/header.cpp
--- a/src/header.cpp Thu Jan 20 14:20:58 2011 -0600
+++ b/src/header.cpp Thu Jan 20 22:34:52 2011 -0600
@@ -793,7 +793,7 @@
os << " Generating Software: '" << tree.get<std::string>("softwareid") << "'" << std::endl;
os << " File Creation Day/Year: " << tree.get<std::string>("date") << std::endl;
os << " Header Byte Size " << tree.get<boost::uint32_t>("size") << std::endl;
- os << " Data Offset: " << tree.get<std::string>("dataoffset") << std::endl;
+ os << " Data Offset: " << tree.get<boost::uint32_t>("dataoffset") << std::endl;
os << " Number Var. Length Records: ";
try {
@@ -812,7 +812,7 @@
BOOST_FOREACH(ptree::value_type &v,
tree.get_child("returns"))
{
- returns_oss << v.second.get<std::string>("count")<< " ";
+ returns_oss << v.second.get<boost::uint32_t>("count")<< " ";
}
diff -r 614df6944ee9 -r 3d25d8f60b35 src/utility.cpp
--- a/src/utility.cpp Thu Jan 20 14:20:58 2011 -0600
+++ b/src/utility.cpp Thu Jan 20 22:34:52 2011 -0600
@@ -391,8 +391,8 @@
os << " File has no points ...";
return os;
}
- os << " Header Point Count: " << tree.get<std::string>("summary.header.count") << std::endl;
- os << " Actual Point Count: " << tree.get<std::string>("summary.points.count") << std::endl;
+ os << " Header Point Count: " << tree.get<boost::uint32_t>("summary.header.count") << std::endl;
+ os << " Actual Point Count: " << tree.get<boost::uint32_t>("summary.points.count") << std::endl;
os << std::endl;
os << " Minimum and Maximum Attributes (min,max)" << std::endl;
More information about the Liblas-commits
mailing list