[Liblas-commits] hg: move more detailed version information down into C++ API, so...

liblas-commits at liblas.org liblas-commits at liblas.org
Sat Aug 14 12:46:19 EDT 2010


changeset 232af06e8630 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=232af06e8630
summary: move more detailed version information down into C++ API, so we can use it there and emit out accordingly

diffstat:

 include/liblas/liblas.hpp |  37 ++++++++++++++++++++++++++++++-------
 src/las_c_api.cpp         |  46 ++--------------------------------------------
 2 files changed, 32 insertions(+), 51 deletions(-)

diffs (128 lines):

diff -r 92f46f4d13c7 -r 232af06e8630 include/liblas/liblas.hpp
--- a/include/liblas/liblas.hpp	Thu Aug 12 16:01:57 2010 -0500
+++ b/include/liblas/liblas.hpp	Sat Aug 14 11:46:27 2010 -0500
@@ -65,6 +65,8 @@
 #include <liblas/laswriter.hpp>
 #include <liblas/detail/endian.hpp>
 #include <liblas/detail/utility.hpp>
+#include <liblas/capi/las_version.h>
+
 // booost
 #include <boost/array.hpp>
 #include <boost/concept_check.hpp>
@@ -134,14 +136,35 @@
 #endif
 }
 
-/// Check if libspatialindex support has been built in to libLAS.
-inline bool IsLibSpatialIndexEnabled()
-{
-#ifdef HAVE_SPATIALINDEX
-    return true;
-#else
-    return false;
+/// Tell the user a bit about libLAS' compilation
+inline std::string  GetFullVersion(void) {
+
+    std::ostringstream os;
+#ifdef HAVE_LIBGEOTIFF
+    os << " GeoTIFF "
+       << (LIBGEOTIFF_VERSION / 1000) << '.'
+       << (LIBGEOTIFF_VERSION / 100 % 10) << '.'
+       << (LIBGEOTIFF_VERSION % 100 / 10);
 #endif
+#ifdef HAVE_GDAL
+    os << " GDAL " << GDALVersionInfo("RELEASE_NAME");
+#endif
+
+    std::string info(os.str());
+    os.str("");
+    os << "libLAS " << LIBLAS_RELEASE_NAME;
+    if (!info.empty())
+    {
+        os << " with" << info;
+    }
+
+
+    return os.str();
+}
+
+/// Tell the user our dotted release name.
+inline std::string GetVersion() {
+    return std::string(LIBLAS_RELEASE_NAME);
 }
 
 class ReaderI
diff -r 92f46f4d13c7 -r 232af06e8630 src/las_c_api.cpp
--- a/src/las_c_api.cpp	Thu Aug 12 16:01:57 2010 -0500
+++ b/src/las_c_api.cpp	Sat Aug 14 11:46:27 2010 -0500
@@ -116,11 +116,6 @@
 #endif
 
 
-#ifdef HAVE_SPATIALINDEX
-#include <spatialindex/Version.h>
-#endif
-
-
 // Error stuff
 
 
@@ -168,10 +163,6 @@
     return IsLibGeoTIFFEnabled();
 }
 
-LAS_DLL int LAS_IsLibSpatialIndexEnabled(void) {
-    return IsLibSpatialIndexEnabled();
-}
-
 LAS_DLL void LASError_Reset(void) {
     if (errors.empty()) return;
     for (std::size_t i=0;i<errors.size();i++) errors.pop();
@@ -1572,44 +1563,11 @@
 }
 
 LAS_DLL char* LAS_GetVersion() {
-
-//    output << LIBLAS_VERSION_MAJOR;
-//    output << "." << LIBLAS_VERSION_MINOR;
-//    output << "." << LIBLAS_VERSION_REV;
-//    output << "." << LIBLAS_VERSION_BUILD;
-    char const* version = LIBLAS_RELEASE_NAME;
-    return strdup(version);
+    return strdup(liblas::GetVersion().c_str());
 }
 
 LAS_DLL char* LAS_GetFullVersion(void) {
-
-    std::ostringstream os;
-#ifdef HAVE_LIBGEOTIFF
-    os << " GeoTIFF "
-       << (LIBGEOTIFF_VERSION / 1000) << '.'
-       << (LIBGEOTIFF_VERSION / 100 % 10) << '.'
-       << (LIBGEOTIFF_VERSION % 100 / 10);
-#endif
-#ifdef HAVE_GDAL
-    os << " GDAL " << GDALVersionInfo("RELEASE_NAME");
-#endif
-#ifdef HAVE_SPATIALINDEX
-    os << " SpatialIndex "
-       << SIDX_VERSION_MAJOR << '.'
-       << SIDX_VERSION_MINOR << '.'
-       << SIDX_VERSION_REV;
-#endif
-
-    std::string info(os.str());
-    os.str("");
-    os << "libLAS " << LIBLAS_RELEASE_NAME;
-    if (!info.empty())
-    {
-        os << " with" << info;
-    }
-
-
-    return strdup(os.str().c_str());
+    return strdup(liblas::GetFullVersion().c_str());
 }
 
 


More information about the Liblas-commits mailing list