diff --git a/UnitTest/UnitTest.vcxproj b/UnitTest/UnitTest.vcxproj
index 1baac7b11..547527c2a 100644
--- a/UnitTest/UnitTest.vcxproj
+++ b/UnitTest/UnitTest.vcxproj
@@ -58,7 +58,7 @@
Level4
true
$(ProjectDir);$(SolutionDir)modules\c\nrt\include;$(SolutionDir)modules\c\nitf\include;$(SolutionDir)modules\c++\nitf\include;$(SolutionDir)modules\c\j2k\include;$(SolutionDir)modules\c;$(SolutionDir)modules\c++;$(SolutionDir)externals\coda-oss\modules\c++;$(SolutionDir)externals\coda-oss\out\install\$(Platform)-$(Configuration)\include;$(SolutionDir)out\install\$(Platform)-$(Configuration)\include;$(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories)
- _DEBUG;%(PreprocessorDefinitions)
+ _DEBUG;%(PreprocessorDefinitions);CODA_OSS_LIBRARY_SHARED=1
true
pch.h
AdvancedVectorExtensions2
@@ -84,7 +84,7 @@
true
true
$(ProjectDir);$(SolutionDir)modules\c\nrt\include;$(SolutionDir)modules\c\nitf\include;$(SolutionDir)modules\c++\nitf\include;$(SolutionDir)modules\c\j2k\include;$(SolutionDir)modules\c;$(SolutionDir)modules\c++;$(SolutionDir)externals\coda-oss\modules\c++;$(SolutionDir)externals\coda-oss\out\install\$(Platform)-$(Configuration)\include;$(SolutionDir)out\install\$(Platform)-$(Configuration)\include;$(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories)
- NDEBUG;%(PreprocessorDefinitions)
+ NDEBUG;%(PreprocessorDefinitions);CODA_OSS_LIBRARY_SHARED=1
true
pch.h
AdvancedVectorExtensions2
@@ -254,15 +254,15 @@
+
+ {9997e895-5161-4ddf-8f3f-099894cb2f21}
+
{8f357a19-799e-4971-850e-3f28485c130b}
{f06550ad-cfc7-40b8-8727-6c82c69a8982}
-
- {78849481-d356-4cc7-b182-31c21f857ed1}
-
diff --git a/UnitTest/pch.h b/UnitTest/pch.h
index 37e984a9e..86707841a 100644
--- a/UnitTest/pch.h
+++ b/UnitTest/pch.h
@@ -20,20 +20,15 @@
// We're building in Visual Studio ... used to control where we get a little bit of config info
#define NITRO_PCH 1
+#ifndef CODA_OSS_LIBRARY_SHARED
+#define CODA_OSS_LIBRARY_SHARED 1
+#endif
#include
#include
#include
#include
-#pragma comment(lib, "io-c++")
-#pragma comment(lib, "io-c++")
-#pragma comment(lib, "except-c++")
-#pragma comment(lib, "sys-c++")
-#pragma comment(lib, "str-c++")
-#pragma comment(lib, "sio.lite-c++.lib")
-#pragma comment(lib, "math-c++")
-#pragma comment(lib, "mt-c++")
#include
#include
diff --git a/externals/coda-oss/UnitTest/UnitTest.vcxproj b/externals/coda-oss/UnitTest/UnitTest.vcxproj
index f06331de9..d79dab6f9 100644
--- a/externals/coda-oss/UnitTest/UnitTest.vcxproj
+++ b/externals/coda-oss/UnitTest/UnitTest.vcxproj
@@ -23,7 +23,6 @@
DynamicLibrary
true
v143
- false
Unicode
@@ -31,7 +30,6 @@
false
v143
true
- false
Unicode
@@ -71,6 +69,7 @@
true
/Zc:__cplusplus %(AdditionalOptions)
AdvancedVectorExtensions2
+ MultiThreadedDebugDLL
Windows
@@ -96,6 +95,7 @@
true
/Zc:__cplusplus %(AdditionalOptions)
AdvancedVectorExtensions2
+ Speed
Windows
diff --git a/externals/coda-oss/cmake/CodaBuild.cmake b/externals/coda-oss/cmake/CodaBuild.cmake
index 142773788..5ac3ed962 100644
--- a/externals/coda-oss/cmake/CodaBuild.cmake
+++ b/externals/coda-oss/cmake/CodaBuild.cmake
@@ -128,8 +128,12 @@ macro(coda_initialize_build)
option(BUILD_SHARED_LIBS "Build shared libraries instead of static." OFF)
if(BUILD_SHARED_LIBS)
set(CODA_LIBRARY_TYPE "shared")
+ add_definitions(-DCODA_OSS_LIBRARY_SHARED=1)
+ add_definitions(-UCODA_OSS_LIBRARY_STATIC)
else()
set(CODA_LIBRARY_TYPE "static")
+ add_definitions(-DCODA_OSS_LIBRARY_STATIC=1)
+ add_definitions(-UCODA_OSS_LIBRARY_SHARED)
endif()
option(CODA_BUILD_TESTS "build tests" ON)
diff --git a/externals/coda-oss/modules/c++/coda-oss.vcxproj b/externals/coda-oss/modules/c++/coda-oss.vcxproj
index 77af044c5..6aacf1781 100644
--- a/externals/coda-oss/modules/c++/coda-oss.vcxproj
+++ b/externals/coda-oss/modules/c++/coda-oss.vcxproj
@@ -19,6 +19,8 @@
+
+
@@ -509,6 +511,7 @@
+
@@ -566,7 +569,7 @@
Level4
true
- _DEBUG;_LIB;%(PreprocessorDefinitions);CODA_OSS_EXPORTS;CODA_OSS_DLL;MT_DEFAULT_PINNING=0;RE_ENABLE_STD_REGEX=1
+ _DEBUG;%(PreprocessorDefinitions);MT_DEFAULT_PINNING=0;RE_ENABLE_STD_REGEX=1;CODA_OSS_EXPORTS;CODA_OSS_LIBRARY_SHARED=1
pch.h
cli\include;coda_oss\include;config\include;dbi\include;except\include;gsl\include;hdf5.lite\include;io\include;logging\include;math\include;math.linear\include;math.poly\include;mem\include;mt\include;net\include;net.ssl\include;plugin\include;polygon\include;re\include;sio.lite\include;std\include;str\include;sys\include;tiff\include;types\include;unique\include;units\include;xml.lite\include;zip\include;$(ProjectDir)include;$(SolutionDir)out\install\$(Platform)-$(Configuration)\include;$(SolutionDir)externals\$(ProjectName)\out\install\$(Platform)-$(Configuration)\include
Use
@@ -596,7 +599,7 @@
true
true
true
- NDEBUG;_LIB;%(PreprocessorDefinitions);CODA_OSS_EXPORTS;CODA_OSS_DLL;MT_DEFAULT_PINNING=0;RE_ENABLE_STD_REGEX=1
+ NDEBUG;%(PreprocessorDefinitions);MT_DEFAULT_PINNING=0;RE_ENABLE_STD_REGEX=1;CODA_OSS_EXPORTS;CODA_OSS_LIBRARY_SHARED=1
pch.h
cli\include;coda_oss\include;config\include;dbi\include;except\include;gsl\include;hdf5.lite\include;io\include;logging\include;math\include;math.linear\include;math.poly\include;mem\include;mt\include;net\include;net.ssl\include;plugin\include;polygon\include;re\include;sio.lite\include;std\include;str\include;sys\include;tiff\include;types\include;unique\include;units\include;xml.lite\include;zip\include;$(ProjectDir)include;$(SolutionDir)out\install\$(Platform)-$(Configuration)\include;$(SolutionDir)externals\$(ProjectName)\out\install\$(Platform)-$(Configuration)\include
Use
@@ -609,6 +612,7 @@
/Zc:__cplusplus %(AdditionalOptions)
AdvancedVectorExtensions2
Level3
+ Speed
diff --git a/externals/coda-oss/modules/c++/coda-oss.vcxproj.filters b/externals/coda-oss/modules/c++/coda-oss.vcxproj.filters
index 50db46175..a94b8aafd 100644
--- a/externals/coda-oss/modules/c++/coda-oss.vcxproj.filters
+++ b/externals/coda-oss/modules/c++/coda-oss.vcxproj.filters
@@ -951,6 +951,12 @@
str
+
+ coda_oss
+
+
+ coda_oss
+
@@ -1559,5 +1565,8 @@
sys
+
+ std
+
\ No newline at end of file
diff --git a/externals/coda-oss/modules/c++/coda_oss/include/coda_oss/mdspan.h b/externals/coda-oss/modules/c++/coda_oss/include/coda_oss/mdspan.h
new file mode 100644
index 000000000..3569440f4
--- /dev/null
+++ b/externals/coda-oss/modules/c++/coda_oss/include/coda_oss/mdspan.h
@@ -0,0 +1,73 @@
+/* =========================================================================
+ * This file is part of coda_oss-c++
+ * =========================================================================
+ *
+ * (C) Copyright 2004 - 2014, MDA Information Systems LLC
+ * © Copyright 2023, Maxar Technologies, Inc.
+ *
+ * coda_oss-c++ is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; If not,
+ * see .
+ *
+ */
+#pragma once
+
+#include "coda_oss/CPlusPlus.h"
+
+// This should always work ... it's in a `details` namespace
+#include "coda_oss/mdspan_.h"
+
+// This logic needs to be here rather than so that `coda_oss::mdspan` will
+// be the same as `std::mdspan`.
+#ifndef CODA_OSS_HAVE_std_mdspan_
+ #define CODA_OSS_HAVE_std_mdspan_ 0 // assume no
+#endif
+#ifndef CODA_OSS_HAVE_experimental_mdspan_
+ #define CODA_OSS_HAVE_experimental_mdspan_ 0 // assume no std::experimental::mdspan
+#endif
+#if CODA_OSS_cpp17 // __has_include
+ #if __has_include() // not until C++23
+ #include
+ #undef CODA_OSS_HAVE_std_mdspan_
+ #define CODA_OSS_HAVE_std_mdspan_ 1 // provided by the implementation, probably C++23
+ #endif
+
+ #if CODA_OSS_cpp20 // Can't even #include this file with older C++14/17 compilers! :-(
+ // Put this in a __has_include so that it's optional. Our simple implemtnation works
+ // for our needs, and this brings along a lot of code that our older compilers don't
+ // like. By the time we need more functionality, maybe we'll be using C++23?
+ //
+ // Until then, having this available allows checking our implementation against
+ // something much more real. https://github.com/kokkos/mdspan
+ #if __has_include("coda_oss/experimental/mdspan")
+ #include "coda_oss/experimental/mdspan"
+ #undef CODA_OSS_HAVE_experimental_mdspan_
+ #define CODA_OSS_HAVE_experimental_mdspan_ 1 // provided coda_oss/experimental/mdspan
+ #endif
+ #endif
+#endif // CODA_OSS_cpp17
+
+namespace coda_oss
+{
+ #if CODA_OSS_HAVE_std_mdspan_
+ using std::mdspan;
+ using std::dextents;
+ #elif CODA_OSS_HAVE_experimental_mdspan_
+ using std::experimental::mdspan;
+ using std::experimental::dextents;
+ #else
+ using details::mdspan;
+ using details::dextents;
+ #endif
+}
+
diff --git a/externals/coda-oss/modules/c++/coda_oss/include/coda_oss/mdspan_.h b/externals/coda-oss/modules/c++/coda_oss/include/coda_oss/mdspan_.h
new file mode 100644
index 000000000..b678051d8
--- /dev/null
+++ b/externals/coda-oss/modules/c++/coda_oss/include/coda_oss/mdspan_.h
@@ -0,0 +1,151 @@
+/* =========================================================================
+ * This file is part of coda_oss-c++
+ * =========================================================================
+ *
+ * (C) Copyright 2004 - 2014, MDA Information Systems LLC
+ * © Copyright 2023, Maxar Technologies, Inc.
+ *
+ * coda_oss-c++ is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; If not,
+ * see .
+ *
+ */
+#pragma once
+
+#include
+
+#include
+
+#include "coda_oss/span.h"
+
+// This is a simple, partial, and incomplete implementation of `std::mdspan` (in C++23).
+// https://en.cppreference.com/w/cpp/container/mdspan
+//
+// Why? Our (current) needs are much more limited than all the use-cases for `std::mdspan`:
+// dynamic (not static) extents, rank of 2 (rows × cols), contiguous memory, ...
+// By the time we really need more features, maybe we'll be using C++23?
+namespace coda_oss
+{
+namespace details
+{
+ // https://en.cppreference.com/w/cpp/container/mdspan/extents
+template
+struct dextents final // this is actually supposed to be an alias template with all dynamic extents
+{
+ static_assert(Rank == 2, "Rank must have a value of 2");
+ using index_type = IndexType;
+ using size_type = index_type;
+ using rank_type = size_t;
+
+ constexpr dextents() = default;
+
+ // These are supposed to be templates, but we don't need that complication right now.
+ constexpr dextents(index_type i0, index_type i1) noexcept : exts_{i0, i1}
+ {
+ }
+ constexpr explicit dextents(const std::array& exts) noexcept : exts_(exts)
+ {
+ }
+
+ dextents(const dextents&) = default;
+ dextents& operator=(const dextents&) = default;
+ dextents(dextents&&) = default;
+ dextents& operator=(dextents&&) = default;
+
+ constexpr index_type extent(rank_type r) const noexcept
+ {
+ return exts_[r];
+ }
+
+ static constexpr auto rank() noexcept
+ {
+ return Rank;
+ }
+
+private:
+ std::array exts_;
+};
+
+template
+class mdspan final
+{
+ coda_oss::span s_; // `span` instead of a raw pointer to get more range checking.
+ TExtents ext_;
+
+ // c.f., `types::RowCol`
+ template
+ static size_t area(const dextents& exts)
+ {
+ return exts.extent(0) * exts.extent(1);
+ }
+
+public:
+ using extents_type = TExtents;
+ using size_type = typename extents_type::size_type;
+ using data_handle_type = T*;
+ using reference = T&;
+
+ constexpr mdspan() = default;
+
+ // Again, these are supposed to be templates ...
+ mdspan(data_handle_type p, const extents_type& ext) noexcept : s_(p, area(ext)), ext_(ext)
+ {
+ }
+ mdspan(data_handle_type p, const std::array& dims) noexcept : mdspan(p, extents_type(dims))
+ {
+ }
+
+ mdspan(const mdspan&) = default;
+ mdspan& operator=(const mdspan&) = default;
+ mdspan(mdspan&&) = default;
+ mdspan& operator=(mdspan&&) = default;
+
+ constexpr data_handle_type data_handle() const noexcept
+ {
+ return s_.data();
+ }
+
+ /*constexpr*/ reference operator[](size_t idx) const noexcept
+ {
+ assert(idx < size()); // prevents "constexpr" in C++11
+ return data_handle()[idx];
+ }
+ /*constexpr*/ reference operator()(size_t r, size_t c) const noexcept
+ {
+ const auto offset = (r * extent(1)) + c;
+ return (*this)[offset];
+ }
+
+ constexpr size_t size() const noexcept
+ {
+ return s_.size();
+ }
+
+ constexpr bool empty() const noexcept
+ {
+ return s_.empty();
+ }
+
+ auto extent(size_type rank) const
+ {
+ return ext_.extent(rank);
+ }
+
+ static constexpr auto rank() noexcept
+ {
+ return extents_type::rank();
+ }
+};
+}
+}
+
diff --git a/externals/coda-oss/modules/c++/coda_oss/include/coda_oss/optional.h b/externals/coda-oss/modules/c++/coda_oss/include/coda_oss/optional.h
index f1fab3a0b..86298871c 100644
--- a/externals/coda-oss/modules/c++/coda_oss/include/coda_oss/optional.h
+++ b/externals/coda-oss/modules/c++/coda_oss/include/coda_oss/optional.h
@@ -24,6 +24,9 @@
#include "coda_oss/CPlusPlus.h"
+// always compile; it's in a details namespace
+#include "coda_oss/optional_.h"
+
// This logic needs to be here rather than so that `coda_oss::optional` will
// be the same as `std::optional`.
#ifndef CODA_OSS_HAVE_std_optional_
@@ -37,10 +40,6 @@
#endif
#endif // CODA_OSS_cpp17
-#if !CODA_OSS_HAVE_std_optional_
-#include "coda_oss/optional_.h"
-#endif
-
namespace coda_oss
{
#if CODA_OSS_HAVE_std_optional_
diff --git a/externals/coda-oss/modules/c++/config/include/config/Exports.h b/externals/coda-oss/modules/c++/config/include/config/Exports.h
index 6b77d9fd7..71949e7c7 100644
--- a/externals/coda-oss/modules/c++/config/include/config/Exports.h
+++ b/externals/coda-oss/modules/c++/config/include/config/Exports.h
@@ -1,22 +1,30 @@
-#ifndef CODA_OSS_config_Exports_h_INCLUDED_
-#define CODA_OSS_config_Exports_h_INCLUDED_
#pragma once
#include "config/compiler_extensions.h"
-// Need to specify how this code will be consumed, either CODA_OSS_LIB (static library)
-// or CODA_OSS_DLL (aka "shared" library). For DLLs, it needs to be set for BOTH
+// Need to specify how this code will be consumed, either CODA_OSS_LIB_ (static library)
+// or CODA_OSS_DLL_ (aka "shared" library). For DLLs, it needs to be set for BOTH
// "exporting" (building this code) and "importing" (consuming).
//
// Use Windows naming conventions (DLL, LIB) because this really only matters for _MSC_VER, see below.
-#if !defined(CODA_OSS_LIB) && !defined(CODA_OSS_DLL)
- #define CODA_OSS_LIB 1
- //#define CODA_OSS_DLL 1
+#if !defined(CODA_OSS_LIB_) && !defined(CODA_OSS_DLL_)
+ #if CODA_OSS_LIBRARY_SHARED
+ #if CODA_OSS_LIBRARY_STATIC
+ #error "CODA_OSS_LIBRARY_SHARED already #define'd'"
+ #endif
+ #define CODA_OSS_DLL_ 1 // Symbols must be exported and imported (see below).
+ #else
+ // CODA_OSS_LIBRARY_STATIC doesn't have to be defined
+ #define CODA_OSS_LIB_ 1 // Static library, all symbols visible.
+ #endif
#endif
-#if defined(CODA_OSS_LIB) && defined(CODA_OSS_DLL)
- #error "Both CODA_OSS_LIB and CODA_OSS_DLL are #define'd'"
+#if !defined(CODA_OSS_LIB_) && !defined(CODA_OSS_DLL_)
+ #error "One of CODA_OSS_LIB_ pr CODA_OSS_DLL_ must be #define'd'"
#endif
-#if defined(CODA_OSS_EXPORTS) && defined(CODA_OSS_LIB)
+#if defined(CODA_OSS_LIB_) && defined(CODA_OSS_DLL_)
+ #error "Both CODA_OSS_LIB_ and CODA_OSS_DLL_ are #define'd'"
+#endif
+#if defined(CODA_OSS_EXPORTS) && defined(CODA_OSS_LIB_)
#error "Can't export from a LIB'"
#endif
@@ -35,10 +43,10 @@
// We need to know whether we're consuming (importing) a DLL or static LIB
// The default is a static LIB as that's what existing code/builds expect.
- #ifdef CODA_OSS_DLL
+ #ifdef CODA_OSS_DLL_
// Actually, it seems that the linker is able to figure this out from the .LIB, so
// there doesn't seem to be a need for __declspec(dllimport). Clients don't
- // need to #define CODA_OSS_DLL ... ? Well, almost ... it looks
+ // need to #define CODA_OSS_DLL_ ... ? Well, almost ... it looks
// like __declspec(dllimport) is needed to get virtual "inline"s (e.g.,
// destructors) correct.
#define CODA_OSS_API CODA_OSS_library_import
@@ -50,5 +58,3 @@
#if defined(_MSC_VER)
#pragma warning(disable: 4251) // '...' : class '...' needs to have dll-interface to be used by clients of struct '...'
#endif
-
-#endif // CODA_OSS_config_Exports_h_INCLUDED_
diff --git a/externals/coda-oss/modules/c++/gsl/CMakeLists.txt b/externals/coda-oss/modules/c++/gsl/CMakeLists.txt
index 6f17aa779..10d694163 100644
--- a/externals/coda-oss/modules/c++/gsl/CMakeLists.txt
+++ b/externals/coda-oss/modules/c++/gsl/CMakeLists.txt
@@ -4,5 +4,3 @@ coda_add_module(
${MODULE_NAME}
VERSION 1.0
DEPS config-c++)
-
-
diff --git a/externals/coda-oss/modules/c++/hdf5.lite/include/hdf5/lite/SpanRC.h b/externals/coda-oss/modules/c++/hdf5.lite/include/hdf5/lite/SpanRC.h
index 9392890bb..aea2d9c51 100644
--- a/externals/coda-oss/modules/c++/hdf5.lite/include/hdf5/lite/SpanRC.h
+++ b/externals/coda-oss/modules/c++/hdf5.lite/include/hdf5/lite/SpanRC.h
@@ -20,22 +20,11 @@
*
*/
+#pragma once
#ifndef CODA_OSS_hdf5_lite_SpanRC_h_INCLUDED_
#define CODA_OSS_hdf5_lite_SpanRC_h_INCLUDED_
-#pragma once
-/*!
- * \file SpanRC.h
- *
- * This is a super-simple version of C++23's mdspan. It's here because 1) don't want widespread use, and
- * 2) CODA already has a View2D.
- */
-
-#include
-
-#include "config/Exports.h"
-#include "coda_oss/span.h"
-#include "types/RowCol.h"
+#include "coda_oss/mdspan.h"
namespace hdf5
{
@@ -43,71 +32,7 @@ namespace lite
{
template
-struct SpanRC final
-{
- using size_type = types::RowCol;
- using element_type = T;
- using pointer = T*;
- using reference = T&;
-
- SpanRC() = default;
- SpanRC(pointer p, size_type rc) noexcept : s_(p, rc.area()), rc_(rc)
- {
- }
- SpanRC(pointer p, size_t r, size_t c) noexcept : SpanRC(p, size_type(r, c))
- {
- }
- SpanRC(const SpanRC&) noexcept = default;
-
- constexpr pointer data() const noexcept
- {
- return s_.data();
- }
-
- /*constexpr*/ reference operator[](size_t idx) const noexcept
- {
- assert(idx < size()); // prevents "constexpr" in C++11
- return data()[idx];
- }
- /*constexpr*/ reference operator()(size_t r, size_t c) const noexcept
- {
- const auto offset = (r * dims().col) + c;
- return (*this)[offset];
- }
- /*constexpr*/ reference operator[](size_type idx) const noexcept
- {
- return (*this)(idx.row, idx.col);
- }
-
- constexpr size_t size() const noexcept
- {
- assert(s_.size() == rc_.area());
- return s_.size();
- }
- constexpr size_t area() const noexcept
- {
- return size();
- }
-
- constexpr size_type size_bytes() const noexcept
- {
- return s_.size_bytes();
- }
-
- constexpr bool empty() const noexcept
- {
- return s_.empty();
- }
-
- const auto& dims() const
- {
- return rc_;
- }
-
- private:
- coda_oss::span s_;
- types::RowCol rc_;
-};
+using SpanRC = coda_oss::mdspan>;
}
}
diff --git a/externals/coda-oss/modules/c++/hdf5.lite/include/hdf5/lite/highfive.h b/externals/coda-oss/modules/c++/hdf5.lite/include/hdf5/lite/highfive.h
index fb276e681..d5d91987b 100644
--- a/externals/coda-oss/modules/c++/hdf5.lite/include/hdf5/lite/highfive.h
+++ b/externals/coda-oss/modules/c++/hdf5.lite/include/hdf5/lite/highfive.h
@@ -56,10 +56,10 @@ inline auto vv_load(const H5Easy::File& file, const std::string& dataset_name)
template
inline HighFive::DataSet writeDataSet(H5Easy::File& file, const std::string& dataset_name, SpanRC data /*, TODO ...*/)
{
- const std::vector dims{data.dims().row, data.dims().col};
+ const std::vector dims{data.extent(0), data.extent(1)};
const HighFive::DataSpace dataspace{dims};
auto retval = file.createDataSet(dataset_name, dataspace);
- retval.write_raw(data.data());
+ retval.write_raw(data.data_handle());
return retval;
}
@@ -87,7 +87,7 @@ inline SpanRC readDataSet(const HighFive::DataSet& dataSet, std::vector& r
result.resize(dims.area());
dataSet.read(result.data());
- return SpanRC(result.data(), dims);
+ return SpanRC(result.data(), std::array{dims.row, dims.col});
}
template
diff --git a/externals/coda-oss/modules/c++/hdf5.lite/unittests/test_highfive.cpp b/externals/coda-oss/modules/c++/hdf5.lite/unittests/test_highfive.cpp
index f54526ab9..9fbfd7654 100644
--- a/externals/coda-oss/modules/c++/hdf5.lite/unittests/test_highfive.cpp
+++ b/externals/coda-oss/modules/c++/hdf5.lite/unittests/test_highfive.cpp
@@ -53,10 +53,11 @@ TEST_CASE(test_highfive_load)
{
std::vector lat;
const auto rc = hdf5::lite::loadDataSet(file, "/g4/lat", lat);
+ static_assert(decltype(rc)::rank() == 2, "wrong rank()");
TEST_ASSERT_EQ(lat.size(), 19);
- TEST_ASSERT_EQ(lat.size(), rc.area());
- TEST_ASSERT_EQ(rc.dims().row, 19);
- TEST_ASSERT_EQ(rc.dims().col, 1);
+ TEST_ASSERT_EQ(lat.size(), rc.size());
+ TEST_ASSERT_EQ(rc.extent(0), 19);
+ TEST_ASSERT_EQ(rc.extent(1), 1);
TEST_ASSERT_ALMOST_EQ(lat[0], -90.0);
TEST_ASSERT_ALMOST_EQ(lat[0], -lat[18]);
}
@@ -103,9 +104,9 @@ template
static auto read_complex(const HighFive::DataSet& r, const HighFive::DataSet& i)
{
std::vector r_result;
- hdf5::lite::readDataSet(r, r_result);
+ std::ignore = hdf5::lite::readDataSet(r, r_result);
std::vector i_result;
- hdf5::lite::readDataSet(i, i_result);
+ std::ignore = hdf5::lite::readDataSet(i, i_result);
return std::make_pair(r, i);
}
template
@@ -405,11 +406,11 @@ TEST_CASE(test_highfive_write)
const types::RowCol dims{10, 20};
std::vector data_(dims.area());
- const hdf5::lite::SpanRC data(data_.data(), dims);
+ hdf5::lite::SpanRC data(data_.data(), std::array{dims.row, dims.col});
double d = 0.0;
- for (size_t r = 0; r result;
const auto rc = hdf5::lite::loadDataSet(file, "/DS1", result);
- TEST_ASSERT(rc.dims() == dims);
+ TEST_ASSERT(rc.extent(0) == dims.row);
+ TEST_ASSERT(rc.extent(1) == dims.col);
TEST_ASSERT_EQ(dims.area(), result.size());
for (size_t i = 0; i < result.size(); i++)
{
diff --git a/externals/coda-oss/modules/c++/io/include/io/Serializable.h b/externals/coda-oss/modules/c++/io/include/io/Serializable.h
index e6d2363ae..4db6eeab7 100644
--- a/externals/coda-oss/modules/c++/io/include/io/Serializable.h
+++ b/externals/coda-oss/modules/c++/io/include/io/Serializable.h
@@ -19,10 +19,12 @@
* see .
*
*/
-
+#pragma once
#ifndef __IO_SERIALIZABLE_H__
#define __IO_SERIALIZABLE_H__
+#include "config/Exports.h"
+
#include "io/InputStream.h"
#include "io/OutputStream.h"
@@ -46,7 +48,7 @@ namespace io
* This object has a known derived type SOAPMessage, which is concretely
* defined to handle SOAP objects
*/
-struct Serializable
+struct CODA_OSS_API Serializable
{
Serializable() = default;
virtual ~Serializable() noexcept(false) {}
diff --git a/externals/coda-oss/modules/c++/logging/include/logging/Setup.h b/externals/coda-oss/modules/c++/logging/include/logging/Setup.h
index ed6334d6e..763767a49 100644
--- a/externals/coda-oss/modules/c++/logging/include/logging/Setup.h
+++ b/externals/coda-oss/modules/c++/logging/include/logging/Setup.h
@@ -20,6 +20,7 @@
*
*/
+#pragma once
#ifndef CODA_OSS_logging_Setup_h_INCLUDED_
#define CODA_OSS_logging_Setup_h_INCLUDED_
@@ -29,6 +30,7 @@
#include "mem/SharedPtr.h"
#include "logging/Logger.h"
#include "sys/filesystem.h"
+#include "config/Exports.h"
namespace logging
{
@@ -48,7 +50,7 @@ using path = coda_oss::filesystem::path; // still used in SWIG bindings
* \param logCount - number of rotating logs to keep (default: 0 no rotation)
* \param logBytes - number of bytes per rotating log (default: 0 no rotation)
*/
-std::unique_ptr setupLogger(
+CODA_OSS_API std::unique_ptr setupLogger(
const path& program,
const std::string& logLevel = "warning",
const path& logFile = "console",
diff --git a/externals/coda-oss/modules/c++/logging/source/Setup.cpp b/externals/coda-oss/modules/c++/logging/source/Setup.cpp
index 3c1c36363..345c6b516 100644
--- a/externals/coda-oss/modules/c++/logging/source/Setup.cpp
+++ b/externals/coda-oss/modules/c++/logging/source/Setup.cpp
@@ -53,8 +53,7 @@ logging::setupLogger(const path& program_,
// setup logging formatter
std::unique_ptr formatter;
const auto logFile = logFile_.string();
- auto file = logFile;
- str::lower(file);
+ const auto file = str::lower(logFile);
if (str::endsWith(file, ".xml"))
{
formatter.reset(
diff --git a/externals/coda-oss/modules/c++/pch.h b/externals/coda-oss/modules/c++/pch.h
index 7952e6efa..5cda65986 100644
--- a/externals/coda-oss/modules/c++/pch.h
+++ b/externals/coda-oss/modules/c++/pch.h
@@ -5,8 +5,13 @@
// Do not add files here that you will be updating frequently as this negates the performance advantage.
#pragma once
-#ifndef CODA_OSS_pch_h_INCLUDED_
-#define CODA_OSS_pch_h_INCLUDED_
+
+// We're building in Visual Studio ... used to control where we get a little bit
+// of config info
+#define CODA_OSS_PCH 1
+#ifndef CODA_OSS_LIBRARY_SHARED
+#define CODA_OSS_LIBRARY_SHARED 1
+#endif
#include "coda_oss/CPlusPlus.h"
#include "config/disable_compiler_warnings.h"
@@ -114,4 +119,3 @@ CODA_OSS_disable_warning_pop
#include "hdf5/lite/H5_.h"
#pragma comment(lib, "hdf5-c++.lib")
-#endif //CODA_OSS_pch_h_INCLUDED_
diff --git a/externals/coda-oss/modules/c++/plugin/include/plugin/ErrorHandler.h b/externals/coda-oss/modules/c++/plugin/include/plugin/ErrorHandler.h
index be7ca3c8a..248b61f46 100644
--- a/externals/coda-oss/modules/c++/plugin/include/plugin/ErrorHandler.h
+++ b/externals/coda-oss/modules/c++/plugin/include/plugin/ErrorHandler.h
@@ -19,7 +19,7 @@
* see .
*
*/
-
+#pragma once
#ifndef __PLUGIN_ERROR_HANDLER_H__
#define __PLUGIN_ERROR_HANDLER_H__
@@ -27,9 +27,11 @@
#include
#include
+#include "config/Exports.h"
+
namespace plugin
{
-class ErrorHandler
+class CODA_OSS_API ErrorHandler
{
public:
ErrorHandler() {}
@@ -47,7 +49,7 @@ class ErrorHandler
virtual void onPluginError(except::Context& c) = 0;
};
-class DefaultErrorHandler : public ErrorHandler
+class CODA_OSS_API DefaultErrorHandler : public ErrorHandler
{
public:
DefaultErrorHandler(logging::LoggerPtr logger = logging::LoggerPtr());
diff --git a/externals/coda-oss/modules/c++/sio.lite/include/sio/lite/FileHeader.h b/externals/coda-oss/modules/c++/sio.lite/include/sio/lite/FileHeader.h
index a5633e509..1a76c1676 100644
--- a/externals/coda-oss/modules/c++/sio.lite/include/sio/lite/FileHeader.h
+++ b/externals/coda-oss/modules/c++/sio.lite/include/sio/lite/FileHeader.h
@@ -19,6 +19,7 @@
* see .
*
*/
+#pragma once
#ifndef __SIO_LITE_FILE_HEADER_H__
#define __SIO_LITE_FILE_HEADER_H__
@@ -28,6 +29,7 @@
#include
#include
#include
+#include "config/Exports.h"
#include "sio/lite/UserDataDictionary.h"
#include "sio/lite/InvalidHeaderException.h"
#include "sio/lite/UnsupportedDataTypeException.h"
@@ -37,7 +39,7 @@ namespace sio
namespace lite
{
-class FileHeader
+class CODA_OSS_API FileHeader
{
public:
/** Unsigned byte data */
diff --git a/externals/coda-oss/modules/c++/sio.lite/include/sio/lite/FileReader.h b/externals/coda-oss/modules/c++/sio.lite/include/sio/lite/FileReader.h
index b94fbc1ae..885b3b68b 100644
--- a/externals/coda-oss/modules/c++/sio.lite/include/sio/lite/FileReader.h
+++ b/externals/coda-oss/modules/c++/sio.lite/include/sio/lite/FileReader.h
@@ -19,10 +19,6 @@
* see .
*
*/
-#ifndef CODA_OSS_sio_lite_FileReader_h_INCLUDED_
-#define CODA_OSS_sio_lite_FileReader_h_INCLUDED_
#pragma once
-
#include "sio/lite/SioFileReader.h"
-#endif // CODA_OSS_sio_lite_FileReader_h_INCLUDED_
diff --git a/externals/coda-oss/modules/c++/sio.lite/include/sio/lite/SioFileReader.h b/externals/coda-oss/modules/c++/sio.lite/include/sio/lite/SioFileReader.h
index 446476dfc..54fe31c32 100644
--- a/externals/coda-oss/modules/c++/sio.lite/include/sio/lite/SioFileReader.h
+++ b/externals/coda-oss/modules/c++/sio.lite/include/sio/lite/SioFileReader.h
@@ -19,12 +19,14 @@
* see .
*
*/
+#pragma once
#ifndef __SIO_LITE_FILE_READER_H__
#define __SIO_LITE_FILE_READER_H__
#include
#include
#include
+#include "config/Exports.h"
#include "sio/lite/InvalidHeaderException.h"
#include "sio/lite/StreamReader.h"
@@ -80,12 +82,9 @@ namespace lite
\endcode
*/
-class FileReader : public StreamReader, public io::Seekable
+class CODA_OSS_API FileReader : public StreamReader, public io::Seekable
{
-
-
public:
-
/** Constructor */
FileReader() : StreamReader() {}
diff --git a/externals/coda-oss/modules/c++/sio.lite/include/sio/lite/StreamReader.h b/externals/coda-oss/modules/c++/sio.lite/include/sio/lite/StreamReader.h
index 982b8900f..efa9897ff 100644
--- a/externals/coda-oss/modules/c++/sio.lite/include/sio/lite/StreamReader.h
+++ b/externals/coda-oss/modules/c++/sio.lite/include/sio/lite/StreamReader.h
@@ -19,10 +19,12 @@
* see .
*
*/
+#pragma once
#ifndef __SIO_LITE_STREAM_READER_H__
#define __SIO_LITE_STREAM_READER_H__
#include
+#include "config/Exports.h"
#include "sio/lite/FileHeader.h"
namespace sio
@@ -87,7 +89,7 @@ namespace lite
\endcode
*
*/
-class StreamReader : public io::InputStream
+class CODA_OSS_API StreamReader : public io::InputStream
{
public:
/** Constructor */
diff --git a/externals/coda-oss/modules/c++/std/include/import/std.h b/externals/coda-oss/modules/c++/std/include/import/std.h
index 32702da30..5c41ee61b 100644
--- a/externals/coda-oss/modules/c++/std/include/import/std.h
+++ b/externals/coda-oss/modules/c++/std/include/import/std.h
@@ -102,6 +102,7 @@ CODA_OSS_disable_warning_system_header_push
#include
#include
#include
+#include
CODA_OSS_disable_warning_pop
diff --git a/externals/coda-oss/modules/c++/std/include/std/mdspan b/externals/coda-oss/modules/c++/std/include/std/mdspan
new file mode 100644
index 000000000..b25c5447d
--- /dev/null
+++ b/externals/coda-oss/modules/c++/std/include/std/mdspan
@@ -0,0 +1,46 @@
+/* =========================================================================
+ * This file is part of std-c++
+ * =========================================================================
+ *
+ * © Copyright 2023, Maxar Technologies, Inc.
+ *
+ * std-c++ is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; If not, http://www.gnu.org/licenses/.
+ *
+ */
+#pragma once
+
+#include "coda_oss/mdspan.h"
+#include "coda_oss/CPlusPlus.h"
+
+// Make it (too?) easy for clients to get our various std:: implementations
+#ifndef CODA_OSS_NO_std_mdspan
+ #if CODA_OSS_cpp23
+ #include
+ #define CODA_OSS_NO_std_mdspan 1 // part of C++23
+ #else
+ #define CODA_OSS_NO_std_mdspan 0 // use our own
+ #endif
+#endif
+
+#if !CODA_OSS_NO_std_mdspan
+namespace std // This is slightly uncouth: we're not supposed to augment "std".
+{
+ using coda_oss::mdspan;
+ using coda_oss::dextents;
+}
+#ifndef __cpp_lib_mdspan
+#define __cpp_lib_mdspan 202002L // https://en.cppreference.com/w/cpp/feature_test#cpp_lib_mdspan
+#endif
+
+#endif // CODA_OSS_NO_std_mdspan
diff --git a/externals/coda-oss/modules/c++/str/include/str/Manip.h b/externals/coda-oss/modules/c++/str/include/str/Manip.h
index 0b48673a5..c9c96eb60 100644
--- a/externals/coda-oss/modules/c++/str/include/str/Manip.h
+++ b/externals/coda-oss/modules/c++/str/include/str/Manip.h
@@ -1,4 +1,4 @@
-/* =========================================================================
+/* =========================================================================
* This file is part of str-c++
* =========================================================================
*
@@ -34,6 +34,7 @@
#include "coda_oss/CPlusPlus.h"
#include "coda_oss/string.h"
#include "str/Convert.h"
+#include "str/W1252string.h"
namespace str
{
@@ -177,10 +178,71 @@ CODA_OSS_API std::vector split(const std::string& s,
const std::string& splitter = " ",
size_t maxSplit = std::string::npos);
+/***********************************************************************************/
//! Uses std::transform to convert all chars to lower case
//! Uses std::transform to convert all chars to upper case
-CODA_OSS_API void lower(std::string& s);
-CODA_OSS_API void upper(std::string& s);
+//CODA_OSS_API void lower(std::string& s);
+//CODA_OSS_API void upper(std::string& s);
+//
+// Using std::transform() with ::toupper() is considerably slower than a lookup-table
+CODA_OSS_API void ascii_lower(std::string& s);
+inline void lower(std::string& s)
+{
+ ascii_lower(s);
+}
+inline std::string lower(const std::string& s)
+{
+ std::string retval = s;
+ lower(retval);
+ return retval;
+}
+
+CODA_OSS_API void ascii_upper(std::string& s);
+inline void upper(std::string& s)
+{
+ ascii_upper(s);
+}
+inline std::string upper(const std::string& s)
+{
+ std::string retval = s;
+ upper(retval);
+ return retval;
+}
+
+// At this point, you might want to `lower()` and `upper()` for UTF-8 and/or
+// Windows-1252. That can be done, but ... our needs are mostly English (99.9%)
+// with a very occassional smattering of French (Canada). We've gotten by this
+// long without being able to upper/lower 'ä' and 'Ä' and there's no current
+// requirement to do so.
+//
+// Furthermore, while Windows-1252 is easy as it's a single-byte encoding and
+// covers many european languages, the standard is UTF-8.
+// Upper/lower-casing in Unicode is quite a bit more complicated as there can be
+// numerous rules for various languages. For example, in German, the "old
+// rules" where that 'ß' was uppercased to "SS"; however, there is now a 'ẞ'.
+// And then there are semantics: in German, no word can begin with 'ß' (or 'ẞ')
+// making "ßanything" rather non-sensical.
+//
+// So for now (until there is a real use case), just "define these problems
+// away" by not implementing `w1252_lower()`, `utf8_upper()`, etc.
+/*
+CODA_OSS_API void w1252_lower(std::string& s);
+CODA_OSS_API void w1252_upper(std::string& s);
+CODA_OSS_API void lower(str::W1252string& s);
+CODA_OSS_API void upper(str::W1252string& s);
+
+CODA_OSS_API void utf8_lower(std::string& s);
+CODA_OSS_API void utf8_upper(std::string& s);
+CODA_OSS_API void lower(coda_oss::u8string& s);
+CODA_OSS_API void upper(coda_oss::u8string& s);
+*/
+
+// I've already got these hooked up, keep the code around ... long ugly
+// names to discourage use.
+CODA_OSS_API str::Windows1252_T to_w1252_upper(str::Windows1252_T);
+CODA_OSS_API str::Windows1252_T to_w1252_lower(str::Windows1252_T);
+
+/***********************************************************************************/
/*!
* Replaces any characters that are invalid in XML (&, <, >, ', ") with their
diff --git a/externals/coda-oss/modules/c++/str/source/Encoding.cpp b/externals/coda-oss/modules/c++/str/source/Encoding.cpp
index eacc016d8..80603dae9 100644
--- a/externals/coda-oss/modules/c++/str/source/Encoding.cpp
+++ b/externals/coda-oss/modules/c++/str/source/Encoding.cpp
@@ -33,6 +33,7 @@
#include
#include
#include
+#include
#include "gsl/gsl.h"
#include "config/compiler_extensions.h"
@@ -65,59 +66,58 @@ CODA_OSS_disable_warning_pop
// Need to look up characters from \x80 (EURO SIGN) to \x9F (LATIN CAPITAL LETTER Y WITH DIAERESIS)
// in a map: http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1252.TXT
-inline coda_oss::u8string utf8_(uint32_t i)
+inline coda_oss::u8string utf8_(char32_t i)
{
const auto ch = gsl::narrow(i);
return str::to_u8string(std::u32string{ch});
}
-static const auto& Windows1252_x80_x9F_to_u8string()
-{
- static const std::map retval {
- {0x80, utf8_(0x20AC) } // EURO SIGN
- // , {0x81, replacement_character } // UNDEFINED
- , {0x82, utf8_(0x201A) } // SINGLE LOW-9 QUOTATION MARK
- , {0x83, utf8_(0x0192) } // LATIN SMALL LETTER F WITH HOOK
- , {0x84, utf8_(0x201E) } // DOUBLE LOW-9 QUOTATION MARK
- , {0x85, utf8_(0x2026) } // HORIZONTAL ELLIPSIS
- , {0x86, utf8_(0x2020) } // DAGGER
- , {0x87, utf8_(0x2021) } // DOUBLE DAGGER
- , {0x88, utf8_(0x02C6) } // MODIFIER LETTER CIRCUMFLEX ACCENT
- , {0x89, utf8_(0x2030) } // PER MILLE SIGN
- , {0x8A, utf8_(0x0160) } // LATIN CAPITAL LETTER S WITH CARON
- , {0x8B, utf8_(0x2039) } // SINGLE LEFT-POINTING ANGLE QUOTATION MARK
- , {0x8C, utf8_(0x0152) } // LATIN CAPITAL LIGATURE OE
- //, {0x8D, replacement_character } // UNDEFINED
- , {0x8E, utf8_(0x017D) } // LATIN CAPITAL LETTER Z WITH CARON
- //, {0x8F, replacement_character } // UNDEFINED
- //, {0x90, replacement_character } // UNDEFINED
- , {0x91, utf8_(0x2018) } // LEFT SINGLE QUOTATION MARK
- , {0x92, utf8_(0x2019) } // RIGHT SINGLE QUOTATION MARK
- , {0x93, utf8_(0x201C) } // LEFT DOUBLE QUOTATION MARK
- , {0x94, utf8_(0x201D) } // RIGHT DOUBLE QUOTATION MARK
- , {0x95, utf8_(0x2022) } // BULLET
- , {0x96, utf8_(0x2013) } // EN DASH
- , {0x97, utf8_(0x2014) } // EM DASH
- , {0x98, utf8_(0x02DC) } // SMALL TILDE
- , {0x99, utf8_(0x2122) } // TRADE MARK SIGN
- , {0x9A, utf8_(0x0161) } // LATIN SMALL LETTER S WITH CARON
- , {0x9B, utf8_(0x203A) } // SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
- , {0x9C, utf8_(0x0153) } // LATIN SMALL LIGATURE OE
- //, {0x9D, replacement_character } // UNDEFINED
- , {0x9E, utf8_(0x017E) } // LATIN SMALL LETTER Z WITH CARON
- , {0x9F, utf8_(0x0178) } // LATIN CAPITAL LETTER Y WITH DIAERESIS
+static const auto& Windows1252_x80_x9F_to_u8string_()
+{
+ static const std::map retval{
+ {U'\x80', utf8_(U'\x20AC')} // EURO SIGN
+ // , {U'\x81, replacement_character } // UNDEFINED
+ , {U'\x82', utf8_(U'\x201A') } // SINGLE LOW-9 QUOTATION MARK
+ , {U'\x83', utf8_(U'\x0192') } // LATIN SMALL LETTER F WITH HOOK
+ , {U'\x84', utf8_(U'\x201E') } // DOUBLE LOW-9 QUOTATION MARK
+ , {U'\x85', utf8_(U'\x2026') } // HORIZONTAL ELLIPSIS
+ , {U'\x86', utf8_(U'\x2020') } // DAGGER
+ , {U'\x87', utf8_(U'\x2021') } // DOUBLE DAGGER
+ , {U'\x88', utf8_(U'\x02C6') } // MODIFIER LETTER CIRCUMFLEX ACCENT
+ , {U'\x89', utf8_(U'\x2030') } // PER MILLE SIGN
+ , {U'\x8A', utf8_(U'\x0160') } // LATIN CAPITAL LETTER S WITH CARON
+ , {U'\x8B', utf8_(U'\x2039') } // SINGLE LEFT-POINTING ANGLE QUOTATION MARK
+ , {U'\x8C', utf8_(U'\x0152') } // LATIN CAPITAL LIGATURE OE
+ //, {U'\x8D, replacement_character } // UNDEFINED
+ , {U'\x8E', utf8_(U'\x017D') } // LATIN CAPITAL LETTER Z WITH CARON
+ //, {U'\x8F, replacement_character } // UNDEFINED
+ //, {U'\x90, replacement_character } // UNDEFINED
+ , {U'\x91', utf8_(U'\x2018') } // LEFT SINGLE QUOTATION MARK
+ , {U'\x92', utf8_(U'\x2019') } // RIGHT SINGLE QUOTATION MARK
+ , {U'\x93', utf8_(U'\x201C') } // LEFT DOUBLE QUOTATION MARK
+ , {U'\x94', utf8_(U'\x201D') } // RIGHT DOUBLE QUOTATION MARK
+ , {U'\x95', utf8_(U'\x2022') } // BULLET
+ , {U'\x96', utf8_(U'\x2013') } // EN DASH
+ , {U'\x97', utf8_(U'\x2014') } // EM DASH
+ , {U'\x98', utf8_(U'\x02DC') } // SMALL TILDE
+ , {U'\x99', utf8_(U'\x2122') } // TRADE MARK SIGN
+ , {U'\x9A', utf8_(U'\x0161') } // LATIN SMALL LETTER S WITH CARON
+ , {U'\x9B', utf8_(U'\x203A') } // SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
+ , {U'\x9C', utf8_(U'\x0153') } // LATIN SMALL LIGATURE OE
+ //, {U'\x9D, replacement_character } // UNDEFINED
+ , {U'\x9E', utf8_(U'\x017E') } // LATIN SMALL LETTER Z WITH CARON
+ , {U'\x9F', utf8_(U'\x0178') } // LATIN CAPITAL LETTER Y WITH DIAERESIS
};
return retval;
}
-
static auto Windows1252_to_u8string()
{
- auto retval = Windows1252_x80_x9F_to_u8string();
+ auto retval = Windows1252_x80_x9F_to_u8string_();
// Add the ISO8859-1 values to the map too. 1) We're already looking
// in the map anyway for Windows-1252 characters. 2) Need map
// entires for conversion from UTF-8 to Windows-1252.
- for (std::u32string::value_type ch = 0xA0; ch <= 0xff; ch++)
+ for (char32_t ch = U'\xA0'; ch <= U'\xff'; ch++)
{
// ISO8859-1 can be converted to UTF-8 with bit-twiddling
@@ -186,7 +186,14 @@ static void fromWindows1252_(str::W1252string::value_type ch, std::basic_string<
// If the input text contains a character that isn't defined in Windows-1252; return a
// "replacement character." Yes, this will **corrupt** the input data as information is lost:
// https://en.wikipedia.org/wiki/Specials_(Unicode_block)#Replacement_character
- static const coda_oss::u8string replacement_character = utf8_(0xfffd);
+ //
+ // Or ... https://en.wikipedia.org/wiki/Windows-1252
+ // > According to the information on Microsoft's and the Unicode
+ // > Consortium's websites, positions 81, 8D, 8F, 90, and 9D are
+ // > unused; however, the Windows API `MultiByteToWideChar` maps these
+ // > to the corresponding C1 control codes. The "best fit" mapping
+ // > documents this behavior, too.
+ static const coda_oss::u8string replacement_character = utf8_(U'\xfffd');
append(result, replacement_character);
}
else
@@ -229,7 +236,7 @@ inline void w1252to32(str::W1252string::const_pointer p, size_t sz, std::u32stri
}
template
-std::map kv_to_vk(const std::map& kv)
+auto kv_to_vk(const std::map& kv)
{
std::map retval;
for (const auto& p : kv)
diff --git a/externals/coda-oss/modules/c++/str/source/Manip.cpp b/externals/coda-oss/modules/c++/str/source/Manip.cpp
index f8dbce7db..1d6bae1c2 100644
--- a/externals/coda-oss/modules/c++/str/source/Manip.cpp
+++ b/externals/coda-oss/modules/c++/str/source/Manip.cpp
@@ -32,6 +32,7 @@
#include
#include
#include
+#include
#include "gsl/gsl.h"
@@ -40,7 +41,7 @@
namespace
{
-char transformCheck(int c, int (*transform)(int))
+inline char transformCheck(int c, int (*transform)(int))
{
// Ensure the character can be represented
// as an unsigned char or is 'EOF', as the
@@ -56,12 +57,12 @@ char transformCheck(int c, int (*transform)(int))
}
}
-char tolowerCheck(char c)
+inline char tolowerCheck(char c)
{
return transformCheck(c, tolower);
}
-char toupperCheck(char c)
+inline char toupperCheck(char c)
{
return transformCheck(c, toupper);
}
@@ -239,9 +240,8 @@ bool isAlphanumeric(const std::string& s)
bool isAsciiPrintable(const std::string& s)
{
- for (const auto& ch : s)
+ for (const auto& c : s)
{
- char c = ch;
if (c < 32 || c > 126)
return false;
}
@@ -290,24 +290,136 @@ std::vector split(const std::string& s,
return vec;
}
-template
-inline void transform(std::basic_string& s, Fn f)
+
+// Calling ::toupper() can be slow as the CRT might check for locales.
+// Since we only have 256 values, a lookup table is very fast and doesn't
+// use much memory.
+static const auto& make_lookup(std::array& result,
+ char (*to)(char))
+{
+ // For each of 256 values, record the corresponding tolower/toupper value;
+ // this makes converting very fast as no checking or arithmetic must be done.
+ for (size_t i = 0; i <= 0xff; i++)
+ {
+ const auto ch = to(static_cast(i));
+ result[i] = static_cast(ch);
+ }
+ return result;
+}
+
+template
+static void do_lookup(std::basic_string& s, const std::array& lookup)
{
- (void) std::transform(s.begin(), s.end(), s.begin(), f);
+ for (auto& ch : s)
+ {
+ const auto i = static_cast(ch);
+ ch = static_cast(lookup[i]);
+ }
}
-void lower(std::string& s)
+
+void ascii_upper(std::string& s)
{
- transform(s, tolowerCheck);
+ static std::array lookup_;
+ static const auto& lookup = make_lookup(lookup_, toupperCheck);
+ do_lookup(s, lookup);
+}
+
+void ascii_lower(std::string& s)
+{
+ static std::array lookup_;
+ static const auto& lookup = make_lookup(lookup_, tolowerCheck);
+ do_lookup(s, lookup);
+}
+
+inline char to_w1252_upper_(char ch)
+{
+ if ((ch >= 'a') && (ch <= 'z'))
+ {
+ return ch ^ 0x20; // ('a' - 'A');
+ }
+
+ // See chart at: https://en.wikipedia.org/wiki/Windows-1252
+ constexpr uint8_t s_with_caron = 0x9a /* š */;
+ constexpr uint8_t oe = 0x9c /* œ */;
+ constexpr uint8_t z_with_caron = 0x9e /* ž */;
+ constexpr uint8_t a_with_grave = 0xe0 /* à */;
+ constexpr uint8_t o_with_diaeresis = 0xf6 /* ö */;
+ constexpr uint8_t o_with_slash = 0xf8 /* ø */;
+ constexpr uint8_t small_thorn = 0xfe /* þ */;
+ constexpr uint8_t y_with_diaeresis = 0xff /* ÿ */;
+
+ const auto u8 = static_cast(ch);
+ if ((u8 == s_with_caron) || (u8 == oe) || (u8 == z_with_caron))
+ {
+ return ch ^ 0x10;
+ }
+ if ((u8 >= a_with_grave) && (u8 <= o_with_diaeresis))
+ {
+ return ch ^ 0x20;
+ }
+ if ((u8 >= o_with_slash) && (u8 <= small_thorn))
+ {
+ return ch ^ 0x20;
+ }
+ if (u8 == y_with_diaeresis)
+ {
+ constexpr uint8_t Y_with_diaeresis = 0x9f /* Ÿ */;
+ return Y_with_diaeresis;
+ }
+
+ return ch;
+}
+str::Windows1252_T to_w1252_upper(str::Windows1252_T ch)
+{
+ const auto retval = to_w1252_upper_(static_cast(ch));
+ return static_cast(retval);
+}
+
+inline char to_w1252_lower_(char ch)
+{
+ if ((ch >= 'A') && (ch <= 'Z'))
+ {
+ return ch | 0x20;
+ }
+
+ constexpr uint8_t S_with_caron = 0x8a /* Š */;
+ constexpr uint8_t OE = 0x8c /*Œ */;
+ constexpr uint8_t Z_with_caron = 0x8e /* Ž */;
+ constexpr uint8_t Y_with_diaeresis = 0x9f /* Ÿ */;
+ constexpr uint8_t A_with_grave = 0xc0 /* À */;
+ constexpr uint8_t O_with_diaeresis = 0xd6 /* Ö */;
+ constexpr uint8_t O_with_slash = 0xd8 /* Ø */;
+ constexpr uint8_t capital_thorn = 0xde /* Þ */;
+
+ const auto u8 = static_cast(ch);
+ if ((u8 == S_with_caron) || (u8 == OE) || (u8 == Z_with_caron))
+ {
+ return ch | 0x10;
+ }
+ if (u8 == Y_with_diaeresis)
+ {
+ constexpr uint8_t y_with_diaeresis = 0xff /* ÿ */;
+ return y_with_diaeresis;
+ }
+ if ((u8 >= A_with_grave) && (u8 <= O_with_diaeresis))
+ {
+ return ch | 0x20;
+ }
+ if ((u8 >= O_with_slash) && (u8 <= capital_thorn))
+ {
+ return ch | 0x20;
+ }
+ return ch;
}
-void upper(std::string& s)
+str::Windows1252_T to_w1252_lower(str::Windows1252_T ch)
{
- transform(s, toupperCheck);
+ const auto retval = to_w1252_lower_(static_cast(ch));
+ return static_cast(retval);
}
void escapeForXML(std::string& str)
{
- // & needs to be first or else it'll mess up the other characters that we
- // replace
+ // & needs to be first or else it'll mess up the other characters that we replace
replaceAll(str, "&", "&");
replaceAll(str, "<", "<");
replaceAll(str, ">", ">");
diff --git a/externals/coda-oss/modules/c++/str/unittests/test_base_convert.cpp b/externals/coda-oss/modules/c++/str/unittests/test_base_convert.cpp
index 3b951015a..c2ecf4f36 100644
--- a/externals/coda-oss/modules/c++/str/unittests/test_base_convert.cpp
+++ b/externals/coda-oss/modules/c++/str/unittests/test_base_convert.cpp
@@ -216,21 +216,18 @@ TEST_CASE(test_string_to_u8string_iso8859_1)
}
}
-template
-static void test_change_case_(const std::string& testName, const TString& lower, const TString& upper)
+template
+static void test_change_case_(const std::string& testName,
+ const std::basic_string& lower, const std::basic_string& upper)
{
- auto s = upper;
- str::lower(s);
+ auto s = str::lower(upper);
TEST_ASSERT(s == lower);
- s = lower;
- str::upper(s);
+ s = str::upper(lower);
TEST_ASSERT(s == upper);
- s = upper;
- str::upper(s);
+ s = str::upper(upper);
TEST_ASSERT(s == upper);
- s = lower;
- str::lower(s);
+ s = str::lower(lower);
TEST_ASSERT(s == lower);
}
TEST_CASE(test_change_case)
@@ -243,14 +240,16 @@ TEST_CASE(test_change_case)
//const std::wstring abc_w = L"abc";
//test_change_case_(testName, abc_w, ABC_w);
- //// Yes, this can really come up, "non classifié" is French (Canadian) for "unclassified".
- //const std::string DEF_1252{'D', '\xc9', 'F'}; // "DÉF" Windows-1252
- //const auto DEF8 = from_windows1252(DEF_1252);
+ // Yes, this can really come up, "non classifié" is French (Canadian) for "unclassified".
+ const std::string DEF_1252_{'D', '\xc9', 'F'}; // "DÉF" Windows-1252
+ const auto DEF_1252 = str::str(DEF_1252_);
+ const auto DEF8 = str::to_u8string(DEF_1252);
- //const std::string def_1252{'d', '\xe9', 'f'}; // "déf" Windows-1252
- //const auto def8 = from_windows1252(def_1252);
+ const std::string def_1252_{'d', '\xe9', 'f'}; // "déf" Windows-1252
+ const auto def_1252 = str::str(def_1252_);
+ const auto def8 = str::to_u8string(def_1252);
- ////test_change_case_(testName, def, DEF);
+ //test_change_case_(testName, def8, DEF8);
//test_change_case_(testName, def_1252, DEF_1252);
}
diff --git a/externals/coda-oss/modules/c++/str/unittests/test_str.cpp b/externals/coda-oss/modules/c++/str/unittests/test_str.cpp
index 2d00862d8..eb4821608 100644
--- a/externals/coda-oss/modules/c++/str/unittests/test_str.cpp
+++ b/externals/coda-oss/modules/c++/str/unittests/test_str.cpp
@@ -57,16 +57,78 @@ TEST_CASE(testData)
TEST_CASE(testUpper)
{
- std::string s = "test-something1";
+ const std::string s_ = "test-something1";
+ std::string s = s_;
+ TEST_ASSERT(str::eq(s, "TEST-SOMETHING1"));
str::upper( s);
TEST_ASSERT_EQ(s, "TEST-SOMETHING1");
+
+ //#if _WIN32
+ //s = "<×àa`öo\"øo/þb÷>";
+ //str::w1252_upper(s);
+ //TEST_ASSERT_EQ(s, "<×ÀA`ÖO\"ØO/ÞB÷>");
+ //#endif
+}
+
+TEST_CASE(test_toupper)
+{
+ for (uint16_t i = 0x20; i <= 0xff; i++) // uint16_t to avoid wrap-around
+ {
+ const auto w1252 = static_cast(i);
+ const auto w1252_upper = str::to_w1252_upper(w1252);
+
+ const auto w1252_lower = w1252 == w1252_upper ? w1252 : str::to_w1252_lower(w1252_upper); // round-trip
+ TEST_ASSERT_EQ(static_cast(w1252), static_cast(w1252_lower));
+
+ if (i <= 0x7f) // ASCII
+ {
+ const auto ch = static_cast(i);
+ const auto upper = toupper(ch);
+ TEST_ASSERT_EQ(static_cast(upper), static_cast(w1252_upper));
+
+ const auto lower = ch == upper ? ch : tolower(upper); // round-trip
+ TEST_ASSERT_EQ(ch, lower);
+ TEST_ASSERT_EQ(static_cast(lower), static_cast(w1252_lower));
+ }
+ }
}
TEST_CASE(testLower)
{
- std::string s = "TEST1";
- str::lower( s);
+ const std::string s_ = "TEST1";
+ std::string s = s_;
+ TEST_ASSERT(str::eq(s, "test1"));
+ str::lower(s);
TEST_ASSERT_EQ(s, "test1");
+
+ //#if _WIN32
+ //s = "[×ÀÖØÞ÷]";
+ //str::w1252_lower(s);
+ //TEST_ASSERT_EQ(s, "[×àöøþ÷]");
+ //#endif
+}
+
+TEST_CASE(test_tolower)
+{
+ for (uint16_t i = 0x20; i <= 0xff; i++) // uint16_t to avoid wrap-around
+ {
+ const auto w1252 = static_cast(i);
+ const auto w1252_lower = str::to_w1252_lower(w1252);
+
+ const auto w1252_upper = w1252 == w1252_lower ? w1252 : str::to_w1252_upper(w1252_lower); // round-trip
+ TEST_ASSERT_EQ(static_cast(w1252), static_cast(w1252_upper));
+
+ if (i <= 0x7f) // ASCII
+ {
+ const auto ch = static_cast(i);
+ const auto lower = tolower(ch);
+ TEST_ASSERT_EQ(static_cast(lower), static_cast(w1252_lower));
+
+ const auto upper = ch == lower ? ch : toupper(lower); // round-trip
+ TEST_ASSERT_EQ(ch, upper);
+ TEST_ASSERT_EQ(static_cast(upper), static_cast(w1252_upper));
+ }
+ }
}
TEST_CASE(test_eq_ne)
@@ -309,7 +371,9 @@ TEST_MAIN(
TEST_CHECK(testTrim);
TEST_CHECK(testData);
TEST_CHECK(testUpper);
+ TEST_CHECK(test_toupper);
TEST_CHECK(testLower);
+ TEST_CHECK(test_tolower);
TEST_CHECK(test_eq_ne);
TEST_CHECK(testReplace);
TEST_CHECK(testReplaceAllInfinite);
diff --git a/externals/coda-oss/modules/c++/sys/include/sys/DLL.h b/externals/coda-oss/modules/c++/sys/include/sys/DLL.h
index 28fbb6be5..c384a461b 100644
--- a/externals/coda-oss/modules/c++/sys/include/sys/DLL.h
+++ b/externals/coda-oss/modules/c++/sys/include/sys/DLL.h
@@ -20,7 +20,7 @@
*
*/
-
+#pragma once
#ifndef __SYS_DLL_H__
#define __SYS_DLL_H__
@@ -52,6 +52,7 @@ typedef void* DLL_FUNCTION_PTR;
#include "except/Exception.h"
#include "sys/Err.h"
+#include "config/Exports.h"
namespace sys
@@ -124,7 +125,7 @@ struct DLLException : public except::Exception
*/
-struct DLL
+struct CODA_OSS_API DLL
{
/*!
* Construct a library object, but dont populate or load it
diff --git a/externals/coda-oss/modules/c++/sys/include/sys/FileFinder.h b/externals/coda-oss/modules/c++/sys/include/sys/FileFinder.h
index 0485de3c8..e60ec8553 100644
--- a/externals/coda-oss/modules/c++/sys/include/sys/FileFinder.h
+++ b/externals/coda-oss/modules/c++/sys/include/sys/FileFinder.h
@@ -20,6 +20,7 @@
*
*/
+#pragma once
#ifndef __SYS_FILE_FINDER_H__
#define __SYS_FILE_FINDER_H__
@@ -37,7 +38,7 @@ namespace sys
/**
* Predicate interface for all entries
*/
-struct FilePredicate
+struct CODA_OSS_API FilePredicate
{
using argument_type = std::string;
using result_type = bool;
@@ -58,7 +59,7 @@ struct ExistsPredicate : FilePredicate
/**
* Predicate that matches files only (no directories)
*/
-struct FileOnlyPredicate: public FilePredicate
+struct CODA_OSS_API FileOnlyPredicate : public FilePredicate
{
virtual ~FileOnlyPredicate() = default;
virtual bool operator()(const std::string& entry) const override;
@@ -147,7 +148,7 @@ struct LogicalPredicate : public FilePredicate
* The FileFinder class allows you to search for
* files/directories in a clean way.
*/
-struct FileFinder final
+struct CODA_OSS_API FileFinder final
{
FileFinder() = default;
~FileFinder() = default;
@@ -167,7 +168,7 @@ struct FileFinder final
// until either the file is found or we stop at a ".git" directory.
//
// This (obviously) might take a while, so consider whether the result should be cached.
-coda_oss::filesystem::path findFirstFile(const coda_oss::filesystem::path& startingDirectory, const coda_oss::filesystem::path& filename);
+CODA_OSS_API coda_oss::filesystem::path findFirstFile(const coda_oss::filesystem::path& startingDirectory, const coda_oss::filesystem::path& filename);
coda_oss::filesystem::path findFirstDirectory(const coda_oss::filesystem::path& startingDirectory, const coda_oss::filesystem::path& dir);
// This is here most to avoid creating a new module for a few utility routines
@@ -175,11 +176,11 @@ namespace test // i.e., sys::test
{
// Try to find the specified "root" directory starting at the given path.
// Used by unittest to find sample files.
- coda_oss::filesystem::path findRootDirectory(const coda_oss::filesystem::path& p, const std::string& rootName,
+ CODA_OSS_API coda_oss::filesystem::path findRootDirectory(const coda_oss::filesystem::path& p, const std::string& rootName,
std::function isRoot);
- coda_oss::filesystem::path findCMakeBuildRoot(const coda_oss::filesystem::path& p);
- bool isCMakeBuild(const coda_oss::filesystem::path& p);
+ CODA_OSS_API coda_oss::filesystem::path findCMakeBuildRoot(const coda_oss::filesystem::path& p);
+ bool CODA_OSS_API isCMakeBuild(const coda_oss::filesystem::path& p);
coda_oss::filesystem::path findCMakeInstallRoot(const coda_oss::filesystem::path& p);
bool isCMakeInstall(const coda_oss::filesystem::path& p);
diff --git a/externals/coda-oss/modules/c++/sys/include/sys/Path.h b/externals/coda-oss/modules/c++/sys/include/sys/Path.h
index d7d950202..74d78af5c 100644
--- a/externals/coda-oss/modules/c++/sys/include/sys/Path.h
+++ b/externals/coda-oss/modules/c++/sys/include/sys/Path.h
@@ -27,13 +27,15 @@
#include
#include
#include
+#include
#include "config/Exports.h"
-
#include
+#include "coda_oss/span.h"
#include "sys/OS.h"
#include "sys/filesystem.h"
+#include "sys/Span.h"
/*!
@@ -295,6 +297,16 @@ class CODA_OSS_API Path
std::ostream& operator<<(std::ostream& os, const sys::Path& path);
std::istream& operator>>(std::istream& os, sys::Path& path);
+
+// Convert between collections of paths as strings and sys::filesystem::path
+CODA_OSS_API std::vector convertPaths(coda_oss::span);
+CODA_OSS_API std::vector convertPaths(coda_oss::span);
+template
+inline auto convertPaths(const std::vector& paths)
+{
+ return convertPaths(make_span(paths));
+}
+
}
#endif // CODA_OSS_sys_Path_h_INCLUDED_
diff --git a/externals/coda-oss/modules/c++/sys/include/sys/sys_filesystem.h b/externals/coda-oss/modules/c++/sys/include/sys/sys_filesystem.h
index 59df476a5..3cbab0837 100644
--- a/externals/coda-oss/modules/c++/sys/include/sys/sys_filesystem.h
+++ b/externals/coda-oss/modules/c++/sys/include/sys/sys_filesystem.h
@@ -79,6 +79,7 @@ struct CODA_OSS_API path final // N.B. this is an INCOMPLETE and NON-STANDARD im
{
*this = source;
}
+ ~path() = default;
path& operator=(const path&) = default;
path& operator=(path&&) = default;
diff --git a/externals/coda-oss/modules/c++/sys/source/AbstractOS.cpp b/externals/coda-oss/modules/c++/sys/source/AbstractOS.cpp
index dd22c3786..436e12bb6 100644
--- a/externals/coda-oss/modules/c++/sys/source/AbstractOS.cpp
+++ b/externals/coda-oss/modules/c++/sys/source/AbstractOS.cpp
@@ -86,29 +86,14 @@ AbstractOS::search(const std::vector& searchPaths,
return elementsFound;
}
-inline auto convert(const std::vector& paths)
-{
- std::vector retval;
- std::transform(paths.begin(), paths.end(), std::back_inserter(retval),
- [](const fs::path& p) { return p.string(); });
- return retval;
-}
-inline auto convert(const std::vector& paths)
-{
- std::vector retval;
- std::transform(paths.begin(), paths.end(), std::back_inserter(retval),
- [](const auto& p) { return p; });
- return retval;
-}
-
std::vector AbstractOS::search(
const std::vector& searchPaths,
const std::string& fragment,
const std::string& extension,
bool recursive) const
{
- const auto results = search(convert(searchPaths), fragment, extension, recursive);
- return convert(results);
+ const auto results = search(convertPaths(searchPaths), fragment, extension, recursive);
+ return convertPaths(results);
}
void AbstractOS::remove(const std::string& path) const
diff --git a/externals/coda-oss/modules/c++/sys/source/DateTime.cpp b/externals/coda-oss/modules/c++/sys/source/DateTime.cpp
index b6669002d..0679aed62 100644
--- a/externals/coda-oss/modules/c++/sys/source/DateTime.cpp
+++ b/externals/coda-oss/modules/c++/sys/source/DateTime.cpp
@@ -169,15 +169,13 @@ char* strptime(const char *buf, const char *fmt, struct tm& tm, double& millis)
// Full name.
len = DAY[i].size();
std::string day(bp, len);
- str::lower(day);
- if (day == DAY[i])
+ if (str::eq(day, DAY[i]))
break;
// Abbreviated name.
len = AB_DAY[i].size();
day = std::string(bp, len);
- str::lower(day);
- if (day == AB_DAY[i])
+ if (str::eq(day, AB_DAY[i]))
break;
}
@@ -202,15 +200,13 @@ char* strptime(const char *buf, const char *fmt, struct tm& tm, double& millis)
// Full name.
len = MONTH[i].size();
std::string month(bp, len);
- str::lower(month);
- if (month == MONTH[i])
+ if (str::eq(month, MONTH[i]))
break;
// Abbreviated name.
len = AB_MONTH[i].size();
month = std::string(bp, len);
- str::lower(month);
- if (month == AB_MONTH[i])
+ if (str::eq(month, AB_MONTH[i]))
break;
}
@@ -467,9 +463,7 @@ std::string sys::DateTime::dayOfWeekToStringAbbr(int dayOfWeek)
int sys::DateTime::monthToValue(const std::string& month)
{
- std::string m = month;
- str::lower(m);
-
+ const auto m = str::lower(month);
if (str::startsWith(m, "jan"))
return 1;
else if (str::startsWith(m, "feb"))
@@ -501,9 +495,7 @@ int sys::DateTime::monthToValue(const std::string& month)
int sys::DateTime::dayOfWeekToValue(const std::string& dayOfWeek)
{
- std::string d = dayOfWeek;
- str::lower(d);
-
+ const auto d = str::lower(dayOfWeek);
if (str::startsWith(d, "sun"))
return 1;
else if (str::startsWith(d, "mon"))
diff --git a/externals/coda-oss/modules/c++/sys/source/FileFinder.cpp b/externals/coda-oss/modules/c++/sys/source/FileFinder.cpp
index b33cc47c4..7edf1a512 100644
--- a/externals/coda-oss/modules/c++/sys/source/FileFinder.cpp
+++ b/externals/coda-oss/modules/c++/sys/source/FileFinder.cpp
@@ -56,12 +56,8 @@ bool sys::FragmentPredicate::operator()(const std::string& entry) const
{
if (mIgnoreCase)
{
- std::string base = entry;
- str::lower(base);
-
- std::string match = mFragment;
- str::lower(match);
-
+ const auto base = str::lower(entry);
+ const auto match = str::lower(mFragment);
return str::contains(base, match);
}
else
@@ -80,13 +76,10 @@ bool sys::ExtensionPredicate::operator()(const std::string& filename) const
if (!sys::FileOnlyPredicate::operator()(filename))
return false;
- std::string ext = sys::Path::splitExt(filename).second;
+ const std::string ext = sys::Path::splitExt(filename).second;
if (mIgnoreCase)
{
- std::string matchExt = mExt;
- str::lower(matchExt);
- str::lower(ext);
- return ext == matchExt;
+ return str::eq(ext, mExt);
}
else
return ext == mExt;
diff --git a/externals/coda-oss/modules/c++/sys/source/Path.cpp b/externals/coda-oss/modules/c++/sys/source/Path.cpp
index 4c91e6d18..99233b236 100644
--- a/externals/coda-oss/modules/c++/sys/source/Path.cpp
+++ b/externals/coda-oss/modules/c++/sys/source/Path.cpp
@@ -22,6 +22,7 @@
#include "sys/Path.h"
#include
+#include
#include
namespace fs = coda_oss::filesystem;
@@ -849,4 +850,20 @@ std::string Path::expandEnvironmentVariables(const std::string& path, fs::file_t
return expandEnvironmentVariables_(path, unused_checkIfExists, &type);
}
+template
+inline auto convertPaths_(coda_oss::span paths, TFunc fun)
+{
+ std::vector retval;
+ std::transform(paths.begin(), paths.end(), std::back_inserter(retval), fun);
+ return retval;
+}
+std::vector convertPaths(coda_oss::span paths)
+{
+ return convertPaths_(paths, [](const auto& p) { return p.string(); });
}
+std::vector convertPaths(coda_oss::span paths)
+{
+ return convertPaths_(paths, [](const auto& p) { return p; });
+}
+
+}
\ No newline at end of file
diff --git a/externals/coda-oss/modules/c++/tiff/include/tiff/FileReader.h b/externals/coda-oss/modules/c++/tiff/include/tiff/FileReader.h
index 88edb7c41..b80d50833 100644
--- a/externals/coda-oss/modules/c++/tiff/include/tiff/FileReader.h
+++ b/externals/coda-oss/modules/c++/tiff/include/tiff/FileReader.h
@@ -20,9 +20,9 @@
*
*/
+#pragma once
#ifndef CODA_OSS_tiff_FileReader_h_INCLUDED_
#define CODA_OSS_tiff_FileReader_h_INCLUDED_
-#pragma once
#include "tiff/TiffFileReader.h"
diff --git a/externals/coda-oss/modules/c++/tiff/include/tiff/FileWriter.h b/externals/coda-oss/modules/c++/tiff/include/tiff/FileWriter.h
index d77af0d6f..e86b03453 100644
--- a/externals/coda-oss/modules/c++/tiff/include/tiff/FileWriter.h
+++ b/externals/coda-oss/modules/c++/tiff/include/tiff/FileWriter.h
@@ -20,9 +20,9 @@
*
*/
+#pragma once
#ifndef CODA_OSS_tiff_FileWriter_h_INCLUDED_
#define CODA_OSS_tiff_FileWriter_h_INCLUDED_
-#pragma once
#include "tiff/TiffFileWriter.h"
diff --git a/externals/coda-oss/modules/c++/tiff/include/tiff/Header.h b/externals/coda-oss/modules/c++/tiff/include/tiff/Header.h
index ed9da4f1e..60b9e8b67 100644
--- a/externals/coda-oss/modules/c++/tiff/include/tiff/Header.h
+++ b/externals/coda-oss/modules/c++/tiff/include/tiff/Header.h
@@ -19,11 +19,13 @@
* see .
*
*/
-
+#pragma once
#ifndef __TIFF_HEADER_H__
#define __TIFF_HEADER_H__
#include
+#include
+
#include "tiff/Common.h"
namespace tiff
@@ -34,7 +36,7 @@ namespace tiff
* @class Header
* @brief Contains TIFF header information
*********************************************************************/
-class Header : public io::Serializable
+class CODA_OSS_API Header : public io::Serializable
{
public:
enum ByteOrder { MM, II };
diff --git a/externals/coda-oss/modules/c++/tiff/include/tiff/IFD.h b/externals/coda-oss/modules/c++/tiff/include/tiff/IFD.h
index 9120f581a..ea5493db3 100644
--- a/externals/coda-oss/modules/c++/tiff/include/tiff/IFD.h
+++ b/externals/coda-oss/modules/c++/tiff/include/tiff/IFD.h
@@ -19,14 +19,16 @@
* see .
*
*/
-
+#pragma once
#ifndef __TIFF_IFD_H__
#define __TIFF_IFD_H__
#include