This is an automated email from the ASF dual-hosted git repository. bneradt pushed a commit to branch dev-1-2-0 in repository https://gitbox.apache.org/repos/asf/trafficserver-libswoc.git
commit 1c86ec0ef4109a0869be9862e44ef0a1a046c8d1 Author: Alan M. Carroll <[email protected]> AuthorDate: Fri Apr 3 12:52:41 2020 -0500 Update to 1.2.0 --- doc/Doxyfile | 2 +- doc/code/IPSpace.en.rst | 2 +- doc/code/TextView.en.rst | 6 ++-- doc/conf.py | 2 +- swoc++/CMakeLists.txt | 2 +- swoc++/include/swoc/swoc_ip.h | 14 ++------ swoc++/include/swoc/swoc_version.h | 4 +-- swoc++/swoc++.part | 2 +- unit_tests/test_bw_format.cc | 65 ++++++++++++++++---------------------- 9 files changed, 40 insertions(+), 59 deletions(-) diff --git a/doc/Doxyfile b/doc/Doxyfile index 87eab21..ac00ccd 100644 --- a/doc/Doxyfile +++ b/doc/Doxyfile @@ -38,7 +38,7 @@ PROJECT_NAME = "LibSWOC++" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = "1.1.5" +PROJECT_NUMBER = "1.2.0" # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/doc/code/IPSpace.en.rst b/doc/code/IPSpace.en.rst index c19d0f9..0edab18 100644 --- a/doc/code/IPSpace.en.rst +++ b/doc/code/IPSpace.en.rst @@ -170,7 +170,7 @@ Blending Bitsets Some details are omitted for brevity and because they aren't directly relevant. The full implementation, which is run as a unit test to verify its correctness, - `is available here <https://github.com/SolidWallOfCode/libswoc/blob/1.1.5/unit_tests/ex_ipspace_properties.cc>`__. + `is available here <https://github.com/SolidWallOfCode/libswoc/blob/1.2.0/unit_tests/ex_ipspace_properties.cc>`__. You can compile and step through the code to see how it works in more detail, or experiment with changing some of the example data. diff --git a/doc/code/TextView.en.rst b/doc/code/TextView.en.rst index b4ca9e5..df2bb94 100644 --- a/doc/code/TextView.en.rst +++ b/doc/code/TextView.en.rst @@ -275,7 +275,7 @@ separated by commas. .. sidebar:: Verification - `Test code for example <https://github.com/SolidWallOfCode/libswoc/blob/1.1.5/unit_tests/ex_TextView.cc#L67>`__. + `Test code for example <https://github.com/SolidWallOfCode/libswoc/blob/1.2.0/unit_tests/ex_TextView.cc#L67>`__. If :arg:`value` was :literal:`bob ,dave, sam` then :arg:`token` would be successively :literal:`bob`, :literal:`dave`, :literal:`sam`. After :literal:`sam` was extracted :arg:`value` @@ -297,7 +297,7 @@ for values that are boolean. .. sidebar:: Verification - `Test code for example <https://github.com/SolidWallOfCode/libswoc/blob/1.1.5/unit_tests/ex_TextView.cc#L74>`__. + `Test code for example <https://github.com/SolidWallOfCode/libswoc/blob/1.2.0/unit_tests/ex_TextView.cc#L74>`__. The basic list processing is the same as the previous example, with each element being treated as a "list" with ``=`` as the separator. Note if there is no ``=`` character then all of the list @@ -348,7 +348,7 @@ do not, so a flag to strip quotes from the resulting elements is needed. The fin .. sidebar:: Verification - `Test code for example <https://github.com/SolidWallOfCode/libswoc/blob/1.1.5/unit_tests/ex_TextView.cc#L90>`__. + `Test code for example <https://github.com/SolidWallOfCode/libswoc/blob/1.2.0/unit_tests/ex_TextView.cc#L90>`__. This takes a :code:`TextView&` which is the source view which will be updated as tokens are removed (therefore the caller must do the empty view check). The other arguments are the separator character diff --git a/doc/conf.py b/doc/conf.py index 0939355..805d4a4 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -80,7 +80,7 @@ project = u'Solid Wall Of C++' copyright = u'{}, [email protected]'.format(date.today().year) # The full version, including alpha/beta/rc tags. -release = "1.1.5" +release = "1.2.0" # The short X.Y version. version = '.'.join(release.split('.', 2)[:2]) diff --git a/swoc++/CMakeLists.txt b/swoc++/CMakeLists.txt index ec2b447..6c9982f 100644 --- a/swoc++/CMakeLists.txt +++ b/swoc++/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.12) project(lib-swoc++ CXX) -set(LIBSWOC_VERSION "1.1.5") +set(LIBSWOC_VERSION "1.2.0") set(CMAKE_CXX_STANDARD 17) include(GNUInstallDirs) diff --git a/swoc++/include/swoc/swoc_ip.h b/swoc++/include/swoc/swoc_ip.h index eb6d5ed..599b36b 100644 --- a/swoc++/include/swoc/swoc_ip.h +++ b/swoc++/include/swoc/swoc_ip.h @@ -1,11 +1,9 @@ -#pragma once -#pragma once -#pragma once // SPDX-License-Identifier: Apache-2.0 /** @file IP address and network related classes. */ +#pragma once #include <netinet/in.h> #include <string_view> #include <variant> @@ -16,24 +14,16 @@ #include <values.h> namespace swoc { -class IP4Addr; +class IP4Addr; class IP6Addr; - class IPAddr; - class IPMask; - class IP4Range; - class IP6Range; - class IPRange; - class IP4Net; - class IP6Net; - class IPNet; using ::std::string_view; diff --git a/swoc++/include/swoc/swoc_version.h b/swoc++/include/swoc/swoc_version.h index 005371e..94716c3 100644 --- a/swoc++/include/swoc/swoc_version.h +++ b/swoc++/include/swoc/swoc_version.h @@ -38,6 +38,6 @@ namespace swoc { static constexpr unsigned MAJOR_VERSION = 1; -static constexpr unsigned MINOR_VERSION = 1; -static constexpr unsigned POINT_VERSION = 5; +static constexpr unsigned MINOR_VERSION = 2; +static constexpr unsigned POINT_VERSION = 0; } // namespace swoc diff --git a/swoc++/swoc++.part b/swoc++/swoc++.part index 5ef8982..d9270a4 100644 --- a/swoc++/swoc++.part +++ b/swoc++/swoc++.part @@ -1,6 +1,6 @@ Import("*") PartName("libswoc") -PartVersion("1.1.5") +PartVersion("1.2.0") src_files = [ "src/ArenaWriter.cc", diff --git a/unit_tests/test_bw_format.cc b/unit_tests/test_bw_format.cc index f6f0aeb..84e08bf 100644 --- a/unit_tests/test_bw_format.cc +++ b/unit_tests/test_bw_format.cc @@ -36,8 +36,7 @@ using namespace swoc::literals; using swoc::TextView; using swoc::bwprint; -TEST_CASE("Buffer Writer << operator", "[bufferwriter][stream]") -{ +TEST_CASE("Buffer Writer << operator", "[bufferwriter][stream]") { swoc::LocalBufferWriter<50> bw; bw << "The" << ' ' << "quick" << ' ' << "brown fox"; @@ -49,9 +48,8 @@ TEST_CASE("Buffer Writer << operator", "[bufferwriter][stream]") REQUIRE(bw.view() == "x=50"); } -TEST_CASE("bwprint basics", "[bwprint]") -{ - swoc::LocalBufferWriter<256> bw; +TEST_CASE("bwprint basics", "[bwprint]") { + swoc::LocalBufferWriter<256> bw;s std::string_view fmt1{"Some text"sv}; swoc::bwf::Format fmt2("left >{0:<9}< right >{0:>9}< center >{0:^9}<"); std::string_view text{"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"}; @@ -134,8 +132,7 @@ TEST_CASE("bwprint basics", "[bwprint]") REQUIRE(bw.view() == " Some text"); } -TEST_CASE("BWFormat numerics", "[bwprint][bwformat]") -{ +TEST_CASE("BWFormat numerics", "[bwprint][bwformat]") { swoc::LocalBufferWriter<256> bw; void *ptr = reinterpret_cast<void *>(0XBADD0956); @@ -245,8 +242,7 @@ TEST_CASE("BWFormat numerics", "[bwprint][bwformat]") REQUIRE(bw.view() == "Byte '97'"); } -TEST_CASE("bwstring", "[bwprint][bwstring]") -{ +TEST_CASE("bwstring", "[bwprint][bwstring]") { std::string s; swoc::TextView fmt("{} -- {}"); std::string_view text{"e99a18c428cb38d5f260853678922e03"}; @@ -301,12 +297,11 @@ TEST_CASE("bwstring", "[bwprint][bwstring]") REQUIRE(s == "Null 0x0.0X0.null.NULL"); } -TEST_CASE("BWFormat integral", "[bwprint][bwformat]") -{ +TEST_CASE("BWFormat integral", "[bwprint][bwformat]") { swoc::LocalBufferWriter<256> bw; swoc::bwf::Spec spec; uint32_t num = 30; - int num_neg = -30; + int num_neg = -30; // basic bwformat(bw, spec, num); @@ -319,7 +314,7 @@ TEST_CASE("BWFormat integral", "[bwprint][bwformat]") // radix swoc::bwf::Spec spec_hex; spec_hex._radix_lead_p = true; - spec_hex._type = 'x'; + spec_hex._type = 'x'; bwformat(bw, spec_hex, num); REQUIRE(bw.view() == "0x1e"); bw.clear(); @@ -332,24 +327,24 @@ TEST_CASE("BWFormat integral", "[bwprint][bwformat]") swoc::bwf::Spec spec_bin; spec_bin._radix_lead_p = true; - spec_bin._type = 'b'; + spec_bin._type = 'b'; bwformat(bw, spec_bin, num); REQUIRE(bw.view() == "0b11110"); bw.clear(); - int one = 1; - int two = 2; + int one = 1; + int two = 2; int three_n = -3; // alignment swoc::bwf::Spec left; left._align = swoc::bwf::Spec::Align::LEFT; - left._min = 5; + left._min = 5; swoc::bwf::Spec right; right._align = swoc::bwf::Spec::Align::RIGHT; - right._min = 5; + right._min = 5; swoc::bwf::Spec center; center._align = swoc::bwf::Spec::Align::CENTER; - center._min = 5; + center._min = 5; bwformat(bw, left, one); bwformat(bw, right, two); @@ -367,8 +362,7 @@ TEST_CASE("BWFormat integral", "[bwprint][bwformat]") REQUIRE(bw.view() == "ax == 1"); } -TEST_CASE("BWFormat floating", "[bwprint][bwformat]") -{ +TEST_CASE("BWFormat floating", "[bwprint][bwformat]") { swoc::LocalBufferWriter<256> bw; swoc::bwf::Spec spec; @@ -389,7 +383,7 @@ TEST_CASE("BWFormat floating", "[bwprint][bwformat]") REQUIRE(bw.view() == "long 64.90000000000"); bw.clear(); - double n = 180.278; + double n = 180.278; double neg = -238.47; bwformat(bw, spec, n); REQUIRE(bw.view() == "180.28"); @@ -406,7 +400,7 @@ TEST_CASE("BWFormat floating", "[bwprint][bwformat]") REQUIRE(bw.view() == "-238.47000"); bw.clear(); - float f = 1234; + float f = 1234; float fneg = -1; bwformat(bw, spec, f); REQUIRE(bw.view() == "1234"); @@ -414,7 +408,7 @@ TEST_CASE("BWFormat floating", "[bwprint][bwformat]") bwformat(bw, spec, fneg); REQUIRE(bw.view() == "-1"); bw.clear(); - f = 1234.5667; + f = 1234.5667; spec._prec = 4; bwformat(bw, spec, f); REQUIRE(bw.view() == "1234.5667"); @@ -434,7 +428,7 @@ TEST_CASE("BWFormat floating", "[bwprint][bwformat]") bw.clear(); double edge = 0.345; - spec._prec = 3; + spec._prec = 3; bwformat(bw, spec, edge); REQUIRE(bw.view() == "0.345"); bw.clear(); @@ -448,18 +442,18 @@ TEST_CASE("BWFormat floating", "[bwprint][bwformat]") bw.clear(); // alignment - double first = 1.23; + double first = 1.23; double second = 2.35; - double third = -3.5; + double third = -3.5; swoc::bwf::Spec left; left._align = swoc::bwf::Spec::Align::LEFT; - left._min = 5; + left._min = 5; swoc::bwf::Spec right; right._align = swoc::bwf::Spec::Align::RIGHT; - right._min = 5; + right._min = 5; swoc::bwf::Spec center; center._align = swoc::bwf::Spec::Align::CENTER; - center._min = 5; + center._min = 5; bwformat(bw, left, first); bwformat(bw, right, second); @@ -473,7 +467,7 @@ TEST_CASE("BWFormat floating", "[bwprint][bwformat]") double over = 1.4444444; swoc::bwf::Spec over_min; over_min._prec = 7; - over_min._min = 5; + over_min._min = 5; bwformat(bw, over_min, over); REQUIRE(bw.view() == "1.4444444"); bw.clear(); @@ -499,8 +493,7 @@ TEST_CASE("BWFormat floating", "[bwprint][bwformat]") bw.clear(); } -TEST_CASE("bwstring std formats", "[libswoc][bwprint]") -{ +TEST_CASE("bwstring std formats", "[libswoc][bwprint]") { std::string_view text{"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"}; swoc::LocalBufferWriter<120> w; @@ -587,12 +580,10 @@ TEST_CASE("bwstring std formats", "[libswoc][bwprint]") w.clear().print("Upper - |{:S}|", text); REQUIRE(w.view() == "Upper - |0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ|"); - w.clear().print("Leading{}{}{}.", swoc::bwf::Optional(" | {} |", s1), swoc::bwf::Optional(" <{}>", empty), - swoc::bwf::If(!s3.empty(), " [{}]", s3)); + w.clear().print("Leading{}{}{}.", swoc::bwf::Optional(" | {} |", s1), swoc::bwf::Optional(" <{}>", empty), swoc::bwf::If(!s3.empty(), " [{}]", s3)); REQUIRE(w.view() == "Leading | Persia | [Leif]."); // Do it again, but this time as C strings (char * variants). - w.clear().print("Leading{}{}{}.", swoc::bwf::Optional(" | {} |", s3.data()), swoc::bwf::Optional(" <{}>", empty), - swoc::bwf::If(!s3.empty(), " [{}]", s1.c_str())); + w.clear().print("Leading{}{}{}.", swoc::bwf::Optional(" | {} |", s3.data()), swoc::bwf::Optional(" <{}>", empty), swoc::bwf::If(!s3.empty(), " [{}]", s1.c_str())); REQUIRE(w.view() == "Leading | Leif | [Persia]."); // Play with string_view w.clear().print("Clone?{}{}.", swoc::bwf::Optional(" #. {}", s2), swoc::bwf::Optional(" #. {}", s2.data()));
