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 e4849683e72b94a9c38384bbae9e1142d9bb1afc Author: Alan M. Carroll <[email protected]> AuthorDate: Fri Apr 3 17:05:06 2020 -0500 First pass - define for outer namespace. --- doc/code/BW_Format.en.rst | 4 ++-- doc/code/BufferWriter.en.rst | 2 +- doc/code/IPSpace.en.rst | 2 +- doc/code/MemArena.en.rst | 2 +- doc/code/MemSpan.en.rst | 2 +- doc/code/TextView.en.rst | 2 +- example/ex_netdb.cc | 20 ++++++++++---------- swoc++/include/swoc/ArenaWriter.h | 10 +++++----- swoc++/include/swoc/BufferWriter.h | 22 +++++----------------- swoc++/include/swoc/DiscreteRange.h | 15 +++++++-------- swoc++/include/swoc/Errata.h | 27 +++++++-------------------- swoc++/include/swoc/IntrusiveDList.h | 23 ++++++----------------- swoc++/include/swoc/IntrusiveHashMap.h | 26 +++++++++----------------- swoc++/include/swoc/Lexicon.h | 20 +++++--------------- swoc++/include/swoc/MemArena.h | 19 ++++--------------- swoc++/include/swoc/MemSpan.h | 23 +++++++---------------- swoc++/include/swoc/RBTree.h | 10 ++++++---- swoc++/include/swoc/Scalar.h | 22 +++++----------------- swoc++/include/swoc/TextView.h | 23 ++++++----------------- swoc++/include/swoc/bwf_base.h | 24 ++++++------------------ swoc++/include/swoc/bwf_ex.h | 27 ++++++--------------------- swoc++/include/swoc/bwf_fwd.h | 23 ++++++----------------- swoc++/include/swoc/bwf_ip.h | 25 +++++++------------------ swoc++/include/swoc/bwf_std.h | 22 ++++------------------ swoc++/include/swoc/ext/HashFNV.h | 4 ++-- swoc++/include/swoc/swoc_file.h | 22 +++++----------------- swoc++/include/swoc/swoc_ip.h | 16 +++++++++------- swoc++/include/swoc/swoc_meta.h | 23 ++++++----------------- swoc++/include/swoc/swoc_version.h | 28 ++++++++++------------------ swoc++/include/swoc/version_notes.txt | 5 ----- swoc++/src/ArenaWriter.cc | 9 ++++----- swoc++/src/Errata.cc | 21 +++++---------------- swoc++/src/MemArena.cc | 19 +++---------------- swoc++/src/RBTree.cc | 20 ++++---------------- swoc++/src/TextView.cc | 17 ++--------------- swoc++/src/bw_format.cc | 6 +++--- swoc++/src/bw_ip_format.cc | 6 +++--- swoc++/src/swoc_file.cc | 8 +++++--- swoc++/src/swoc_ip.cc | 25 ++++++------------------- tools/ats-revert.sh | 2 +- tools/rewrite.sh | 4 ++-- tools/update-version.sh | 1 + unit_tests/ex_MemArena.cc | 2 +- unit_tests/ex_TextView.cc | 6 +++--- unit_tests/ex_ipspace_properties.cc | 10 +++++----- unit_tests/test_Lexicon.cc | 17 ++--------------- unit_tests/test_TextView.cc | 2 +- unit_tests/test_bw_format.cc | 20 +++----------------- unit_tests/test_ip.cc | 13 ++++++------- unit_tests/test_meta.cc | 2 +- 50 files changed, 211 insertions(+), 492 deletions(-) diff --git a/doc/code/BW_Format.en.rst b/doc/code/BW_Format.en.rst index 712da59..1f7bbf0 100644 --- a/doc/code/BW_Format.en.rst +++ b/doc/code/BW_Format.en.rst @@ -26,7 +26,7 @@ BufferWriter Formatting Synopsis ******** -:code:`#include <swoc/bwf_base.h>` +:code:`#include "swoc/bwf_base.h"` Formatted output was added to :class:`BufferWriter` for several reasons. @@ -486,7 +486,7 @@ Specific types .. _ip_addr_fmt: :code:`sockaddr const *` - :code:`#include <swoc/bwf_ip.h>` + :code:`#include "swoc/bwf_ip.h"` The IP address is printed. Fill is used to fill in address segments if provided, not to the minimum width if specified. :libswoc:`IPEndpoint` and :libswoc:`IPAddr` are supported with the diff --git a/doc/code/BufferWriter.en.rst b/doc/code/BufferWriter.en.rst index c03f1fa..161dd39 100644 --- a/doc/code/BufferWriter.en.rst +++ b/doc/code/BufferWriter.en.rst @@ -25,7 +25,7 @@ BufferWriter Synopsis ******** -:code:`#include <swoc/BufferWriter.h>` +:code:`#include "swoc/BufferWriter.h"` .. class:: BufferWriter diff --git a/doc/code/IPSpace.en.rst b/doc/code/IPSpace.en.rst index 0edab18..a8890c8 100644 --- a/doc/code/IPSpace.en.rst +++ b/doc/code/IPSpace.en.rst @@ -12,7 +12,7 @@ IP Networking Synopsis ******** -:code:`#include <swoc/swoc_ip.h>` +:code:`#include "swoc/swoc_ip.h"` Usage ***** diff --git a/doc/code/MemArena.en.rst b/doc/code/MemArena.en.rst index 43dac4f..bd033aa 100644 --- a/doc/code/MemArena.en.rst +++ b/doc/code/MemArena.en.rst @@ -25,7 +25,7 @@ MemArena Synopsis ******** -:code:`#include <swoc/MemArena.h>` +:code:`#include "swoc/MemArena.h"` .. class:: template < typename T > MemArena diff --git a/doc/code/MemSpan.en.rst b/doc/code/MemSpan.en.rst index 2eb1ab2..7ff0428 100644 --- a/doc/code/MemSpan.en.rst +++ b/doc/code/MemSpan.en.rst @@ -25,7 +25,7 @@ MemSpan Synopsis ******** -:code:`#include <swoc/MemSpan.h>` +:code:`#include "swoc/MemSpan.h"` .. class:: template < typename T > MemSpan diff --git a/doc/code/TextView.en.rst b/doc/code/TextView.en.rst index df2bb94..fd46f5c 100644 --- a/doc/code/TextView.en.rst +++ b/doc/code/TextView.en.rst @@ -27,7 +27,7 @@ TextView Synopsis ******** -:code:`#include <swoc/TextView.h>` +:code:`#include "swoc/TextView.h"` .. class:: TextView diff --git a/example/ex_netdb.cc b/example/ex_netdb.cc index 211a72c..2f36cf4 100644 --- a/example/ex_netdb.cc +++ b/example/ex_netdb.cc @@ -31,16 +31,16 @@ #include <unordered_set> #include <fstream> -#include <swoc/TextView.h> -#include <swoc/swoc_ip.h> -#include <swoc/bwf_ip.h> -#include <swoc/bwf_std.h> -#include <swoc/bwf_ex.h> -#include <swoc/swoc_file.h> -#include <swoc/Lexicon.h> +#include "swoc/TextView.h" +#include "swoc/swoc_ip.h" +#include "swoc/bwf_ip.h" +#include "swoc/bwf_std.h" +#include "swoc/bwf_ex.h" +#include "swoc/swoc_file.h" +#include "swoc/Lexicon.h" using namespace std::literals; -using namespace swoc::literals; +using namespace SWOC_NAMESPACE::literals; using swoc::TextView; using swoc::IPEndpoint; @@ -100,7 +100,7 @@ swoc::Lexicon<PodType> PodTypeNames {{ }}; // Create BW formatters for the types so they can be used for output. -namespace swoc { +namespace SWOC_NAMESPACE { BufferWriter& bwformat(BufferWriter& w, bwf::Spec const& spec, PodType pt) { return w.write(PodTypeNames[pt]); @@ -121,7 +121,7 @@ BufferWriter& bwformat(BufferWriter& w, bwf::Spec const& spec, FlagSet const& fl return w; } -} // namespace swoc +} // namespace SWOC_NAMESPACE // These are used to keep pointers for the same string identical so the payloads // can be directly compared. diff --git a/swoc++/include/swoc/ArenaWriter.h b/swoc++/include/swoc/ArenaWriter.h index a09c573..02e3cd7 100644 --- a/swoc++/include/swoc/ArenaWriter.h +++ b/swoc++/include/swoc/ArenaWriter.h @@ -1,16 +1,16 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright Verizon Media 2020 /** @file * @c BufferWriter for a @c MemArena. - * - * Copyright 2019, Oath Inc. - * SPDX-License-Identifier: Apache-2.0 */ #pragma once +#include "swoc/swoc_version.h" #include "swoc/MemSpan.h" #include "swoc/bwf_base.h" #include "swoc/MemArena.h" -namespace swoc +namespace SWOC_NAMESPACE { /** Buffer writer for a @c MemArena. * @@ -61,4 +61,4 @@ protected: inline swoc::ArenaWriter::ArenaWriter(swoc::MemArena &arena) : super_type(arena.remnant()), _arena(arena) {} -} // namespace swoc +} // namespace SWOC_NAMESPACE diff --git a/swoc++/include/swoc/BufferWriter.h b/swoc++/include/swoc/BufferWriter.h index 6880120..27987af 100644 --- a/swoc++/include/swoc/BufferWriter.h +++ b/swoc++/include/swoc/BufferWriter.h @@ -1,21 +1,8 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright Apache Software Foundation 2019 /** @file Utilities for generating character sequences in buffers. - - @section license License - - Licensed to the Apache Software Foundation (ASF) under one or more contributor license - agreements. See the NOTICE file distributed with this work for additional information regarding - copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with the License. You may - obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software distributed under the - License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either - express or implied. See the License for the specific language governing permissions and - limitations under the License. */ #pragma once @@ -28,10 +15,11 @@ #include <iosfwd> #include <string_view> +#include "swoc/swoc_version.h" #include "swoc/TextView.h" #include "swoc/MemSpan.h" -namespace swoc +namespace SWOC_NAMESPACE { namespace bwf { @@ -634,7 +622,7 @@ inline FixedBufferWriter::operator std::string_view() const { // --- LocalBufferWriter --- template <size_t N> LocalBufferWriter<N>::LocalBufferWriter() : super_type(_arr, N) {} -} // namespace swoc +} // namespace SWOC_NAMESPACE namespace std { diff --git a/swoc++/include/swoc/DiscreteRange.h b/swoc++/include/swoc/DiscreteRange.h index 4ab78fb..0c988bf 100644 --- a/swoc++/include/swoc/DiscreteRange.h +++ b/swoc++/include/swoc/DiscreteRange.h @@ -1,8 +1,5 @@ -#pragma once - // SPDX-License-Identifier: Apache-2.0 // Copyright 2014 Network Geographics - /** @file Support classes for creating intervals of numeric values. @@ -10,14 +7,16 @@ used as a base class if additional functionality is required. */ +#pragma once #include <limits> #include <functional> -#include <swoc/swoc_meta.h> -#include <swoc/RBTree.h> -#include <swoc/MemArena.h> +#include "swoc/swoc_version.h" +#include "swoc/swoc_meta.h" +#include "swoc/RBTree.h" +#include "swoc/MemArena.h" -namespace swoc +namespace SWOC_NAMESPACE { /// Internal implementation namespace. namespace detail @@ -1394,4 +1393,4 @@ DiscreteSpace<METRIC, PAYLOAD>::blend(DiscreteSpace::range_type const&range, U c return *this; } -} // namespace swoc +} // namespace SWOC_NAMESPACE diff --git a/swoc++/include/swoc/Errata.h b/swoc++/include/swoc/Errata.h index f352e8b..ccaea5c 100644 --- a/swoc++/include/swoc/Errata.h +++ b/swoc++/include/swoc/Errata.h @@ -1,5 +1,6 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright Network Geographics 2014 /** @file - * Stacking error message handling. The problem addressed by this library is the ability to pass back detailed error messages from @@ -32,25 +33,11 @@ acts on an erratum when it becomes unreferenced. The intended use is to send the messages to an output log. This makes reporting errors to a log from even deeply nested functions easy while preserving the ability of the top level logic to control such logging. - - @section license License - - Licensed to the Apache Software Foundation (ASF) under one or more contributor license - agreements. See the NOTICE file distributed with this work for additional information regarding - copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with the License. You may - obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software distributed under the - License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either - express or implied. See the License for the specific language governing permissions and - limitations under the License. */ #pragma once +#include "swoc/swoc_version.h" #include <vector> #include <string_view> #include <functional> @@ -59,7 +46,7 @@ #include "swoc/bwf_base.h" #include "swoc/IntrusiveDList.h" -namespace swoc +namespace SWOC_NAMESPACE { /// Severity levels for Errata. enum class Severity : uint8_t { @@ -873,7 +860,7 @@ BufferWriter &bwformat(BufferWriter &w, bwf::Spec const &spec, Errata::Annotatio BufferWriter &bwformat(BufferWriter &w, bwf::Spec const &spec, Errata const &); -} // namespace swoc +} // namespace SWOC_NAMESPACE // Tuple / structured binding support. namespace std @@ -894,7 +881,7 @@ template <typename R> class tuple_size<swoc::Rv<R>> : public std::integral_const } // namespace std -namespace swoc +namespace SWOC_NAMESPACE { // Not sure how much of this is needed, but experimentally all of these were needed in one // use case or another of structured binding. I wasn't able to make this work if this was @@ -932,4 +919,4 @@ get(swoc::Rv<R> const &rv) { } } -} // namespace swoc +} // namespace SWOC_NAMESPACE diff --git a/swoc++/include/swoc/IntrusiveDList.h b/swoc++/include/swoc/IntrusiveDList.h index f91079c..7487057 100644 --- a/swoc++/include/swoc/IntrusiveDList.h +++ b/swoc++/include/swoc/IntrusiveDList.h @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright Apach Software Foundation 2019 /** @file Intrusive double linked list container. @@ -8,28 +10,15 @@ @note This is a header only library. */ -/* Licensed to the Apache Software Foundation (ASF) under one or more contributor license - agreements. See the NOTICE file distributed with this work for additional information regarding - copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with the License. You may - obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software distributed under the - License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either - express or implied. See the License for the specific language governing permissions and - limitations under the License. - - */ - #pragma once /// Clang doesn't like just declaring the tag struct we need so we have to include the file. #include <iterator> #include <type_traits> -namespace swoc +#include "swoc/swoc_version.h" + +namespace SWOC_NAMESPACE { /** Intrusive doubly linked list container. @@ -924,4 +913,4 @@ IntrusiveDList<L>::apply(F &&f) -> self_type & { return detail::Intrusive_DList_Apply(*this, f); }; -} // namespace swoc +} // namespace SWOC_NAMESPACE diff --git a/swoc++/include/swoc/IntrusiveHashMap.h b/swoc++/include/swoc/IntrusiveHashMap.h index 7a3204d..bed2d21 100644 --- a/swoc++/include/swoc/IntrusiveHashMap.h +++ b/swoc++/include/swoc/IntrusiveHashMap.h @@ -1,21 +1,11 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright Apache Software Foundation 2019 /** @file - Instrusive hash map. + Intrusive hash map. - @section license License - - Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. - See the NOTICE file distributed with this work for additional information regarding copyright - ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance with the License. You may obtain a - copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software distributed under the License - is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - or implied. See the License for the specific language governing permissions and limitations under - the License. + A hash map that depends on support in the hashed objects. Useful for sharing objects between + hash maps with different keys / hashes. */ #pragma once @@ -23,9 +13,11 @@ #include <vector> #include <array> #include <algorithm> + +#include "swoc/swoc_version.h" #include "swoc/IntrusiveDList.h" -namespace swoc +namespace SWOC_NAMESPACE { /** Intrusive Hash Table. @@ -710,4 +702,4 @@ IntrusiveHashMap<H>::get_expansion_limit() const { return _expansion_limit; } -} // namespace swoc +} // namespace SWOC_NAMESPACE diff --git a/swoc++/include/swoc/Lexicon.h b/swoc++/include/swoc/Lexicon.h index 2ee2cf7..f815d2d 100644 --- a/swoc++/include/swoc/Lexicon.h +++ b/swoc++/include/swoc/Lexicon.h @@ -1,19 +1,8 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright Network Geographics 2014 /** @file Assistant class for translating strings to and from enumeration values. - - Licensed to the Apache Software Foundation (ASF) under one or more contributor license - agreements. See the NOTICE file distributed with this work for additional information regarding - copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with the License. You may - obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software distributed under the - License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either - express or implied. See the License for the specific language governing permissions and - limitations under the License. */ #pragma once @@ -25,12 +14,13 @@ #include <array> #include <variant> +#include "swoc/swoc_version.h" #include "swoc/IntrusiveHashMap.h" #include "swoc/MemArena.h" #include "swoc/bwf_base.h" #include "swoc/ext/HashFNV.h" -namespace swoc +namespace SWOC_NAMESPACE { namespace detail { @@ -664,4 +654,4 @@ Lexicon<E>::const_iterator::operator--(int) -> self_type { return tmp; } -} // namespace swoc +} // namespace SWOC_NAMESPACE diff --git a/swoc++/include/swoc/MemArena.h b/swoc++/include/swoc/MemArena.h index 3fb8caf..b15a347 100644 --- a/swoc++/include/swoc/MemArena.h +++ b/swoc++/include/swoc/MemArena.h @@ -1,19 +1,8 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright Verizon Media 2020 /** @file Memory arena for allocations - - Licensed to the Apache Software Foundation (ASF) under one or more contributor license - agreements. See the NOTICE file distributed with this work for additional information regarding - copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 - (the "License"); you may not use this file except in com1pliance with the License. You may - obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software distributed under the - License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either - express or implied. See the License for the specific language governing permissions and - limitations under the License. */ #pragma once @@ -28,7 +17,7 @@ #include "swoc/Scalar.h" #include "swoc/IntrusiveDList.h" -namespace swoc +namespace SWOC_NAMESPACE { /** A memory arena. @@ -496,4 +485,4 @@ void FixedArena<T>::clear() { _list._next = nullptr; } -} // namespace swoc +} // namespace SWOC_NAMESPACE diff --git a/swoc++/include/swoc/MemSpan.h b/swoc++/include/swoc/MemSpan.h index f341311..48f2869 100644 --- a/swoc++/include/swoc/MemSpan.h +++ b/swoc++/include/swoc/MemSpan.h @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright Verizon Media 2020 /** @file Spans of writable memory. This is similar but independently developed from @c std::span. The goal @@ -5,21 +7,8 @@ arbitrary types via template methods. */ -/* Licensed to the Apache Software Foundation (ASF) under one or more contributor license - agreements. See the NOTICE file distributed with this work for additional information regarding - copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with the License. You may obtain - a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software distributed under the License - is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - or implied. See the License for the specific language governing permissions and limitations under - the License. - */ - #pragma once + #include <cstring> #include <iosfwd> #include <iostream> @@ -30,7 +19,9 @@ #include <tuple> #include <exception> -namespace swoc +#include "swoc/swoc_version.h" + +namespace SWOC_NAMESPACE { /** A span of contiguous piece of memory. @@ -925,7 +916,7 @@ MemSpan<void>::view() const { return {static_cast<char const *>(_ptr), _size}; } -} // namespace swoc +} // namespace SWOC_NAMESPACE /// @cond NO_DOXYGEN // STL tuple support - this allows the @c MemSpan to be used as a tuple of a pointer diff --git a/swoc++/include/swoc/RBTree.h b/swoc++/include/swoc/RBTree.h index 8e08b77..a6005dd 100644 --- a/swoc++/include/swoc/RBTree.h +++ b/swoc++/include/swoc/RBTree.h @@ -1,13 +1,15 @@ -#pragma once // SPDX-License-Identifier: Apache-2.0 +// Copyright Apache Software Foundation 2019 /** @file Red/Black tree. */ -#include <swoc/IntrusiveDList.h> +#pragma once +#include "swoc/swoc_version.h" +#include "swoc/IntrusiveDList.h" -namespace swoc +namespace SWOC_NAMESPACE { namespace detail { @@ -225,4 +227,4 @@ namespace detail } // namespace detail -} // namespace swoc +} // namespace SWOC_NAMESPACE diff --git a/swoc++/include/swoc/Scalar.h b/swoc++/include/swoc/Scalar.h index ac6b028..b58a65d 100644 --- a/swoc++/include/swoc/Scalar.h +++ b/swoc++/include/swoc/Scalar.h @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright Apache Software Foundation 2019 /** @file Scaled integral values. @@ -6,21 +8,6 @@ enables this to be done in a type and scaling safe manner where the defined factors carry their scaling information as part of the type. */ - -/* Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. - See the NOTICE file distributed with this work for additional information regarding copyright - ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance with the License. You may obtain a - copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software distributed under the License - is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - or implied. See the License for the specific language governing permissions and limitations under - the License. - */ - #pragma once #include <cstdint> @@ -28,6 +15,7 @@ #include <ostream> #include <type_traits> +#include "swoc/swoc_version.h" #include "swoc/swoc_meta.h" namespace tag @@ -36,7 +24,7 @@ namespace tag struct generic; } // namespace tag -namespace swoc +namespace SWOC_NAMESPACE { template <intmax_t N, typename C, typename T> class Scalar; @@ -945,7 +933,7 @@ namespace detail return w; } } // namespace detail -} // namespace swoc +} // namespace SWOC_NAMESPACE namespace std { diff --git a/swoc++/include/swoc/TextView.h b/swoc++/include/swoc/TextView.h index db20a21..e53a198 100644 --- a/swoc++/include/swoc/TextView.h +++ b/swoc++/include/swoc/TextView.h @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright Apache Software Foundation 2019 /** @file Class for handling "views" of text. Views presume the memory for the buffer is managed @@ -9,21 +11,6 @@ class. */ -/* - Licensed to the Apache Software Foundation (ASF) under one or more contributor license - agreements. See the NOTICE file distributed with this work for additional information regarding - copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with the License. You may obtain - a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software distributed under the License - is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - or implied. See the License for the specific language governing permissions and limitations under - the License. - */ - #pragma once #include <bitset> #include <iosfwd> @@ -31,6 +18,8 @@ #include <string> #include <string_view> +#include "swoc/swoc_version.h" + /** Compare views with ordering, ignoring case. * * @param lhs input view @@ -82,7 +71,7 @@ strcmp(const std::string_view &lhs, const std::string_view &rhs) { return memcmp(lhs, rhs); } -namespace swoc +namespace SWOC_NAMESPACE { class TextView; @@ -1655,7 +1644,7 @@ namespace literals constexpr swoc::TextView operator"" _tv(const char *s, size_t n) { return {s, n}; } } // namespace literals -}; // namespace swoc +}; // namespace SWOC_NAMESPACE namespace std { diff --git a/swoc++/include/swoc/bwf_base.h b/swoc++/include/swoc/bwf_base.h index ad732fe..fb093c7 100644 --- a/swoc++/include/swoc/bwf_base.h +++ b/swoc++/include/swoc/bwf_base.h @@ -1,21 +1,8 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright Apache Software Foundation 2019 /** @file Basic formatting support for @c BufferWriter. - - @section license License - - Licensed to the Apache Software Foundation (ASF) under one or more contributor license - agreements. See the NOTICE file distributed with this work for additional information regarding - copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with the License. You may - obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software distributed under the - License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either - express or implied. See the License for the specific language governing permissions and - limitations under the License. */ #pragma once @@ -32,13 +19,14 @@ #include <tuple> #include <any> +#include "swoc/swoc_version.h" #include "swoc/TextView.h" #include "swoc/MemSpan.h" #include "swoc/MemArena.h" #include "swoc/BufferWriter.h" #include "swoc/swoc_meta.h" -namespace swoc +namespace SWOC_NAMESPACE { namespace bwf { @@ -958,7 +946,7 @@ BufferWriter &bwformat(BufferWriter &w, bwf::Spec const &spec, std::string_view inline BufferWriter & bwformat(BufferWriter &w, bwf::Spec const &spec, const void *ptr) { - using namespace swoc::literals; + using namespace SWOC_NAMESPACE::literals; bwf::Spec ptr_spec{spec}; ptr_spec._radix_lead_p = true; @@ -1274,4 +1262,4 @@ namespace bwf BufferWriter &bwformat(BufferWriter &w, bwf::Spec const &spec, bwf::HexDump const &hex); -} // namespace swoc +} // namespace SWOC_NAMESPACE diff --git a/swoc++/include/swoc/bwf_ex.h b/swoc++/include/swoc/bwf_ex.h index 1638a1d..5e8a280 100644 --- a/swoc++/include/swoc/bwf_ex.h +++ b/swoc++/include/swoc/bwf_ex.h @@ -1,24 +1,8 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright Apache Software Foundation 2019 /** @file BufferWriter formatters for types in the std namespace. - - @section license License - - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. */ #pragma once @@ -26,14 +10,15 @@ #include <array> #include <string_view> +#include "swoc/swoc_version.h" #include "swoc/bwf_base.h" #include "swoc/swoc_meta.h" -namespace swoc +namespace SWOC_NAMESPACE { namespace bwf { - using namespace swoc::literals; // enable ""sv + using namespace SWOC_NAMESPACE::literals; // enable ""sv /** Output @a text @a n times. * @@ -223,4 +208,4 @@ bwformat(BufferWriter &w, bwf::Spec const &spec, bwf::SubText<Args...> const &su return w; } -} // namespace swoc +} // namespace SWOC_NAMESPACE diff --git a/swoc++/include/swoc/bwf_fwd.h b/swoc++/include/swoc/bwf_fwd.h index 4d90262..944da3e 100644 --- a/swoc++/include/swoc/bwf_fwd.h +++ b/swoc++/include/swoc/bwf_fwd.h @@ -1,26 +1,15 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright Apache Software Foundation 2019 /** @file Forward declarations for BufferWriter formatting. - - @section license License - - Licensed to the Apache Software Foundation (ASF) under one or more contributor license - agreements. See the NOTICE file distributed with this work for additional information regarding - copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with the License. You may - obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software distributed under the - License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either - express or implied. See the License for the specific language governing permissions and - limitations under the License. */ #pragma once -namespace swoc +#include "swoc/swoc_version.h" + +namespace SWOC_NAMESPACE { class BufferWriter; class FixedBufferWriter; @@ -31,4 +20,4 @@ namespace bwf struct Spec; class Format; } // namespace bwf -} // namespace swoc +} // namespace SWOC_NAMESPACE diff --git a/swoc++/include/swoc/bwf_ip.h b/swoc++/include/swoc/bwf_ip.h index 63906d8..9c92530 100644 --- a/swoc++/include/swoc/bwf_ip.h +++ b/swoc++/include/swoc/bwf_ip.h @@ -1,31 +1,20 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright Apache Software Foundation 2019 /** @file BufferWriter formatting for IP addresses. - - @section license License - - Licensed to the Apache Software Foundation (ASF) under one or more contributor license - agreements. See the NOTICE file distributed with this work for additional information regarding - copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with the License. You may - obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software distributed under the - License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either - express or implied. See the License for the specific language governing permissions and - limitations under the License. */ #pragma once #include <iosfwd> +#include <netinet/in.h> + +#include "swoc/swoc_version.h" #include "swoc/bwf_base.h" #include "swoc/swoc_ip.h" -#include <netinet/in.h> -namespace swoc +namespace SWOC_NAMESPACE { // All of these expect the address to be in network order. BufferWriter &bwformat(BufferWriter &w, bwf::Spec const &spec, sockaddr const *addr); @@ -47,7 +36,7 @@ bwformat(BufferWriter &w, bwf::Spec const &spec, IPEndpoint const &addr) { /// Buffer space sufficient for printing any basic IP address type. static const size_t IP_STREAM_SIZE = 80; -} // namespace swoc +} // namespace SWOC_NAMESPACE namespace std { inline ostream & diff --git a/swoc++/include/swoc/bwf_std.h b/swoc++/include/swoc/bwf_std.h index 2b200f7..536b9d8 100644 --- a/swoc++/include/swoc/bwf_std.h +++ b/swoc++/include/swoc/bwf_std.h @@ -1,24 +1,8 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright Apache Software Foundation 2019 /** @file BufferWriter formatters for types in the std namespace. - - @section license License - - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. */ #pragma once @@ -26,6 +10,8 @@ #include <atomic> #include <chrono> #include <bitset> + +#include "swoc/swoc_version.h" #include "swoc/bwf_base.h" namespace std diff --git a/swoc++/include/swoc/ext/HashFNV.h b/swoc++/include/swoc/ext/HashFNV.h index 407b036..a495efc 100644 --- a/swoc++/include/swoc/ext/HashFNV.h +++ b/swoc++/include/swoc/ext/HashFNV.h @@ -27,7 +27,7 @@ #include <cstdint> #include "swoc/TextView.h" -namespace swoc +namespace SWOC_NAMESPACE { struct Hash32FNV1a { protected: @@ -190,4 +190,4 @@ Hash64FNV1a::hash_immediate(std::string_view const &data) -> value_type return this->update(data).final().get(); } -} // namespace swoc +} // namespace SWOC_NAMESPACE diff --git a/swoc++/include/swoc/swoc_file.h b/swoc++/include/swoc/swoc_file.h index e02c369..253303c 100644 --- a/swoc++/include/swoc/swoc_file.h +++ b/swoc++/include/swoc/swoc_file.h @@ -1,21 +1,8 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright Apache Software Foundation 2019 /** @file Simple path and file utilities. - - @section license License - - Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. - See the NOTICE file distributed with this work for additional information regarding copyright - ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance with the License. You may obtain a - copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software distributed under the License - is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - or implied. See the License for the specific language governing permissions and limitations under - the License. */ #pragma once @@ -26,9 +13,10 @@ #include <string_view> #include <system_error> +#include "swoc/swoc_version.h" #include "swoc/TextView.h" -namespace swoc +namespace SWOC_NAMESPACE { namespace file { @@ -242,4 +230,4 @@ namespace bwf } BufferWriter &bwformat(BufferWriter &w, bwf::Spec const &spec, file::path const &p); -} // namespace swoc +} // namespace SWOC_NAMESPACE diff --git a/swoc++/include/swoc/swoc_ip.h b/swoc++/include/swoc/swoc_ip.h index 599b36b..a9c7469 100644 --- a/swoc++/include/swoc/swoc_ip.h +++ b/swoc++/include/swoc/swoc_ip.h @@ -1,4 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 +// Copyright Network Geographics 2014 /** @file IP address and network related classes. */ @@ -8,12 +9,13 @@ #include <string_view> #include <variant> -#include <swoc/TextView.h> -#include <swoc/DiscreteRange.h> -#include <swoc/RBTree.h> +#include "swoc/swoc_version.h" +#include "swoc/TextView.h" +#include "swoc/DiscreteRange.h" +#include "swoc/RBTree.h" #include <values.h> -namespace swoc { +namespace SWOC_NAMESPACE { class IP4Addr; class IP6Addr; @@ -2686,7 +2688,7 @@ auto IPSpace<PAYLOAD>::end() const -> const_iterator { return const_iterator(nc_this->_ip4.end(), nc_this->_ip6.end()); } -} // namespace swoc +} // namespace SWOC_NAMESPACE namespace std { @@ -2746,7 +2748,7 @@ public: } // namespace std -namespace swoc { +namespace SWOC_NAMESPACE { template<size_t IDX> typename std::tuple_element<IDX, IP4Net>::type get(swoc::IP4Net const& net) { @@ -2775,4 +2777,4 @@ get(swoc::IPNet const& net) { } } -} // namespace swoc +} // namespace SWOC_NAMESPACE diff --git a/swoc++/include/swoc/swoc_meta.h b/swoc++/include/swoc/swoc_meta.h index 852a7e0..cfbdd05 100644 --- a/swoc++/include/swoc/swoc_meta.h +++ b/swoc++/include/swoc/swoc_meta.h @@ -1,28 +1,17 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright Verizon Media 2020 /** @file Meta programming support utilities. - - @section license License - - Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. - See the NOTICE file distributed with this work for additional information regarding copyright - ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance with the License. You may obtain a - copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software distributed under the License - is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - or implied. See the License for the specific language governing permissions and limitations under - the License. */ #pragma once #include <type_traits> -namespace swoc +#include "swoc/swoc_version.h" + +namespace SWOC_NAMESPACE { namespace meta { @@ -200,4 +189,4 @@ namespace meta }; } // namespace meta -} // namespace swoc +} // namespace SWOC_NAMESPACE diff --git a/swoc++/include/swoc/swoc_version.h b/swoc++/include/swoc/swoc_version.h index 94716c3..03a87ea 100644 --- a/swoc++/include/swoc/swoc_version.h +++ b/swoc++/include/swoc/swoc_version.h @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright Verizon Media 2020 /** @file Solid Wall of C++ Library @@ -15,29 +17,19 @@ with the ability to extend the formatting to arbitrary types, bind names in to the formatting context, and substitute alternate parsers for custom format styles. - - @section license License - - Licensed to the Apache Software Foundation (ASF) under one or more contributor license - agreements. See the NOTICE file distributed with this work for additional information regarding - copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with the License. You may - obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software distributed under the - License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either - express or implied. See the License for the specific language governing permissions and - limitations under the License. - */ #pragma once -namespace swoc +#if !defined(SWOC_NAMESPACE) +# define SWOC_NAMESPACE swoc_1_2_0 +#endif + +namespace SWOC_NAMESPACE { static constexpr unsigned MAJOR_VERSION = 1; static constexpr unsigned MINOR_VERSION = 2; static constexpr unsigned POINT_VERSION = 0; -} // namespace swoc +} // namespace SWOC_NAMESPACE + +namespace swoc = SWOC_NAMESPACE; diff --git a/swoc++/include/swoc/version_notes.txt b/swoc++/include/swoc/version_notes.txt deleted file mode 100644 index 6f81fd0..0000000 --- a/swoc++/include/swoc/version_notes.txt +++ /dev/null @@ -1,5 +0,0 @@ -Places to update version: (should script this some day). -swoc++/include/swoc/swoc_version.h -doc/conf.py -doc/Doxyfile -swoc++/swoc++.part diff --git a/swoc++/src/ArenaWriter.cc b/swoc++/src/ArenaWriter.cc index a36387e..e94cd21 100644 --- a/swoc++/src/ArenaWriter.cc +++ b/swoc++/src/ArenaWriter.cc @@ -1,13 +1,12 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright Verizon Media 2020 /** @file * @c BufferWriter for a @c MemArena. - * - * Copyright 2019, Oath Inc. - * SPDX-License-Identifier: Apache-2.0 */ #include "swoc/ArenaWriter.h" -namespace swoc +namespace SWOC_NAMESPACE { ArenaWriter & ArenaWriter::write(char c) @@ -49,4 +48,4 @@ ArenaWriter::realloc(size_t n) memcpy(_buffer, text.data(), text.size()); } -} // namespace swoc +} // namespace SWOC_NAMESPACE diff --git a/swoc++/src/Errata.cc b/swoc++/src/Errata.cc index 7c8220c..2bf2660 100644 --- a/swoc++/src/Errata.cc +++ b/swoc++/src/Errata.cc @@ -1,19 +1,8 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright Network Geographics 2014 /** @file Errata implementation. - - Licensed to the Apache Software Foundation (ASF) under one or more contributor license - agreements. See the NOTICE file distributed with this work for additional information regarding - copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with the License. You may - obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software distributed under the - License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either - express or implied. See the License for the specific language governing permissions and - limitations under the License. */ #include <iostream> @@ -26,9 +15,9 @@ using swoc::MemArena; using std::string_view; using namespace std::literals; -using namespace swoc::literals; +using namespace SWOC_NAMESPACE::literals; -namespace swoc +namespace SWOC_NAMESPACE { /** List of sinks for abandoned erratum. */ @@ -217,4 +206,4 @@ operator<<(std::ostream &os, Errata const &err) return err.write(os); } -} // namespace swoc +} // namespace SWOC_NAMESPACE diff --git a/swoc++/src/MemArena.cc b/swoc++/src/MemArena.cc index 4e42ca6..1e16763 100644 --- a/swoc++/src/MemArena.cc +++ b/swoc++/src/MemArena.cc @@ -1,27 +1,14 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright Verizon Media 2020 /** @file MemArena memory allocator. Chunks of memory are allocated, frozen into generations and thawed away when unused. */ - -/* Licensed to the Apache Software Foundation (ASF) under one or more contributor license - agreements. See the NOTICE file distributed with this work for additional information regarding - copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with the License. You may - obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software distributed under the - License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either - express or implied. See the License for the specific language governing permissions and - limitations under the License. - */ - #include <algorithm> #include "swoc/MemArena.h" -using namespace swoc; +using namespace SWOC_NAMESPACE; void MemArena::Block::operator delete(void *ptr) diff --git a/swoc++/src/RBTree.cc b/swoc++/src/RBTree.cc index fab84c1..7e96486 100644 --- a/swoc++/src/RBTree.cc +++ b/swoc++/src/RBTree.cc @@ -1,25 +1,13 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright Apache Software Foundation 2019 /** @file Red/Black tree implementation. */ -/* Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. - See the NOTICE file distributed with this work for additional information regarding copyright - ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance with the License. You may obtain a - copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software distributed under the License - is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - or implied. See the License for the specific language governing permissions and limitations under - the License. - */ - #include "swoc/RBTree.h" -namespace swoc +namespace SWOC_NAMESPACE { namespace detail { @@ -374,4 +362,4 @@ namespace detail } } // namespace detail -} // namespace swoc +} // namespace SWOC_NAMESPACE diff --git a/swoc++/src/TextView.cc b/swoc++/src/TextView.cc index f96df5b..6459712 100644 --- a/swoc++/src/TextView.cc +++ b/swoc++/src/TextView.cc @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright Apache Software Foundation 2019 /** @file Class for handling "views" of a buffer. Views presume the memory for the @@ -7,21 +9,6 @@ better string parsing, particularly token based parsing. */ -/* Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with this - work for additional information regarding copyright ownership. The ASF - licenses this file to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - License for the specific language governing permissions and limitations under - the License. -*/ #include "swoc/TextView.h" #include <cctype> #include <sstream> diff --git a/swoc++/src/bw_format.cc b/swoc++/src/bw_format.cc index d82fbde..7036075 100644 --- a/swoc++/src/bw_format.cc +++ b/swoc++/src/bw_format.cc @@ -32,12 +32,12 @@ #include "swoc/swoc_meta.h" using namespace std::literals; -using namespace swoc::literals; +using namespace SWOC_NAMESPACE::literals; swoc::bwf::ExternalNames swoc::bwf::Global_Names; using swoc::svto_radix; -namespace swoc +namespace SWOC_NAMESPACE { namespace bwf { @@ -990,7 +990,7 @@ namespace { } // namespace -} // namespace swoc +} // namespace SWOC_NAMESPACE namespace std { diff --git a/swoc++/src/bw_ip_format.cc b/swoc++/src/bw_ip_format.cc index 8c8ecdc..4355d8a 100644 --- a/swoc++/src/bw_ip_format.cc +++ b/swoc++/src/bw_ip_format.cc @@ -21,9 +21,9 @@ #include "swoc/swoc_ip.h" #include "swoc/bwf_ip.h" -using namespace swoc::literals; +using namespace SWOC_NAMESPACE::literals; -namespace swoc +namespace SWOC_NAMESPACE { using bwf::Spec; @@ -304,4 +304,4 @@ bwformat(BufferWriter & w, Spec const& spec, IPRange const& range) { } -} // namespace swoc +} // namespace SWOC_NAMESPACE diff --git a/swoc++/src/swoc_file.cc b/swoc++/src/swoc_file.cc index 5f1c4d6..254bff6 100644 --- a/swoc++/src/swoc_file.cc +++ b/swoc++/src/swoc_file.cc @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright Apache Software Foundation 2019 /** @file Minimalist version of std::filesystem. @@ -23,9 +25,9 @@ #include "swoc/swoc_file.h" #include "swoc/bwf_base.h" -using namespace swoc::literals; +using namespace SWOC_NAMESPACE::literals; -namespace swoc +namespace SWOC_NAMESPACE { namespace file { @@ -143,4 +145,4 @@ bwformat(BufferWriter &w, bwf::Spec const &spec, file::path const &p) return bwformat(w, spec, p.string()); } -} // namespace swoc +} // namespace SWOC_NAMESPACE diff --git a/swoc++/src/swoc_ip.cc b/swoc++/src/swoc_ip.cc index 878abc3..7a5906a 100644 --- a/swoc++/src/swoc_ip.cc +++ b/swoc++/src/swoc_ip.cc @@ -1,31 +1,18 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright Network Geographics 2014 /** @file IP address support. - - @section license License - - Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. - See the NOTICE file distributed with this work for additional information regarding copyright - ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance with the License. You may obtain a - copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software distributed under the License - is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - or implied. See the License for the specific language governing permissions and limitations under - the License. */ -#include <swoc/swoc_ip.h> +#include "swoc/swoc_ip.h" #include "swoc/swoc_ip.h" #include "swoc/swoc_meta.h" using swoc::TextView; using swoc::svtoi; using swoc::svtou; -using namespace swoc::literals; +using namespace SWOC_NAMESPACE::literals; namespace { // Handle the @c sin_len member, the presence of which varies across compilation environments. @@ -49,7 +36,7 @@ Set_Sockaddr_Len(T *addr) { } // namespace -namespace swoc { +namespace SWOC_NAMESPACE { IPAddr const IPAddr::INVALID; IP4Addr const IP4Addr::MIN{INADDR_ANY}; IP4Addr const IP4Addr::MAX{INADDR_BROADCAST}; @@ -979,4 +966,4 @@ void IP6Range::NetSource::search_narrower() { } } -} // namespace swoc +} // namespace SWOC_NAMESPACE diff --git a/tools/ats-revert.sh b/tools/ats-revert.sh index e94102d..ac72e42 100644 --- a/tools/ats-revert.sh +++ b/tools/ats-revert.sh @@ -8,7 +8,7 @@ function rewrite { sed -i -E --expr 's!swoc/ext/catch.hpp!catch.hpp!g' $1 sed -i -E --expr 's!swoc::!ts::!g' $1 sed -i -E --expr 's!swoc/!tscpp/util/!g' $1 - sed -i -E --expr 's!namespace swoc!namespace ts!g' $1 + sed -i -E --expr 's!namespace SWOC_NAMESPACE!namespace ts!g' $1 sed -i -E --expr 's!ts/swoc_meta!tscpp/util/ts_meta!g' $1 sed -i -E --expr 's!swoc_meta!ts_meta!g' $1 sed -i -E --expr 's![[]libswoc[]]![libtscpputil]!' $1 diff --git a/tools/rewrite.sh b/tools/rewrite.sh index 4cd6ab9..dcdd338 100644 --- a/tools/rewrite.sh +++ b/tools/rewrite.sh @@ -1,8 +1,8 @@ #!/usr/bin/env bash function rewrite { - sed -i -E --expr 's!namespace ts!namespace swoc!g' $1 - sed -i -E --expr 's!^}\s+// namespace ts!} //namespace swoc!g' $1 + sed -i -E --expr 's!namespace ts!namespace SWOC_NAMESPACE!g' $1 + sed -i -E --expr 's!^}\s+// namespace ts!} //namespace SWOC_NAMESPACE!g' $1 sed -i -E --expr 's!ts::!swoc::!g' $1 sed -i -E --expr 's!include "tscpp/util/!include "swoc/!' $1 sed -i -E --expr 's!"[^"]*catch.hpp"!"swoc/ext/catch.hpp"!' $1 diff --git a/tools/update-version.sh b/tools/update-version.sh index 7cca62e..d54f1fd 100644 --- a/tools/update-version.sh +++ b/tools/update-version.sh @@ -6,6 +6,7 @@ if [ -z "$3" ] ; then fi # Header +sed -i swoc++/include/swoc/swoc_version.h --expr "s/SWOC_namespace SWOC_NAMESPACE_(?:\d+)_(?:\d+)_(?:\d+)/SWOC_namespace SWOC_NAMESPACE_$1_$2_$3/" sed -i swoc++/include/swoc/swoc_version.h --expr "s/\(MAJOR_VERSION *= *\).*\$/\\1$1;/" sed -i swoc++/include/swoc/swoc_version.h --expr "s/\(MINOR_VERSION *= *\).*\$/\\1$2;/" sed -i swoc++/include/swoc/swoc_version.h --expr "s/\(POINT_VERSION *= *\).*\$/\\1$3;/" diff --git a/unit_tests/ex_MemArena.cc b/unit_tests/ex_MemArena.cc index e627a41..fce543e 100644 --- a/unit_tests/ex_MemArena.cc +++ b/unit_tests/ex_MemArena.cc @@ -19,7 +19,7 @@ #include <string_view> #include <memory> #include <random> -#include <swoc/BufferWriter.h> +#include "swoc/BufferWriter.h" #include "swoc/MemArena.h" #include "swoc/TextView.h" #include "swoc/IntrusiveHashMap.h" diff --git a/unit_tests/ex_TextView.cc b/unit_tests/ex_TextView.cc index a44853f..998e901 100644 --- a/unit_tests/ex_TextView.cc +++ b/unit_tests/ex_TextView.cc @@ -24,13 +24,13 @@ #include <array> #include <functional> -#include <swoc/swoc_file.h> +#include "swoc/swoc_file.h" #include "swoc/TextView.h" #include "catch.hpp" using swoc::TextView; -using namespace swoc::literals; +using namespace SWOC_NAMESPACE::literals; // CSV parsing. namespace @@ -219,7 +219,7 @@ TEST_CASE("TextView Lines", "[libswoc][example][textview][lines]") }; #include <set> -#include <swoc/swoc_ip.h> +#include "swoc/swoc_ip.h" TEST_CASE("TextView misc", "[libswoc][example][textview][misc]") { diff --git a/unit_tests/ex_ipspace_properties.cc b/unit_tests/ex_ipspace_properties.cc index 196b61a..3ee9269 100644 --- a/unit_tests/ex_ipspace_properties.cc +++ b/unit_tests/ex_ipspace_properties.cc @@ -11,13 +11,13 @@ #include <memory> #include <limits> -#include <swoc/TextView.h> -#include <swoc/swoc_ip.h> -#include <swoc/bwf_ip.h> -#include <swoc/bwf_std.h> +#include "swoc/TextView.h" +#include "swoc/swoc_ip.h" +#include "swoc/bwf_ip.h" +#include "swoc/bwf_std.h" using namespace std::literals; -using namespace swoc::literals; +using namespace SWOC_NAMESPACE::literals; using swoc::TextView; using swoc::IPEndpoint; diff --git a/unit_tests/test_Lexicon.cc b/unit_tests/test_Lexicon.cc index 48726f0..d58ec59 100644 --- a/unit_tests/test_Lexicon.cc +++ b/unit_tests/test_Lexicon.cc @@ -1,21 +1,8 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright Verizon Media 2020 /** @file Lexicon unit tests. - - @section license License - - Licensed to the Apache Software Foundation (ASF) under one or more contributor license - agreements. See the NOTICE file distributed with this work for additional information regarding - copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with the License. You may - obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software distributed under the - License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either - express or implied. See the License for the specific language governing permissions and - limitations under the License. */ #include "swoc/Lexicon.h" diff --git a/unit_tests/test_TextView.cc b/unit_tests/test_TextView.cc index 9fd4106..77f5c5f 100644 --- a/unit_tests/test_TextView.cc +++ b/unit_tests/test_TextView.cc @@ -28,7 +28,7 @@ using swoc::TextView; using namespace std::literals; -using namespace swoc::literals; +using namespace SWOC_NAMESPACE::literals; TEST_CASE("TextView Constructor", "[libswoc][TextView]") { diff --git a/unit_tests/test_bw_format.cc b/unit_tests/test_bw_format.cc index 84e08bf..6e3b79c 100644 --- a/unit_tests/test_bw_format.cc +++ b/unit_tests/test_bw_format.cc @@ -1,21 +1,7 @@ +// SPDX-License-Identifier: Apache-2.0 /** @file Unit tests for BufferFormat and bwprint. - - @section license License - - Licensed to the Apache Software Foundation (ASF) under one or more contributor license - agreements. See the NOTICE file distributed with this work for additional information regarding - copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with the License. You may - obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software distributed under the - License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either - express or implied. See the License for the specific language governing permissions and - limitations under the License. */ #include <chrono> @@ -32,7 +18,7 @@ #include "catch.hpp" using namespace std::literals; -using namespace swoc::literals; +using namespace SWOC_NAMESPACE::literals; using swoc::TextView; using swoc::bwprint; @@ -49,7 +35,7 @@ TEST_CASE("Buffer Writer << operator", "[bufferwriter][stream]") { } TEST_CASE("bwprint basics", "[bwprint]") { - swoc::LocalBufferWriter<256> bw;s + swoc::LocalBufferWriter<256> bw; 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"}; diff --git a/unit_tests/test_ip.cc b/unit_tests/test_ip.cc index f0f39c3..ed6beec 100644 --- a/unit_tests/test_ip.cc +++ b/unit_tests/test_ip.cc @@ -1,6 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 // Copyright 2014 Network Geographics - /** @file IP address support testing. @@ -10,14 +9,14 @@ #include <set> -#include <swoc/TextView.h> -#include <swoc/swoc_ip.h> -#include <swoc/bwf_ip.h> -#include <swoc/bwf_std.h> -#include <swoc/swoc_file.h> +#include "swoc/TextView.h" +#include "swoc/swoc_ip.h" +#include "swoc/bwf_ip.h" +#include "swoc/bwf_std.h" +#include "swoc/swoc_file.h" using namespace std::literals; -using namespace swoc::literals; +using namespace SWOC_NAMESPACE::literals; using swoc::TextView; using swoc::IPEndpoint; diff --git a/unit_tests/test_meta.cc b/unit_tests/test_meta.cc index 00ce1c4..55496d3 100644 --- a/unit_tests/test_meta.cc +++ b/unit_tests/test_meta.cc @@ -27,7 +27,7 @@ #include "catch.hpp" using swoc::TextView; -using namespace swoc::literals; +using namespace SWOC_NAMESPACE::literals; struct A { int _value;
