From fc1f59799a3082a3c1605dd9a6c3dd12ce2412d3 Mon Sep 17 00:00:00 2001 From: "J. Daniel Smith" Date: Mon, 28 Aug 2023 16:19:33 -0400 Subject: [PATCH] latest from CODA-OSS (#578) * latest from CODA-OSS * CRLF * Squashed 'externals/coda-oss/' changes from e87c32b4de..5b892bf5f7 5b892bf5f7 release 2023-08-18 (#723) 0b1327d1e6 restore mem::AutoPtr; too much of a hassle moving it to numpyutils :-( (#722) 7691adb566 normalize line endings (#721) b7d50efdd9 update to HDF5 1.14.2 (#720) fcc96ec699 Update .gitattributes (#719) bb82a94c9e xerces-c 3.2.4 (#718) ef4ad7cf39 Update to e2fsprogs 1.47.0 (#717) b4ca18a114 fix compiler warning about order of operations a5df5b823d update to HighFive 2.7.1 (#716) 4109ee5d20 `mem::AutoPtr` is only for Python bindings (#715) 00d843f873 remove hdf5.lite (#714) 443dd38255 Reduce compiler warnings, speed up builds (#713) d60861821d get optional working with partial C++17 (#712) d5bd0d8045 "warning STL4036: is removed in C++20." c19ece7f90 Don't interfere with a partial C++20 implementation (#711) 065e86ddcb operator==() for QName (#710) 1c16380ced remove zint* typedefs; don't want to encourage use of types::Complex (#709) 6dd2479918 our optional<> is now closer to C++17 (#708) 87ac617396 strict checking on `std::complex` is too much of a hassle for now 034d52c863 overloads to byte-swap type::Complex are too much trouble (#707) 42d449c334 sys::byteSwap overloads for types::Complex (#705) 4092fd8e76 remove work-around for NITRO bug (#704) e2472acfc1 build in NITRO and SIX (#703) 32ccf91052 Use same build paths as Visual Studio (#701) 366ac9f43f Another round of removing compiler warnings (#702) a7f8ef2605 Fix compile warnings from building CODA (#700) f70b4202f1 account for coda-oss.vcxproj being in other SLNs af3faebfc6 Remove more compiler/code-analysis warnings (#699) 82be2a6db2 unittests should work w/o install (#698) dbb90a06d9 add msbuild for coda-oss.sln (#697) 5a417140a6 reduce compiler warnings (#696) 288619dfa3 all modules now part of coda-oss.vcxproj (#695) c2fc5fc660 add more projects to coda-oss-lite.vcxproj (#694) ceb86c186e support $(PlatformToolset) as a "special" environment variable (#693) d78a8595a7 OS::getSIMDInstructionSet() utility (#692) 2d2df467da fix `python3 waf dumplib` 54033e70e3 Merge branch 'main' into feature/complex_short 3c63f9f65e std::numbers from C++20 (#691) 892dd0e00f ComplexInteger and ComplexReal to better match existing naming conventions (#690) b3872181ec match coda-oss naming conventions (#688) 704d6867f9 beef-up our complex type (#687) 47c1c1cd66 check is_absolute() for URLs (#686) c042373e16 be sure our Path::isAbolute() matches std::filesystem::path::absolute() (#684) ad10286bc0 volatile is about "special" memory, not threading (#685) f4d42005fa fix build error in NITRO ff11a5557e keep using std::complex for now (#682) c88b9c0532 types::complex (#681) d1244a0804 don't need our own make_unique in C++14 (#680) aeec0131c5 assert()s for mem::CopyablePtr (#679) 72b0ebd603 add types::complex_short (#678) 932130a580 patch to build other projects c00c1f203d coda-oss release 2023-06-06 (#677) ef54bbcd53 remove more compiler warnings (#676) dadfc5ce62 distinguish between byte-swapping a buffer and single value (#674) 90187f6cd8 more xml.lite tweaks for SIDD-3.0/ISM (#675) eb99607720 stronger type-checking for byteSwap() (#673) ff4f820ed8 xml.lite tweaks to support SIDD 3.0 ISM (#672) b1de8c0e5e std::byte should be a unique type (#671) c05bf9a028 allow enums to be byte-swapped too 1f9fd88d6d remove spurious 47684c45b8 byteSwap now uses byte buffers (#670) cbc659db27 add swapBytes() utility from SIX (#669) 891481b64f simplify byte-swapping (#668) 540ae763e5 more byteSwap() tweaks 0774c03c46 threaded byteSwap() (#667) d156370d36 swapping a single-byte value makes no sense c120e3255d be sure parameter is used to avoid compiler warning e85ec93317 --output-on-failure for CTest (#666) e80376197b turn off "there is no warning number" warning c5f0a5d154 A C-string may not be NULL-terminated (#665) 0c5eb29ae7 use platform-specific routines for byteSwap() (#664) 0b7d581fa6 remove transform_async() (#663) f6489b6bef Merge branch 'main' into feature/xml.lite_tweaks 836c426a2b use function-pointers so that isConsoleOutput is only checked once 56e3c45b1b move depthPrint() functionality into non-member function in preparation for future changes ddcd26d972 Merge branch 'main' into feature/xml.lite_tweaks 69cc0e5063 use the more rigorous create_and_check_datatype() 9efb875584 Merge branch 'main' into feature/hdf5 4d2f2f4173 more HighFive unittests (#662) 14191a844a HighFive::create_datatype() goes from C++ to HighFive 98583473fb utility routines to read string attributes 1fa75ce81e use the C API to read a string attribute 71e7b69f54 still can't figure out how to read a string attribute :-( e96f37a69b test reading the file attributes a25244519c getAttribute() unittest 8f12a3000b getDataType() unittest 857ff0af32 HighFive utility routines (#661) 1d687db57b writeDataSet() utility overload 106aa68945 sigh ... H5Easy::dump() fill fails on Windows/WAF :-( 2641b60b2b Merge branch 'main' into feature/hdf5 35c19e7e81 change actions to @v3 (#660) 212bbd3a36 works on local machine, but not build server ... ? 7125118b09 dump of 1D vector doesn't work :-( c704db4352 sigh ... WAF build still failing :-( 01aae46163 does dump() of a 1D vector work? 76a53c8134 comment-out H5 writing :-( 0f0e19affe test_highfive_dump() cb8f737957 trying to get highfive_dump() unittest working w/Windows-WAF 6584a264af does test_highfive_create() work? cde6147ced tweak HighFive wrappers (#659) 3165668545 Revert "trying HighFive "write" unittests again" a9ec24ca4d trying HighFive "write" unittests again 585ad49a56 tweak names of utility routines 4c91a4d97a make it easier to read a std::vector and std::vecotr 0217ffa26c readDataSet() now works for 1D data 95e8973f29 trying to get hdf5::lite::load() working 4d294611d4 "const" correctness 5e6305c3f7 fix load_complex() 4a134dc5f1 start work on utility routines to read complex data from HDF5 9d76a7f41e Merge branch 'main' into feature/hdf5 8f9667a240 whitepsace ebd3fc99ea Merge branch 'main' into feature/hdf5 40091b069c comment-out writing tests for now ... need to figure our WAF bulid failure 935aa34592 be sure the dataset has real data 114b9bf33c update release notes bd9c0b26c5 tweak HighFive utility routines acda1ef577 turn off diagnostics around expected failures 22a7488402 readDataSet() utility routine for HighFive bd88a8c256 HighFive writeDataSet() utility to work with our SpanRC 6142f5b339 use HighFive routines to write a HDF5 file 5bbf1abaff Use HiveFive routines to get info about the file 84fbc83789 duplicate unittests with H5Easy f1f054c03a Merge branch 'main' into feature/hdf5 9b63ca470c fix directory names f6f826689a fix directory names 7aeb82c336 Merge branch 'main' into feature/hdf5 d028baaebd hook up HighFive header-only library (#653) 3083b0a313 Revert "HighFive 2.6.2" 246985a7f0 Revert ""build" HighFive HDF5 library" a8b75a5865 Revert "turn off HighFive Boost support" ec68d5f830 Revert "Add HighFive unittests" f1f85b9e7f Revert "get test_high_five_base more-or-less compiling" 5ea634ee15 Revert "more work on getting HighFive unittests to build" ecc45433c7 more work on getting HighFive unittests to build bb194788ab get test_high_five_base more-or-less compiling d42bde0004 Add HighFive unittests ddc86bb328 turn off HighFive Boost support b255122d4f "build" HighFive HDF5 library 396cc3ef2a HighFive 2.6.2 5e5f9d9c0f Merge branch 'main' into feature/hdf5 ee938b4a52 changes from SIX bb764df90b Merge branch 'main' into feature/xml.lite_tweaks de2a243800 make derived classes 'final' if possible 14e19bcd21 Change xml lite function to virtual (#645) 8f42ac8e9e Merge branch 'main' into feature/xml.lite_tweaks 18ad90645f hdf5Write unittest 3462e11792 createFile() and writeFile() overloads ecee81d532 fix typos 197eecfa62 sketch-out hdf5::lite::writeFile() bd2311795e use SpanRC for writeFile(), not yet implemented ea9af75109 simple SpanRC to hold a 2D-size and pointer 027c19ee8a createFile() unittest 1f9d07ecbc hook up createFile() 8c7e4473f0 start hooking up HDF5 writing 146e0bea3b Merge branch 'main' into feature/hdf5 88ca9fcb7f Merge branch 'main' into feature/hdf5 42b604b463 Squashed commit of the following: 10ee602c25 Merge branch 'main' into feature/hdf5 67aa42b69d restore changes from "main" 8bbfcbfbfe unittests can be simplified to match fewer "view" classes 126bb802ea Merge branch 'main' into feature/hdf5 3f8ba7a423 again, don't need a class just to convert from std::vector<> to std::span<> 24c2b489c8 Squashed commit of the following: 2703c119d4 Squashed commit of the following: 9d5228a2be don't need an entire class just to convert a std::vector<> into std::span<> 51bc931dcd Merge branch 'main' into feature/hdf5 a84f258160 Squashed commit of the following: c4d2ed696e add missing #include guards, fix type in existing #include guard d541525a01 use a single ComplexViewConstIterator for all views 86e6a459fe CODA_OSS_disable_warning causes GCC errors :-( 5d4b9c2cb6 only need an custom iterator for ComplexSpansView d9f0fb1286 hook up iterators b9329e4db0 initial pass at a ComplexViewConstIterator 6352388739 remove compiler warning about unused "constexpr" variables b39f6096fb use the casing from H5 to make copy/pasting code slightly easier 0887b13eb4 Merge branch 'main' into feature/hdf5 bd07df1cae Consistent casing for Dataset, Datatype, Dataspace 7acd30ee23 tweak hdf5.lite dependencies 38ab914dfd Jupyter notebook for creating H5 files 95a040e0bf _small.h5 is now (correctly) FLOAT32 107e7c4876 make a simple values() member function to avoid template magic e1feca9194 use TEST_SPECIFIC_EXCEPTION macro instead of try/catch 7383336888 readDatasetT() now throws for the wrong buffer type 6b2cc25294 Merge branch 'feature/hdf5' of github.com:mdaus/coda-oss into feature/hdf5 310f8fd3d5 can't get template magic right for copy_axis() 86b306d596 stepping through copy ctors in the debugger is annoying f243e92d68 trying to make wrong type of buffer fail 2b10d96529 read in new sample file a28e59d8c5 help the compiler with type deduction 49bf5e9bc2 nested_complex_float_data_small.h5 e029325fc0 utility routines to "deconstruct" and array of std::complex dede3bd393 Merge branch 'main' into feature/hdf5 904b1ef5ec tweak class names, make_() and copy() utility routines 8237b9efbf make it harder to pass the wrong types to ComplexViews 4d9aeda2cd ComplexArrayView and ComplexParallelView utility classes f5e367dfa6 test std::span> a4a2844f26 read in the nested "i" and "r" data 1156152650 sample file has subgroups 8e1b7869aa Merge branch 'feature/hdf5' of github.com:mdaus/coda-oss into feature/hdf5 9f4232a1dd update sample H5 file 8c55db73ae walk through HDF5 sub-groups 7775ed9c43 Update 123_barfoo_catdog_cx.h5 677975d7ca Matlab code to create sample H5 file a0e7dfe07b Update test_hdf5info.cpp 0b67e1602f pass __FILE__ and __LINE__ from calling site for a more accurate exception message 86a6773213 skeleton for more sample data 85f79b0999 Merge branch 'main' into feature/hdf5 18088e9421 Merge branch 'main' into feature/hdf5 3a1d17692f Merge branch 'main' into feature/hdf5 1755c69d70 Merge branch 'main' into feature/hdf5 9ad015432d No more "11" suffix on exception names c20d962511 Squashed commit of the following: c88cee999b other values to be filled-in bca4a4ecd8 incorporation NamedObject from HDF5 docs 61fa68f72e groupInfo() 460e7d7665 datasetInfo() 14eb9b764b start filling in DatasetInfo afe5f1c3a0 start to fill in DatasetInfo 77a968c72d start filling in GroupInfo d81bcdfd92 openGroup() to open groups (loc) a0cd294697 comment-out "dataset" unittest for now 86e0060245 begin filling in FileInfo 366dda6ab6 a return_type_of utility is needed to deduce the return type e219282638 explicitly pass return type to template 4937ccd11d template to reduce boilerplate when calling try_catch_H5Exceptions b3b5ebde78 use new exception utility routines ea1c03ef0c put exception handling/conversion in a utility routine 819a99d397 utility routine for exception handling 6f34eea979 put utilities in a separate file for easier reuse fcbde4f241 break utility routines into smaller pieces for easier reuse 52358ea8a9 WIN32 no longer automatically defined? 5a42864722 Revert "build HDF5 with C89" 680e599e9d build HDF5 with C89 a87a071218 Merge branch 'main' into feature/hdf5 8447c1a900 Revert "sym-links instead of copying files" db3b5e12b4 Merge branch 'main' into feature/xml.lite_tweaks fb60b5696f Merge branch 'main' into feature/hdf5 5110a5cc81 Comments about _u and _q 1a937d32cf Merge branch 'main' into feature/xml.lite_tweaks fa06f04d7e get ready for hdf5.lite enhancdements b040c7c437 sym-links instead of copying files aa431bb477 use _u for xml::lite::Uri 3d0c6d58ce fix case-sensitive #include filename 93dcd0e527 operator() for getElementByName() 75a93af859 more operator[] overloads to make attribute management easier 4ab8216f87 user-defined string literals to remove some noise around xml::lite::QName f82f0b0fc6 Merge branch 'main' into feature/xml.lite_tweaks ae30e36443 Merge branch 'feature/xml.lite_tweaks' of github.com:mdaus/coda-oss into feature/xml.lite_tweaks ffdd9beb0b simplify attribute creation 9bf5414f5d simplify attribute creation 82d7a4e959 SWIG gets confused about namespaces 7a61d0741f fix bug on Element ctor uncovered by unittest fdd7e58c1a QName is also in the xerces namespace which confuses SWIG bindings a325b7053b operator+=() overload for addChild daf30e6c0e Merge branch 'feature/xml.lite_tweaks' of github.com:mdaus/coda-oss into feature/xml.lite_tweaks b887d2b476 provide overloads for Element& rather than creating new "reference" types 1fa6bba388 rename test_xmleasy.cpp 7c8c9e0f1c += overload 850da6f63d overload for std::string 4547fc5a75 use UIT-8 strings for characterData 4723462a3b convenient addChild() overloads e48720753a copy over ElementReference from xml.easy a4ca30a0d6 Merge branch 'main' into feature/xml.lite_tweaks 6ae9f0b715 Revert "check-in of new xml.easy (to move code between computers)" f7466a6d75 Revert "simple routines for single element" a5490230d6 Revert "make some operators simplier ways of calling functions" c9a25630a6 Revert "get document creation working" 8af8710b05 Revert "free functions instead of member functions" 16c3847cb2 Revert "ElementReference distinct from Element" 7d68e156ff Revert "ElementMutableReference" 00eb2a2826 Merge branch 'main' into feature/xml.lite_tweaks a42969c1f4 ElementMutableReference a20ae9355e ElementReference distinct from Element 14eeeea0b5 free functions instead of member functions 4aae014b39 get document creation working 8835692699 make some operators simplier ways of calling functions 053bd1212a simple routines for single element 8bf701a2ea check-in of new xml.easy (to move code between computers) 41f959051c unittests for creating XML documents from scratch 9752d50ae2 Merge branch 'main' into feature/xml.lite_tweaks 1531d57095 by default, don't validate strings passed to Uri() 46d13d4bf7 Merge branch 'master' into feature/xml.lite_tweaks 39b547d321 remove more vestiges of Expat and LibXML ec8274d524 remove LibXML and Expat as they're no longer used/supported. 20eeefeef6 Merge branch 'master' into feature/xml.lite_tweaks 95074b9b1a update for newer Intel compiler 7024f71e1b Merge branch 'master' into feature/xml.lite_tweaks 57b1cbc83d Merge branch 'master' into feature/xml.lite_tweaks 4b67561c3d remove validate() overload that nobody is using fa15f1e5dc Squashed commit of the following: 1484a90909 test the new validate() API 470da70fb8 hookup StringStreamT routines 2cddf25047 begin hooking up validate() overloads 1b5d910f38 overload validate() for UTF-8 and Windows-1252 03309b8c9f Squashed commit of the following: b72c6c5bf2 older compiler doesn't like our make_unique af8f00307f validate UTF-8 XML on Linux 211188613e unit-test for LEGACY XML validation 3c1169d2b5 Squashed commit of the following: 3afff19cad std::filesystem::path for FileInputStreamOS 908d452f8f WIP: validate all of our sample XML files 00f9bb16bc validate against a XML schema 243d8c356c Merge branch 'master' into feature/xml.lite_tweaks 2815d707d9 fix to work with SWIG bindings. :-( 4608621326 trying (again) to remove vestiages of old code e3c83a8587 Revert "new code should use UTF-8" 811207c920 new code should use UTF-8 0ffd835f96 Squashed commit of the following: 1e7e03ded0 Merge branch 'master' into feature/xml.lite_tweaks c1d806affa Merge branch 'master' into feature/xml.lite_tweaks 850d3c811d str::strip() that can be easier to use than str::trim() 580ba9c8c3 explicitly =delete move 2b39831a80 Squashed commit of the following: 39eebdc23f Merge branch 'master' into feature/xml.lite_tweaks 9adf86cbaf force calling new UTF-8 write() routines ea61b62045 Merge branch 'master' into feature/xml.lite_tweaks 8a34583fa0 overload to take schemaPaths as filesystem::path 8671b442f7 parse XML embedded in a binary file ec4a902f14 updates from xerces.lite 80dc4d9635 updates from xerces.lite 549766d6c1 Attributes::contains() no longer catches an exception 8a645ceac3 need "sys/" when building in other environments 36af082690 super-simple URI validation 78ef28a3e2 SWIG bindings are a PITA! :-( e9cba8491e SWIG needs help with Uri 8a8d8dc072 another routines used by pre-build SWIG bindings 818e1ec5d3 pre-build SWIG bindings use getElementByTagName() member function 067cac5d85 old compiler gets confused on unadorned QName ba92c0ae7e more use of Uri and QName 446c7d17a7 use QName in new code d6f8b0c836 more direct use of QName 90fff1c737 use xml::lite::QName instead of tuple 646cbb5ed4 more direct use of QName and Uri ba589ea3b3 make QName more robust bab0ee8b5e createElement() -> addNewElement() e3a145747a grab changes from six-library 32285e95c4 Merge branch 'master' into feature/xml.lite_tweaks 9f79f0bf62 Merge branch 'master' into feature/xml.lite_tweaks a12bbc32c6 make it easier to create new Elements with a value fc9967f986 make it easy for callers to addChild() keep a reference to the Element 4627766b7d be sure test_xmlparser works in "externals" of other projects bf22763961 "private" is part of the name-mangling fad92bcc8f making sure copy-ctor is implemented f90fdcead0 consolidate common XML test code 9fc53f2d51 use str:: utility for casting 6da6f794bb still trying to find the right macro for SWIG 0c1b86c566 still trying to fix SWIG fdc6fc9bd6 trying to fix SWIG build error 7835e8c270 SWIG needs copy-ctor 585695942d disable copy/assignment for Element, it's probably almost always wrong 391fed6135 fix double-delete caused by copying 61790fe695 retry parsing XML with Windows-1252 if first parse() fails 63cffac59e change string_encoding to match coda-oss style of PascalCase 010479bbec read an XML file we know is wrongly encoded as Windows-1252 9a05050621 more references instead of pointers 2d44b69519 Reading Windows-1252 w/o "encoding" fails 63dc7b0762 read Windows-1252 too c9434c9cbe test as UIT-8 too f310ccf0cf get reading from UTF-8 XML working on Windows 1fa39c2be0 get testReadUtf8XmlFile working on Linux 1a83cd8157 sys::Path is too much trouble right now ed60aa22c9 unit-test to read XML from a file a9336db7c6 Squashed commit of the following: 0825beb0d3 Merge branch 'master' into feature/xml.lite_tweaks c618489be7 Merge branch 'master' into feature/xml.lite_tweaks e8e4b8fe1d determine string_encoding based on platform 1f43bcfc26 create a new Element by using the platform to determine "characterData" encoding 961bef66b4 Merge branch 'master' into feature/xml.lite_tweaks e9798a5cba fix static_assert() 6f77728748 Merge branch 'master' into feature/xml.lite_tweaks b98d4f5a91 Merge branch 'master' into feature/xml.lite_tweaks 1b5abba2a6 The (old) version of SWIG we're using doesn't like certain C++11 features. 53bdeabaf7 Merge branch 'master' into feature/xml.lite_tweaks 60cf8ae80f "" doesn't work with decltype() in older C++ 97e72477a5 reduce getValue() overloads by making "key" a template argument 5e6373e557 reduce code duplication f9e7cfeee5 provide castValue instead of getValue(T&) cbd0bd8f24 castValue throws instead of returning a bool like getValue(T&) 87c7514fce Merge branch 'master' into feature/xml.lite_tweaks 10cc61223a make getElement*() consistent for zero or >1 results f5b137e3cd Merge branch 'master' into feature/xml.lite_tweaks 1765efc622 allow clients to specify toType() and toString() for getValue() and setValue() df8b746e12 allow clients to specify their own toType/toString routines 66702726ad Merge branch 'master' into feature/xml.lite_tweaks 6956311f14 Merge branch 'master' into feature/xml.lite_tweaks d505f3593a Merge branch 'master' into feature/xml.lite_tweaks fbd106115f catch a BadCastException and return false from getValue() 3a78377b55 use a template to reduce duplicated code 0ad4b86062 Merge branch 'master' into feature/xml.lite_tweaks a848aa3a20 get & set the characer data as a type f3ee1ee12a utility routines to set an attribute value 5952276839 templates to get an attribute value convert to a specific type 06639227b3 miised a change in last commit 1aa458ef8b add getValue() overloads that return true/false rather than throwing faa6d30752 added getElementByTagName() overloads as that's a very common use-case git-subtree-dir: externals/coda-oss git-subtree-split: 5b892bf5f7b99a50b53e47c8b9f9f736940ab939 * latest from CODA-OSS * CODA-OSS removed EncodedStringView.h * str::format changes from CODA-OSS * str::format changes from CODA-OSS * latest from CODA-OSS * latest from CODA-OSS * suppress new compiler warning * Squashed 'externals/coda-oss/' changes from 5b892bf5f7..bf7ae4a718 bf7ae4a718 use overloads rather than varargs for std::format() (#727) 22e0502076 utility routines to reduce duplicated code (#726) a5ea606471 remove str::EncodedStringView (#725) 168cbae01b reduce differences between 'main' and 'cpp17' (#724) git-subtree-dir: externals/coda-oss git-subtree-split: bf7ae4a718bd97a55ed37d2dd0a514deebc97776 --- .../modules/c++/cli/include/cli/Value.h | 5 +- .../modules/c++/cli/source/ArgumentParser.cpp | 23 ++-- externals/coda-oss/modules/c++/pch.h | 4 +- .../include/plugin/BasicPluginManager.h | 2 +- .../modules/c++/str/include/str/Format.h | 114 +++++++++++++++--- .../modules/c++/str/source/Format.cpp | 16 +-- .../modules/c++/sys/source/OSUnix.cpp | 2 +- .../modules/c++/sys/source/OSWin32.cpp | 2 +- .../c++/xml.lite/source/Attributes.cpp | 3 +- modules/c++/nitf/tests/test_extract.cpp | 2 +- .../nitf/tests/test_j2k_nitf_read_region.cpp | 4 +- .../c++/nitf/unittests/test_j2k_loading++.cpp | 4 +- modules/c++/pch.h | 1 + 13 files changed, 126 insertions(+), 56 deletions(-) diff --git a/externals/coda-oss/modules/c++/cli/include/cli/Value.h b/externals/coda-oss/modules/c++/cli/include/cli/Value.h index 6c72fa108..571565cab 100644 --- a/externals/coda-oss/modules/c++/cli/include/cli/Value.h +++ b/externals/coda-oss/modules/c++/cli/include/cli/Value.h @@ -106,10 +106,7 @@ class CODA_OSS_API Value { if (index >= mValues.size()) throw except::IndexOutOfRangeException( - Ctxt( - FmtX( - "Invalid index: %d", - index))); + Ctxt(FmtX("Invalid index: %d", index))); return str::toType(mValues[index]); } diff --git a/externals/coda-oss/modules/c++/cli/source/ArgumentParser.cpp b/externals/coda-oss/modules/c++/cli/source/ArgumentParser.cpp index be702484e..3694e7ed3 100644 --- a/externals/coda-oss/modules/c++/cli/source/ArgumentParser.cpp +++ b/externals/coda-oss/modules/c++/cli/source/ArgumentParser.cpp @@ -317,8 +317,7 @@ std::unique_ptr cli::ArgumentParser::parse(const std::string& prog std::map& flagMap = (subOption ? shortOptionsFlags : shortFlags); if (flagMap.find(op) != flagMap.end()) - parseError(FmtX("Conflicting option: %c%s", mPrefixChar, - op.c_str())); + parseError(FmtX("Conflicting option: %c%s", mPrefixChar, op)); flagMap[op] = arg; } for (std::vector::const_iterator it = @@ -328,8 +327,7 @@ std::unique_ptr cli::ArgumentParser::parse(const std::string& prog std::map& flagMap = (subOption ? longOptionsFlags : longFlags); if (flagMap.find(op) != flagMap.end()) - parseError(FmtX("Conflicting option: %c%c%s", mPrefixChar, - mPrefixChar, op.c_str())); + parseError(FmtX("Conflicting option: %c%c%s", mPrefixChar, mPrefixChar, op)); flagMap[op] = arg; } } @@ -458,8 +456,7 @@ std::unique_ptr cli::ArgumentParser::parse(const std::string& prog } else { - throw except::Exception(Ctxt( - FmtX("Invalid option: [%s]", argStr.c_str()))); + throw except::Exception(Ctxt(FmtX("Invalid option: [%s]", argStr))); } } } @@ -500,8 +497,7 @@ std::unique_ptr cli::ArgumentParser::parse(const std::string& prog } else { - throw except::Exception(Ctxt( - FmtX("Invalid option: [%s]", argStr.c_str()))); + throw except::Exception(Ctxt(FmtX("Invalid option: [%s]", argStr))); } } @@ -549,10 +545,7 @@ std::unique_ptr cli::ArgumentParser::parse(const std::string& prog } if (!added) - parseError( - FmtX( - "option requires value or has exceeded its max: [%s]", - argVar.c_str())); + parseError(FmtX("option requires value or has exceeded its max: [%s]", argVar)); currentResults->put(argVar, v); break; @@ -677,11 +670,9 @@ std::unique_ptr cli::ArgumentParser::parse(const std::string& prog if (arg->isRequired() || numGiven > 0) { if (minArgs > 0 && numGiven < static_cast(minArgs)) - parseError(FmtX("not enough arguments, %d required: [%s]", - minArgs, argId.c_str())); + parseError(FmtX("not enough arguments, %d required: [%s]", minArgs, argId)); if (maxArgs >= 0 && numGiven > static_cast(maxArgs)) - parseError(FmtX("too many arguments, %d supported: [%s]", - maxArgs, argId.c_str())); + parseError(FmtX("too many arguments, %d supported: [%s]", maxArgs, argId)); } diff --git a/externals/coda-oss/modules/c++/pch.h b/externals/coda-oss/modules/c++/pch.h index 236c1100a..7952e6efa 100644 --- a/externals/coda-oss/modules/c++/pch.h +++ b/externals/coda-oss/modules/c++/pch.h @@ -103,10 +103,10 @@ CODA_OSS_disable_warning_pop // change we want to rebuild everything anyway. #include "gsl/gsl.h" #include "config/Exports.h" +#include "mem/SharedPtr.h" +#include "sys/filesystem.h" #include "except/Throwable.h" #include "sys/Conf.h" -#include "sys/filesystem.h" -#include "mem/SharedPtr.h" #include "xml/lite/xerces_.h" #pragma comment(lib, "xerces-c") diff --git a/externals/coda-oss/modules/c++/plugin/include/plugin/BasicPluginManager.h b/externals/coda-oss/modules/c++/plugin/include/plugin/BasicPluginManager.h index c82944681..738dabe94 100644 --- a/externals/coda-oss/modules/c++/plugin/include/plugin/BasicPluginManager.h +++ b/externals/coda-oss/modules/c++/plugin/include/plugin/BasicPluginManager.h @@ -279,7 +279,7 @@ template class BasicPluginManager for (unsigned int i = 0; ops[i] != nullptr; i++) oss << ops[i] << ":"; eh->onPluginVersionUnsupported( - FmtX("For plugin supporting ops %s version [%d.%d] not supported (%d.%d)", + str::Format("For plugin supporting ops %s version [%d.%d] not supported (%d.%d)", oss.str().c_str(), majorVersion, minorVersion, mMajorVersion, mMinorVersion ) diff --git a/externals/coda-oss/modules/c++/str/include/str/Format.h b/externals/coda-oss/modules/c++/str/include/str/Format.h index 240943807..20df7a024 100644 --- a/externals/coda-oss/modules/c++/str/include/str/Format.h +++ b/externals/coda-oss/modules/c++/str/include/str/Format.h @@ -21,23 +21,20 @@ */ -#ifndef __STR_FORMAT_H__ -#define __STR_FORMAT_H__ +#pragma once +#ifndef CODA_OSS_str_Format_h_INCLUDED_ +#define CODA_OSS_str_Format_h_INCLUDED_ #include +#include +#include + #include #include "config/Exports.h" namespace str { - -/*! - * \param format The format - * \param ... Any printf like thing - */ -CODA_OSS_API std::string format(const char* format, ...); - struct CODA_OSS_API Format final { Format(const char* format, ...); @@ -47,14 +44,99 @@ struct CODA_OSS_API Format final return mString; } - operator std::string& () noexcept - { - return mString; - } - -protected: +private: std::string mString; }; +/*! + * \param format The format + * \param ... Any printf like thing + */ +//CODA_OSS_API std::string format(const char* format, ...); + +inline std::string format(const char* format) +{ + return Format(format); +} + +inline std::string format(const char* format, const char* pStr) +{ + return Format(format, pStr); +} +inline std::string format(const char* format, const std::string& s) +{ + return Format(format, s.c_str()); +} +inline std::string format(const char* format, int i) +{ + return Format(format, i); +} +inline std::string format(const char* format, uint32_t i) +{ + return Format(format, i); +} +inline std::string format(const char* format, ptrdiff_t l) +{ + return Format(format, l); +} +inline std::string format(const char* format, size_t ul) +{ + return Format(format, ul); +} +inline std::string format(const char* format, float f) +{ + return Format(format, f); +} + +inline std::string format(const char* format, char ch, const char* pStr) +{ + return Format(format, ch, pStr); +} +inline std::string format(const char* format, char ch, const std::string& s) +{ + return Format(format, ch, s.c_str()); +} +inline std::string format(const char* format, const std::string& s1, const std::string& s2) +{ + return Format(format, s1.c_str(), s2.c_str()); +} +inline std::string format(const char* format, const std::string& s, size_t ul) +{ + return Format(format, s.c_str(), ul); +} +inline std::string format(const char* format, char ch1, char ch2) +{ + return Format(format, ch1, ch2); +} +inline std::string format(const char* format, size_t ul1, size_t ul2) +{ + return Format(format, ul1, ul2); +} +inline std::string format(const char* format, int i, const std::string& s) +{ + return Format(format, i, s.c_str()); +} +inline std::string format(const char* format, int i, const char* pStr) +{ + return Format(format, i, pStr); +} + +inline std::string format(const char* format, char ch1, char ch2, const std::string& s) +{ + return Format(format, ch1, ch2, s.c_str()); +} +inline std::string format(const char* format, int i1, int i2, unsigned long ul) +{ + return Format(format, i1, i2, ul); +} +inline std::string format(const char* format, int i1, int i2, int i3) +{ + return Format(format, i1, i2, i3); +} +inline std::string format(const char* format, const std::string& s1, const std::string& s2, uint32_t ui) +{ + return Format(format, s1.c_str(), s2.c_str(), ui); +} + } -#endif +#endif // CODA_OSS_str_Format_h_INCLUDED_ \ No newline at end of file diff --git a/externals/coda-oss/modules/c++/str/source/Format.cpp b/externals/coda-oss/modules/c++/str/source/Format.cpp index b89c974e8..1117ced91 100644 --- a/externals/coda-oss/modules/c++/str/source/Format.cpp +++ b/externals/coda-oss/modules/c++/str/source/Format.cpp @@ -51,14 +51,14 @@ inline void va_end_(va_list& args) CODA_OSS_disable_warning_pop } -std::string str::format(const char *format, ...) -{ - va_list args; - va_start(args, format); - auto retval = vformat(format, args); - va_end_(args); - return retval; -} +//std::string str::format(const char *format, ...) +//{ +// va_list args; +// va_start(args, format); +// auto retval = vformat(format, args); +// va_end_(args); +// return retval; +//} str::Format::Format(const char* format, ...) { diff --git a/externals/coda-oss/modules/c++/sys/source/OSUnix.cpp b/externals/coda-oss/modules/c++/sys/source/OSUnix.cpp index c9241b639..e561186f5 100644 --- a/externals/coda-oss/modules/c++/sys/source/OSUnix.cpp +++ b/externals/coda-oss/modules/c++/sys/source/OSUnix.cpp @@ -143,7 +143,7 @@ std::string sys::OSUnix::getPlatformName() const if (uname(&name) == -1) throw sys::SystemException("Uname failed"); - return FmtX("%s (%s): %s [build: %s]", name.sysname, name.machine, + return str::Format("%s (%s): %s [build: %s]", name.sysname, name.machine, name.release, name.version); } diff --git a/externals/coda-oss/modules/c++/sys/source/OSWin32.cpp b/externals/coda-oss/modules/c++/sys/source/OSWin32.cpp index e381f2f91..e50dee5ec 100644 --- a/externals/coda-oss/modules/c++/sys/source/OSWin32.cpp +++ b/externals/coda-oss/modules/c++/sys/source/OSWin32.cpp @@ -58,7 +58,7 @@ std::string sys::OSWin32::getPlatformName() const { platform = "Unknown Windows OS"; } - return FmtX("%s: %d.%d [build: %d], %s", platform.c_str(), + return str::Format("%s: %d.%d [build: %d], %s", platform.c_str(), info.dwMajorVersion, info.dwMinorVersion, info.dwBuildNumber, info.szCSDVersion); } diff --git a/externals/coda-oss/modules/c++/xml.lite/source/Attributes.cpp b/externals/coda-oss/modules/c++/xml.lite/source/Attributes.cpp index a70077ad1..2628ca7c8 100644 --- a/externals/coda-oss/modules/c++/xml.lite/source/Attributes.cpp +++ b/externals/coda-oss/modules/c++/xml.lite/source/Attributes.cpp @@ -152,8 +152,7 @@ std::string xml::lite::Attributes::getValue(const QName& qname) const { const auto uri = qname.getUri().value; const auto localName = qname.getName(); - throw except::NoSuchKeyException(Ctxt(FmtX("(uri: %s, localName: %s", - uri.c_str(), localName.c_str()))); + throw except::NoSuchKeyException(Ctxt(FmtX("(uri: %s, localName: %s", uri, localName))); } return retval; } diff --git a/modules/c++/nitf/tests/test_extract.cpp b/modules/c++/nitf/tests/test_extract.cpp index e8c7ac725..86b3cd20c 100644 --- a/modules/c++/nitf/tests/test_extract.cpp +++ b/modules/c++/nitf/tests/test_extract.cpp @@ -44,7 +44,7 @@ static std::vector extract_image(const nitf::ImageSubheader& subhe size_t band = 0; for (const auto& data : bandData) // for band, data in enumerate(bandData): { - auto outName = str::format("%s_%d__%d_x_%d_%d_band_%d.out", + std::string outName = str::Format("%s_%d__%d_x_%d_%d_band_%d.out", baseName.c_str(), index, window.getNumRows(), window.getNumCols(), static_cast(nbpp), static_cast(band)); outName = sys::Path::joinPaths(outDir, outName); auto f = fopen(outName.c_str(), "wb"); // f = open(outName, "wb"); diff --git a/modules/c++/nitf/tests/test_j2k_nitf_read_region.cpp b/modules/c++/nitf/tests/test_j2k_nitf_read_region.cpp index 1f0d4cf04..37f247fc0 100644 --- a/modules/c++/nitf/tests/test_j2k_nitf_read_region.cpp +++ b/modules/c++/nitf/tests/test_j2k_nitf_read_region.cpp @@ -47,7 +47,7 @@ void writeFile(uint32_t x0, uint32_t y0, uint32_t x1, uint32_t y1, std::span buf, const std::string& prefix) { - const auto filename = str::format("%s-raw-%d_%d__%d_%d.out", prefix.c_str(), x0, y0, x1, y1); + const std::string filename = str::Format("%s-raw-%d_%d__%d_%d.out", prefix.c_str(), x0, y0, x1, y1); nitf::IOHandle outHandle(filename, NRT_ACCESS_WRITEONLY, NRT_CREATE); outHandle.write(buf.data(), buf.size()); printf("Wrote file: %s\n", filename.c_str()); @@ -57,7 +57,7 @@ void writeJ2K(uint32_t x0, uint32_t y0, uint32_t x1, uint32_t y1, std::span buf, const j2k::Container& inContainer, const std::string& prefix) { - const auto outName = str::format("%s-raw-%d_%d__%d_%d.j2k", prefix.c_str(), x0, y0, x1, y1); + const std::string outName = str::Format("%s-raw-%d_%d__%d_%d.j2k", prefix.c_str(), x0, y0, x1, y1); const auto num_x_tiles = inContainer.getTilesX(); const auto num_y_tiles = inContainer.getTilesY(); diff --git a/modules/c++/nitf/unittests/test_j2k_loading++.cpp b/modules/c++/nitf/unittests/test_j2k_loading++.cpp index 22de200df..d0ffa5243 100644 --- a/modules/c++/nitf/unittests/test_j2k_loading++.cpp +++ b/modules/c++/nitf/unittests/test_j2k_loading++.cpp @@ -168,7 +168,7 @@ TEST_CASE(test_j2k_nitf) void writeFile(uint32_t x0, uint32_t y0, uint32_t x1, uint32_t y1, std::span buf, const std::string& prefix) { - const auto filename = str::format("%s-raw-%d_%d__%d_%d.out", prefix.c_str(), x0, y0, x1, y1); + const std::string filename = str::Format("%s-raw-%d_%d__%d_%d.out", prefix.c_str(), x0, y0, x1, y1); nitf::IOHandle outHandle(filename, NRT_ACCESS_WRITEONLY, NRT_CREATE); outHandle.write(buf.data(), buf.size()); //printf("Wrote file: %s\n", filename.c_str()); @@ -177,7 +177,7 @@ void writeJ2K(uint32_t x0, uint32_t y0, uint32_t x1, uint32_t y1, std::span buf, const j2k::Container& inContainer, const std::string& prefix) { - const auto outName = str::format("%s-raw-%d_%d__%d_%d.j2k", prefix.c_str(), x0, y0, x1, y1); + const std::string outName = str::Format("%s-raw-%d_%d__%d_%d.j2k", prefix.c_str(), x0, y0, x1, y1); const auto num_x_tiles = inContainer.getTilesX(); const auto num_y_tiles = inContainer.getTilesY(); diff --git a/modules/c++/pch.h b/modules/c++/pch.h index e2236fd36..03085c4ac 100644 --- a/modules/c++/pch.h +++ b/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.