diff --git a/UnitTest/CppUnitTestAssert.cpp b/UnitTest/CppUnitTestAssert.cpp index 9b2594ac58..73fadd0f0e 100644 --- a/UnitTest/CppUnitTestAssert.cpp +++ b/UnitTest/CppUnitTestAssert.cpp @@ -1,7 +1,7 @@ #include "pch.h" #include "TestCase.h" -#include "str/EncodedStringView.h" +#include "str/Encoding.h" using namespace Microsoft::VisualStudio::CppUnitTestFramework; @@ -37,7 +37,5 @@ void test::Assert::FailOnCondition(bool condition, const unsigned short* message std::wstring GetAssertMessage(bool equality, const std::wstring& expected, const std::wstring& actual, const wchar_t *message); // declare caller std::wstring test::Assert::GetAssertMessage(bool equality, const std::string& expected, const std::string& actual, const wchar_t *message) { - const str::EncodedStringView vExpected(expected); - const str::EncodedStringView vActual(actual); - return ::GetAssertMessage(equality, vExpected.wstring(), vActual.wstring(), message); // and call! + return ::GetAssertMessage(equality, str::toWString(expected), str::toWString(actual), message); // and call! } diff --git a/UnitTest/TestCase.h b/UnitTest/TestCase.h index 70666e5fce..f7e260bc51 100644 --- a/UnitTest/TestCase.h +++ b/UnitTest/TestCase.h @@ -5,7 +5,7 @@ #include "CppUnitTest.h" #include -#include +#include #undef TEST_CHECK #undef TEST_ASSERT @@ -89,7 +89,7 @@ inline void assert_almost_eq(const std::string& testName, long double X1, long d #define TEST_ASSERT_EQ_MSG(msg, X1, X2) testName, Microsoft::VisualStudio::CppUnitTestFramework::Logger::WriteMessage(msg.c_str()); TEST_ASSERT_EQ(X1, X2) #undef TEST_FAIL -#define TEST_FAIL(msg) { (void)testName; const str::EncodedStringView vw(msg); Microsoft::VisualStudio::CppUnitTestFramework::Assert::Fail(vw.wstring().c_str()); } +#define TEST_FAIL(msg) { (void)testName; const auto vw(str::toWString(msg)); Microsoft::VisualStudio::CppUnitTestFramework::Assert::Fail(vw.c_str()); } #undef TEST_EXCEPTION #undef TEST_THROWS diff --git a/UnitTest/pch.h b/UnitTest/pch.h index 2cb2d03796..0925dea43a 100644 --- a/UnitTest/pch.h +++ b/UnitTest/pch.h @@ -32,6 +32,7 @@ #pragma warning(disable: 5219) // implicit conversion from '...' to '...', possible loss of data #pragma warning(disable: 4514) // '...': unreferenced inline function has been removed #pragma warning(disable: 5039) // '...' : pointer or reference to potentially throwing function passed to 'extern "C"' function under -EHc. Undefined behavior may occur if this function throws an exception. +#pragma warning(disable: 5267) // definition of implicit copy constructor for '...' is deprecated because it has a user-provided destructor // TODO: get rid of these someday? ... from Visual Studio code-analysis #pragma warning(disable: 26495) // Variable '...' is uninitialized. Always initialize a member variable(type.6). @@ -63,7 +64,6 @@ #include #pragma warning(pop) #include -#include #include #include #include diff --git a/externals/nitro/modules/c++/nitf/include/nitf/Enum.hpp b/externals/nitro/modules/c++/nitf/include/nitf/Enum.hpp index aa6e0c8e3b..564b1b5252 100644 --- a/externals/nitro/modules/c++/nitf/include/nitf/Enum.hpp +++ b/externals/nitro/modules/c++/nitf/include/nitf/Enum.hpp @@ -32,7 +32,6 @@ #include // std::nothrow #include "str/Manip.h" -#include "str/EncodedStringView.h" namespace nitf { diff --git a/externals/nitro/modules/c++/pch.h b/externals/nitro/modules/c++/pch.h index e2236fd36e..03085c4ac3 100644 --- a/externals/nitro/modules/c++/pch.h +++ b/externals/nitro/modules/c++/pch.h @@ -70,6 +70,7 @@ CODA_OSS_disable_warning_pop #pragma warning(disable: 26458) // Prefer to use gsl::at() instead of unchecked subscript operator (bounds.4). #pragma warning(disable: 26486) // Don't pass a pointer that may be invalid to a function. Parameter '...' in call to '...' may be invalid (lifetime.3). #pragma warning(disable: 26487) // Don't return a pointer '...' that may be invalid(lifetime.4). +#pragma warning(disable: 5267) // definition of implicit copy constructor for '...' is deprecated because it has a user-provided destructor // Yes, these are our files ... but they don't change very often, and if they do // change we want to rebuild everything anyway. diff --git a/six/modules/c++/cphd/framework.h b/six/modules/c++/cphd/framework.h index de8d19e1eb..c8d501e901 100644 --- a/six/modules/c++/cphd/framework.h +++ b/six/modules/c++/cphd/framework.h @@ -32,6 +32,7 @@ #pragma warning(disable: 4514) // '...': unreferenced inline function has been removed #pragma warning(disable: 4127) // conditional expression is constant #pragma warning(disable: 5039) // '...' : pointer or reference to potentially throwing function passed to 'extern "C"' function under -EHc. Undefined behavior may occur if this function throws an exception. +#pragma warning(disable: 5267) // definition of implicit copy constructor for '...' is deprecated because it has a user-provided destructor // TODO: get rid of these someday? ... from Visual Studio code-analysis #pragma warning(disable: 26451) // Arithmetic overflow : Using operator '...' on a 4 byte value and then casting the result to a 8 byte value. Cast the value to the wider type before calling operator '*' to avoid overflow(io.2). diff --git a/six/modules/c++/cphd/source/CPHDXMLControl.cpp b/six/modules/c++/cphd/source/CPHDXMLControl.cpp index a6cc2628e7..34fcd42c87 100644 --- a/six/modules/c++/cphd/source/CPHDXMLControl.cpp +++ b/six/modules/c++/cphd/source/CPHDXMLControl.cpp @@ -27,11 +27,12 @@ #include #include #include +#include #include #include #include -#include +#include #include #include @@ -89,7 +90,7 @@ std::string CPHDXMLControl::toXMLString_( bool prettyPrint) { const auto result = toXMLString(metadata, schemaPaths, prettyPrint); - return str::EncodedStringView(result).native(); + return str::toString(result); } std::unique_ptr CPHDXMLControl::toXML( @@ -161,7 +162,7 @@ std::unique_ptr CPHDXMLControl::fromXML(const std::string& xmlString, std::transform(schemaPaths_.begin(), schemaPaths_.end(), std::back_inserter(schemaPaths), [](const std::string& s) { return s; }); - return fromXML(str::EncodedStringView(xmlString).u8string(), schemaPaths); + return fromXML(str::u8FromString(xmlString), schemaPaths); } std::unique_ptr CPHDXMLControl::fromXML(const std::u8string& xmlString, const std::vector& schemaPaths) diff --git a/six/modules/c++/cphd/source/Channel.cpp b/six/modules/c++/cphd/source/Channel.cpp index e9e6df6ad0..0fd49117f3 100644 --- a/six/modules/c++/cphd/source/Channel.cpp +++ b/six/modules/c++/cphd/source/Channel.cpp @@ -21,7 +21,9 @@ */ #include -#include +#include + +#include #include diff --git a/six/modules/c++/cphd03/framework.h b/six/modules/c++/cphd03/framework.h index 3d30b1f778..c68e0a7d83 100644 --- a/six/modules/c++/cphd03/framework.h +++ b/six/modules/c++/cphd03/framework.h @@ -30,6 +30,8 @@ #pragma warning(disable: 4514) // '...': unreferenced inline function has been removed #pragma warning(disable: 4127) // conditional expression is constant #pragma warning(disable: 5039) // '...' : pointer or reference to potentially throwing function passed to 'extern "C"' function under -EHc. Undefined behavior may occur if this function throws an exception. +#pragma warning(disable: 5267) // definition of implicit copy constructor for '...' is deprecated because it has a user-provided destructor + // TODO: get rid of these someday? ... from Visual Studio code-analysis #pragma warning(disable: 26495) // Variable '...' is uninitialized. Always initialize a member variable(type.6). diff --git a/six/modules/c++/cphd03/source/CPHDXMLControl.cpp b/six/modules/c++/cphd03/source/CPHDXMLControl.cpp index b83d441137..9b6223c8a8 100644 --- a/six/modules/c++/cphd03/source/CPHDXMLControl.cpp +++ b/six/modules/c++/cphd03/source/CPHDXMLControl.cpp @@ -21,12 +21,12 @@ */ #include -#include +#include #include #include #include -#include +#include #include #include @@ -70,11 +70,11 @@ std::u8string CPHDXMLControl::toXMLString(const Metadata& metadata) io::U8StringStream ss; doc->getRootElement()->print(ss); - return str::EncodedStringView("").u8string() + ss.stream().str(); + return str::u8FromString("") + ss.stream().str(); } std::string CPHDXMLControl::toXMLString_(const Metadata& metadata) { - return str::EncodedStringView(toXMLString(metadata)).native(); + return str::toString(toXMLString(metadata)); } size_t CPHDXMLControl::getXMLsize(const Metadata& metadata) @@ -493,7 +493,7 @@ XMLElem CPHDXMLControl::areaSampleDirectionParametersToXML( std::unique_ptr CPHDXMLControl::fromXML(const std::string& xmlString) { - auto result = fromXML(str::EncodedStringView(xmlString).u8string()); + auto result = fromXML(str::u8FromString(xmlString)); return std::unique_ptr(result.release()); } std::unique_ptr CPHDXMLControl::fromXML(const std::u8string& xmlString) diff --git a/six/modules/c++/samples/check_valid_six.dir/pch.h b/six/modules/c++/samples/check_valid_six.dir/pch.h index 9aa7d8f4d9..b058aa8b7b 100644 --- a/six/modules/c++/samples/check_valid_six.dir/pch.h +++ b/six/modules/c++/samples/check_valid_six.dir/pch.h @@ -29,6 +29,7 @@ #pragma warning(disable: 5219) // implicit conversion from '...' to '...', possible loss of data #pragma warning(disable: 4514) // '...': unreferenced inline function has been removed #pragma warning(disable: 5039) // '...' : pointer or reference to potentially throwing function passed to 'extern "C"' function under -EHc. Undefined behavior may occur if this function throws an exception. +#pragma warning(disable: 5267) // definition of implicit copy constructor for '...' is deprecated because it has a user-provided destructor // TODO: get rid of these someday? ... from Visual Studio code-analysis #pragma warning(disable: 26495) // Variable '...' is uninitialized. Always initialize a member variable(type.6). diff --git a/six/modules/c++/samples/crop_sicd.dir/pch.h b/six/modules/c++/samples/crop_sicd.dir/pch.h index 6d1b8d61de..9377720f70 100644 --- a/six/modules/c++/samples/crop_sicd.dir/pch.h +++ b/six/modules/c++/samples/crop_sicd.dir/pch.h @@ -29,6 +29,7 @@ #pragma warning(disable: 5219) // implicit conversion from '...' to '...', possible loss of data #pragma warning(disable: 4514) // '...': unreferenced inline function has been removed #pragma warning(disable: 5039) // '...' : pointer or reference to potentially throwing function passed to 'extern "C"' function under -EHc. Undefined behavior may occur if this function throws an exception. +#pragma warning(disable: 5267) // definition of implicit copy constructor for '...' is deprecated because it has a user-provided destructor // TODO: get rid of these someday? ... from Visual Studio code-analysis #pragma warning(disable: 26495) // Variable '...' is uninitialized. Always initialize a member variable(type.6). diff --git a/six/modules/c++/scene/framework.h b/six/modules/c++/scene/framework.h index 841b20cab8..8440b08481 100644 --- a/six/modules/c++/scene/framework.h +++ b/six/modules/c++/scene/framework.h @@ -30,6 +30,7 @@ #pragma warning(disable: 26458) // Prefer to use gsl::at() instead of unchecked subscript operator (bounds.4). #pragma warning(disable: 26823) // Dereferencing a possibly null pointer '...' (lifetime.1). #pragma warning(disable: 26822) // Dereferencing a null pointer 'me' (lifetime.1). +#pragma warning(disable: 5267) // definition of implicit copy constructor for '...' is deprecated because it has a user-provided destructor #include "nitro_pch.h" diff --git a/six/modules/c++/six.convert/framework.h b/six/modules/c++/six.convert/framework.h index 3a45780fc3..80ae27829f 100644 --- a/six/modules/c++/six.convert/framework.h +++ b/six/modules/c++/six.convert/framework.h @@ -10,6 +10,7 @@ #pragma warning(disable: 5045) // Compiler will insert Spectre mitigation for memory load if / Qspectre switch specified #pragma warning(disable: 4514) // '...': unreferenced inline function has been removed #pragma warning(disable: 5264) // '...': '...' variable is not used +#pragma warning(disable: 5267) // definition of implicit copy constructor for '...' is deprecated because it has a user-provided destructor #pragma warning(disable: 26812) // The enum type '...' is unscoped. Prefer '...' over '...' (Enum.3). diff --git a/six/modules/c++/six.sicd/framework.h b/six/modules/c++/six.sicd/framework.h index 654f5fa4b8..2e7b66b086 100644 --- a/six/modules/c++/six.sicd/framework.h +++ b/six/modules/c++/six.sicd/framework.h @@ -40,8 +40,9 @@ #pragma warning(disable: 6262) // Function uses '...' bytes of stack : exceeds analyze : stacksize '...'.Consider moving some data to heap. #pragma warning(disable: 26432) // If you define or delete any default operation in the type '...', define or delete them all(c.21). #pragma warning(disable: 26458) // Prefer to use gsl::at() instead of unchecked subscript operator (bounds.4). +#pragma warning(disable: 5267) // definition of implicit copy constructor for '...' is deprecated because it has a user-provided destructor -// too hard to get write with older C++11 compilers +// too hard to get right with older C++11 compilers #pragma warning(disable: 26497) // The function '...' could be marked constexpr if compile-time evaluation is desired(f.4). diff --git a/six/modules/c++/six.sicd/source/Antenna.cpp b/six/modules/c++/six.sicd/source/Antenna.cpp index 58c2ffbcc5..6c6f0bfdd8 100644 --- a/six/modules/c++/six.sicd/source/Antenna.cpp +++ b/six/modules/c++/six.sicd/source/Antenna.cpp @@ -21,8 +21,6 @@ */ #include -#include - #include namespace six diff --git a/six/modules/c++/six.sicd/source/Utilities.cpp b/six/modules/c++/six.sicd/source/Utilities.cpp index 1d4b299c3a..9ffa49c4f3 100644 --- a/six/modules/c++/six.sicd/source/Utilities.cpp +++ b/six/modules/c++/six.sicd/source/Utilities.cpp @@ -42,7 +42,7 @@ #include #include #include -#include +#include #include #include #include @@ -1023,7 +1023,7 @@ std::unique_ptr Utilities::parseDataFromString( const std::vector& schemaPaths_, logging::Logger& log) { - const auto xmlStr = str::EncodedStringView(xmlStr_).u8string(); + const auto xmlStr = str::u8FromString(xmlStr_); std::vector schemaPaths; std::transform(schemaPaths_.begin(), schemaPaths_.end(), std::back_inserter(schemaPaths), @@ -1048,7 +1048,7 @@ std::string Utilities::toXMLString(const ComplexData& data, [](const std::string& s) { return s; }); const auto result = toXMLString(data, &schemaPaths, logger); - return str::EncodedStringView(result).native(); + return str::toString(result); } std::u8string Utilities::toXMLString(const ComplexData& data, const std::vector* pSchemaPaths, logging::Logger* pLogger) diff --git a/six/modules/c++/six.sicd/unittests/test_valid_six.cpp b/six/modules/c++/six.sicd/unittests/test_valid_six.cpp index 0996727fcf..c40511f7df 100644 --- a/six/modules/c++/six.sicd/unittests/test_valid_six.cpp +++ b/six/modules/c++/six.sicd/unittests/test_valid_six.cpp @@ -22,7 +22,7 @@ #include -#include +#include #include #include #include @@ -35,7 +35,7 @@ #include #include #include -#include +#include #include #include @@ -152,13 +152,13 @@ TEST_CASE(valid_six_50x50) valid_six_50x50_(testName, &schemaPaths_); // "validate" against schema (use a default path) } -inline static std::string classificationText_iso8859_1() +inline static std::string classificationText_asIso8859_1() { - return std::string("NON CLASSIFI\xc9 / UNCLASSIFIED"); // ISO8859-1 "NON CLASSIFIÉ / UNCLASSIFIED" + return "NON CLASSIFI\xc9 / UNCLASSIFIED"; // ISO8859-1 "NON CLASSIFIÉ / UNCLASSIFIED" } -inline static std::string classificationText_utf_8() +inline static std::string classificationText_asUtf8() { - return std::string("NON CLASSIFI\xc3\x89 / UNCLASSIFIED"); // UTF-8 "NON CLASSIFIÉ / UNCLASSIFIED" + return "NON CLASSIFI\xc3\x89 / UNCLASSIFIED"; // UTF-8 "NON CLASSIFIÉ / UNCLASSIFIED" } TEST_CASE(sicd_French_xml) @@ -169,7 +169,7 @@ TEST_CASE(sicd_French_xml) const auto image = six::sicd::readFromNITF(inputPathname, &schemaPaths_, pComplexData); const six::Data* pData = pComplexData.get(); - const auto expectedCassificationText = sys::Platform == sys::PlatformType::Linux ? classificationText_utf_8() : classificationText_iso8859_1(); + const auto expectedCassificationText = sys::Platform == sys::PlatformType::Linux ? classificationText_asUtf8() : classificationText_asIso8859_1(); const auto& classification = pData->getClassification(); const auto actual = classification.getLevel(); TEST_ASSERT_EQ(actual, expectedCassificationText); @@ -218,9 +218,8 @@ static bool find_string(io::FileInputStream& stream, const std::string& s) stream.seek(pos, io::Seekable::START); return false; } -static void sicd_French_xml_raw_() +TEST_CASE(sicd_French_xml_raw) { - static const std::string testName("test_valid_six"); // This is a binary file with XML burried in it somewhere const auto path = six::testing::getNitfPath("sicd_French_xml.nitf"); @@ -234,13 +233,13 @@ static void sicd_French_xml_raw_() const auto& classificationXML = root.getElementByTagName("Classification", true /*recurse*/); // UTF-8 characters in sicd_French_xml.nitf - const auto expectedCharData = sys::Platform == sys::PlatformType::Linux ? classificationText_utf_8() : classificationText_iso8859_1(); + const auto expectedCharData = sys::Platform == sys::PlatformType::Linux ? classificationText_asUtf8() : classificationText_asIso8859_1(); auto expectedLength = expectedCharData.length(); const auto characterData = classificationXML.getCharacterData(); TEST_ASSERT_EQ(characterData.length(), expectedLength); TEST_ASSERT_EQ(characterData, expectedCharData); - const auto u8_expectedCharData8 = str::EncodedStringView::fromUtf8(classificationText_utf_8()).u8string(); + const std::u8string u8_expectedCharData8 = str::c_str(classificationText_asUtf8()); expectedLength = u8_expectedCharData8.length(); std::u8string u8_characterData; @@ -248,10 +247,6 @@ static void sicd_French_xml_raw_() TEST_ASSERT_EQ(u8_characterData.length(), expectedLength); TEST_ASSERT(u8_characterData == u8_expectedCharData8); } -TEST_CASE(sicd_French_xml_raw) -{ - sicd_French_xml_raw_(); -} static void test_assert(const six::sicd::ComplexData& complexData, six::PixelType expectedPixelType, size_t expectedNumBytesPerPixel) diff --git a/six/modules/c++/six.sidd/framework.h b/six/modules/c++/six.sidd/framework.h index ce6097d0f7..9007df4f2a 100644 --- a/six/modules/c++/six.sidd/framework.h +++ b/six/modules/c++/six.sidd/framework.h @@ -40,9 +40,10 @@ #pragma warning(disable: 6262) // Function uses '...' bytes of stack : exceeds analyze : stacksize '...'.Consider moving some data to heap. #pragma warning(disable: 26432) // If you define or delete any default operation in the type '...', define or delete them all(c.21). #pragma warning(disable: 26458) // Prefer to use gsl::at() instead of unchecked subscript operator (bounds.4). +#pragma warning(disable: 5267) // definition of implicit copy constructor for '...' is deprecated because it has a user-provided destructor -// too hard to get write with older C++11 compilers +// too hard to get right with older C++11 compilers #pragma warning(disable: 26497) // The function '...' could be marked constexpr if compile-time evaluation is desired(f.4). diff --git a/six/modules/c++/six.sidd/source/GeoTIFFReadControl.cpp b/six/modules/c++/six.sidd/source/GeoTIFFReadControl.cpp index 7317338041..693d2d2a8c 100644 --- a/six/modules/c++/six.sidd/source/GeoTIFFReadControl.cpp +++ b/six/modules/c++/six.sidd/source/GeoTIFFReadControl.cpp @@ -25,7 +25,7 @@ #include #include -#include +#include #include #include #include "six/sidd/GeoTIFFReadControl.h" @@ -59,7 +59,7 @@ void parseXMLEntry(const tiff::IFDEntry *entry, str::trim(curStr); if (!curStr.empty()) { - entries.emplace_back(str::EncodedStringView(curStr).u8string()); + entries.emplace_back(str::u8FromString(curStr)); curStr.clear(); } } @@ -75,7 +75,7 @@ void parseXMLEntry(const tiff::IFDEntry *entry, str::trim(curStr); if (!curStr.empty()) { - entries.emplace_back(str::EncodedStringView(curStr).u8string()); + entries.emplace_back(str::u8FromString(curStr)); } } } diff --git a/six/modules/c++/six.sidd/source/GeoTIFFWriteControl.cpp b/six/modules/c++/six.sidd/source/GeoTIFFWriteControl.cpp index f8346884d5..b25417f69e 100644 --- a/six/modules/c++/six.sidd/source/GeoTIFFWriteControl.cpp +++ b/six/modules/c++/six.sidd/source/GeoTIFFWriteControl.cpp @@ -27,7 +27,7 @@ #include #include "io/FileOutputStream.h" -#include "str/EncodedStringView.h" +#include "str/Encoding.h" #include "sys/Path.h" #include "gsl/gsl.h" #include "scene/GridECEFTransform.h" @@ -236,12 +236,12 @@ void GeoTIFFWriteControl::setupIFD(const DerivedData* data, tiff::IFDEntry* const xmlEntry = (*ifd)[Constants::GT_XML_TAG]; auto xml = six::toValidXMLString(data, schemaPaths, mLog); - xmlEntry->addValues(str::EncodedStringView(xml).native()); + xmlEntry->addValues(str::toString(xml)); for (size_t jj = 0; jj < mComplexData.size(); ++jj) { xml = six::toValidXMLString(mComplexData[jj], schemaPaths, mLog); - xmlEntry->addValues(str::EncodedStringView(xml).native()); + xmlEntry->addValues(str::toString(xml)); } } diff --git a/six/modules/c++/six.sidd/source/Utilities.cpp b/six/modules/c++/six.sidd/source/Utilities.cpp index e4f4f1474b..498b5e2a68 100644 --- a/six/modules/c++/six.sidd/source/Utilities.cpp +++ b/six/modules/c++/six.sidd/source/Utilities.cpp @@ -23,8 +23,9 @@ #include #include +#include -#include +#include #include "six/Utilities.h" #include "six/sidd/DerivedXMLControl.h" @@ -562,7 +563,7 @@ std::unique_ptr Utilities::parseDataFromFile(const std::filesystem: std::unique_ptr Utilities::parseDataFromString(const std::string& xmlStr_, const std::vector& schemaPaths_, logging::Logger& log) { - const auto xmlStr = str::EncodedStringView(xmlStr_).u8string(); + const auto xmlStr = str::u8FromString(xmlStr_); std::vector schemaPaths; std::transform(schemaPaths_.begin(), schemaPaths_.end(), std::back_inserter(schemaPaths), @@ -587,7 +588,7 @@ std::string Utilities::toXMLString(const DerivedData& data, [](const std::string& s) { return s; }); const auto result = toXMLString(data, &schemaPaths, logger); - return str::EncodedStringView(result).native(); + return str::toString(result); } std::u8string Utilities::toXMLString(const DerivedData& data, const std::vector* pSchemaPaths, logging::Logger* pLogger) diff --git a/six/modules/c++/six.sidd/unittests/test_valid_sixsidd.cpp b/six/modules/c++/six.sidd/unittests/test_valid_sixsidd.cpp index 34a4cf8420..c92f292179 100644 --- a/six/modules/c++/six.sidd/unittests/test_valid_sixsidd.cpp +++ b/six/modules/c++/six.sidd/unittests/test_valid_sixsidd.cpp @@ -74,7 +74,7 @@ static std::unique_ptr test_assert_round_trip(const std: const auto strXML = six::sidd::Utilities::toXMLString(derivedData, pSchemaPaths); TEST_ASSERT_FALSE(strXML.empty()); - const auto xml_ = str::EncodedStringView(strXML).native(); // for debugging + const auto xml_ = str::toString(strXML); // for debugging TEST_ASSERT_FALSE(xml_.empty()); return six::sidd::Utilities::parseDataFromString(strXML, pSchemaPaths); diff --git a/six/modules/c++/six/framework.h b/six/modules/c++/six/framework.h index af45cb1f25..6e4313cf8a 100644 --- a/six/modules/c++/six/framework.h +++ b/six/modules/c++/six/framework.h @@ -28,6 +28,7 @@ #pragma warning(disable: 26408) // Avoid malloc() and free(), prefer the nothrow version of new with delete (r.10). #pragma warning(disable: 26823) // Dereferencing a possibly null pointer '...' (lifetime.1). #pragma warning(disable: 26822) // Dereferencing a null pointer 'me' (lifetime.1). +#pragma warning(disable: 5267) // definition of implicit copy constructor for '...' is deprecated because it has a user-provided destructor // TODO: get rid of these someday? ... from Visual Studio code-analysis #pragma warning(disable: 26440) // Function '...' can be declared '...' (f.6). diff --git a/six/modules/c++/six/include/six/CollectionInformation.h b/six/modules/c++/six/include/six/CollectionInformation.h index 720b262215..e3726a4f01 100644 --- a/six/modules/c++/six/include/six/CollectionInformation.h +++ b/six/modules/c++/six/include/six/CollectionInformation.h @@ -19,14 +19,14 @@ * see . * */ +#pragma once #ifndef SIX_six_CollectionInformation_h_INCLUDED_ #define SIX_six_CollectionInformation_h_INCLUDED_ -#pragma once #include #include -#include +#include #include "six/Types.h" #include "six/Init.h" @@ -118,11 +118,11 @@ struct CollectionInformation virtual std::string getClassificationLevel() const; inline virtual void setClassificationLevel(const std::string& classification) { - mClassification = str::EncodedString(classification); + mClassification = str::u8FromString(classification); } - virtual void getClassificationLevel(str::EncodedString&) const; - virtual void setClassificationLevel(const str::EncodedString& classification); + virtual void getClassificationLevel(std::u8string&) const; + virtual void setClassificationLevel(const std::u8string& classification); //! Ostream operators for six::CollectionInformation type (utility only). friend std::ostream& operator<<(std::ostream& os, const six::CollectionInformation& c); @@ -137,7 +137,7 @@ struct CollectionInformation /*! * Classification level */ - str::EncodedString mClassification; + std::u8string mClassification; }; } diff --git a/six/modules/c++/six/include/six/XsElement.h b/six/modules/c++/six/include/six/XsElement.h index 26f3f7fa94..28acc57640 100644 --- a/six/modules/c++/six/include/six/XsElement.h +++ b/six/modules/c++/six/include/six/XsElement.h @@ -29,7 +29,6 @@ #include #include -#include #include #include @@ -150,7 +149,7 @@ inline std::ostream& operator<<(std::ostream& os, const XsElement& v) template <> inline std::ostream& operator<<(std::ostream& os, const XsElement& v) { - os << "\t" << v.tag() << "\t: " << str::EncodedStringView(v).native(); + os << "\t" << v.tag() << "\t: " << str::toString(value(v)); return os; } diff --git a/six/modules/c++/six/source/CollectionInformation.cpp b/six/modules/c++/six/source/CollectionInformation.cpp index e79fb22c22..587b388120 100644 --- a/six/modules/c++/six/source/CollectionInformation.cpp +++ b/six/modules/c++/six/source/CollectionInformation.cpp @@ -21,8 +21,6 @@ */ #include -#include - namespace six { CollectionInformation::CollectionInformation() @@ -50,13 +48,13 @@ CollectionInformation* CollectionInformation::clone() const std::string CollectionInformation::getClassificationLevel() const { - return mClassification.native(); + return str::toString(mClassification); } -void CollectionInformation::getClassificationLevel(str::EncodedString& result) const +void CollectionInformation::getClassificationLevel(std::u8string& result) const { result = mClassification; } -void CollectionInformation::setClassificationLevel(const str::EncodedString& classification) +void CollectionInformation::setClassificationLevel(const std::u8string& classification) { mClassification = classification; } diff --git a/six/modules/c++/six/source/NITFWriteControl.cpp b/six/modules/c++/six/source/NITFWriteControl.cpp index 06dd4e73f1..f3ffa98fd4 100644 --- a/six/modules/c++/six/source/NITFWriteControl.cpp +++ b/six/modules/c++/six/source/NITFWriteControl.cpp @@ -34,7 +34,6 @@ #include #include #include -#include #include #include @@ -569,7 +568,7 @@ void NITFWriteControl::addDataAndWrite(const std::vector& schemaPat const Data* data = getContainer()->getData(ii); const auto xml = six::toValidXMLString(data, schemaPaths, mLog, mXMLRegistry); - desStrs[ii] = str::EncodedStringView(xml).native(); + desStrs[ii] = str::toString(xml); nitf::SegmentWriter deWriter = mWriter.newDEWriter(gsl::narrow(ii)); nitf::SegmentMemorySource segSource(desStrs[ii], 0, 0, false); deWriter.attachSource(segSource); diff --git a/six/modules/c++/six/source/SICommonXMLParser.cpp b/six/modules/c++/six/source/SICommonXMLParser.cpp index df319c8a1a..cf38b8eb9d 100644 --- a/six/modules/c++/six/source/SICommonXMLParser.cpp +++ b/six/modules/c++/six/source/SICommonXMLParser.cpp @@ -1296,7 +1296,7 @@ void SICommonXMLParser::parseCollectionInformationFromXML( std::u8string classification_u8; if (parseString(classificationXML, classification_u8)) { - collInfo->setClassificationLevel(str::EncodedString(classification_u8)); + collInfo->setClassificationLevel(classification_u8); } else { diff --git a/six/modules/c++/six/source/Utilities.cpp b/six/modules/c++/six/source/Utilities.cpp index 3414e62017..fd12d2838a 100644 --- a/six/modules/c++/six/source/Utilities.cpp +++ b/six/modules/c++/six/source/Utilities.cpp @@ -27,7 +27,6 @@ #include #include -#include #include #include #include "six/Init.h" @@ -718,8 +717,7 @@ std::unique_ptr six::parseDataFromString(const XMLControlRegistry& xmlReg, std::transform(schemaPaths_.begin(), schemaPaths_.end(), std::back_inserter(schemaPaths), [](const std::string& s) { return s; }); - const str::EncodedStringView view(xmlStr); - auto result = parseDataFromString(xmlReg, view.u8string(), dataType, &schemaPaths, &log); + auto result = parseDataFromString(xmlReg, str::u8FromString(xmlStr), dataType, &schemaPaths, &log); return std::unique_ptr(result.release()); } diff --git a/six/modules/c++/six/source/XMLControlFactory.cpp b/six/modules/c++/six/source/XMLControlFactory.cpp index b0a5c88327..2807f8e39b 100644 --- a/six/modules/c++/six/source/XMLControlFactory.cpp +++ b/six/modules/c++/six/source/XMLControlFactory.cpp @@ -25,7 +25,6 @@ #include "six/XMLControlFactory.h" #include #include -#include #include "six/Data.h" using namespace six; @@ -83,7 +82,7 @@ std::string six::toXMLString_(const Data* data, const six::XMLControlRegistry* xmlRegistry) { const auto result = toXMLString(data, xmlRegistry); - return str::EncodedStringView(result).native(); + return str::toString(result); } template diff --git a/six/projects/csm/source/SICDSensorModel.cpp b/six/projects/csm/source/SICDSensorModel.cpp index 38746eb563..3d0d1bb9b5 100644 --- a/six/projects/csm/source/SICDSensorModel.cpp +++ b/six/projects/csm/source/SICDSensorModel.cpp @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/six/projects/csm/tests/utilities.h b/six/projects/csm/tests/utilities.h index 6c0934ee55..ce410802b9 100644 --- a/six/projects/csm/tests/utilities.h +++ b/six/projects/csm/tests/utilities.h @@ -23,7 +23,6 @@ #include #include -#include #include #include @@ -138,7 +137,7 @@ inline std::unique_ptr constructIsd(const std::string& pathname, // The DES's data is just the XML string const auto xml = six::toXMLString(data, ®istry); - des.setData(str::EncodedStringView(xml).native()); + des.setData(str::toString(xml)); nitfIsd->addFileDes(des); return nitfIsd;