Skip to content

Commit

Permalink
Concat nested namespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
rmisev committed Sep 29, 2024
1 parent 3f0bdd3 commit 1940042
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 62 deletions.
12 changes: 4 additions & 8 deletions include/upa/idna/idna.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
#include <string>
#include <type_traits> // std::make_unsigned

namespace upa { // NOLINT(modernize-concat-nested-namespaces)
namespace idna {
namespace upa::idna {

enum class Option {
Default = 0,
Expand All @@ -28,17 +27,15 @@ enum class Option {
InputASCII = 0x1000,
};

} // namespace idna
} // namespace upa
} // namespace upa::idna

// enable bit mask operators on upa::idna::Option
template<>
struct enable_bitmask_operators<upa::idna::Option> {
static const bool enable = true;
};

namespace upa { // NOLINT(modernize-concat-nested-namespaces)
namespace idna {
namespace upa::idna {
namespace detail {

// Bit flags
Expand Down Expand Up @@ -247,7 +244,6 @@ inline unsigned unicode_version() {
}


} // namespace idna
} // namespace upa
} // namespace upa::idna

#endif // UPA_IDNA_IDNA_H
8 changes: 2 additions & 6 deletions include/upa/idna/idna_table.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
#include <cstddef>
#include <cstdint>

namespace upa { // NOLINT(modernize-concat-nested-namespaces)
namespace idna { // NOLINT(modernize-concat-nested-namespaces)
namespace util {
namespace upa::idna::util {

// ASCII
const std::uint8_t AC_VALID = 0x01;
Expand Down Expand Up @@ -104,8 +102,6 @@ inline std::size_t apply_mapping(uint32_t val, StrT& output) {
return 0;
}

} // namespace util
} // namespace idna
} // namespace upa
} // namespace upa::idna::util

#endif // UPA_IDNA_IDNA_TABLE_H
8 changes: 2 additions & 6 deletions include/upa/idna/iterate_utf.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@

#include <cstdint>

namespace upa { // NOLINT(modernize-concat-nested-namespaces)
namespace idna { // NOLINT(modernize-concat-nested-namespaces)
namespace util {
namespace upa::idna::util {

// Get code point from UTF-8

Expand Down Expand Up @@ -97,8 +95,6 @@ inline uint32_t getCodePoint(const char32_t*& it, const char32_t*) {
return *it++;
}

} // namespace util
} // namespace idna
} // namespace upa
} // namespace upa::idna::util

#endif // UPA_IDNA_ITERATE_UTF_H
6 changes: 2 additions & 4 deletions include/upa/idna/nfc.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@

#include <string>

namespace upa { // NOLINT(modernize-concat-nested-namespaces)
namespace idna {
namespace upa::idna {


void compose(std::u32string& str);
Expand All @@ -18,7 +17,6 @@ void normalize_nfc(std::u32string& str);
bool is_normalized_nfc(const char32_t* first, const char32_t* last);


} // namespace idna
} // namespace upa
} // namespace upa::idna

#endif // UPA_IDNA_NFC_H
8 changes: 2 additions & 6 deletions include/upa/idna/punycode.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@

#include <string>

namespace upa { // NOLINT(modernize-concat-nested-namespaces)
namespace idna { // NOLINT(modernize-concat-nested-namespaces)
namespace punycode {
namespace upa::idna::punycode {

enum class status {
success = 0,
Expand All @@ -21,8 +19,6 @@ enum class status {
status encode(std::string& output, const char32_t* first, const char32_t* last);
status decode(std::u32string& output, const char32_t* first, const char32_t* last);

} // namespace punycode
} // namespace idna
} // namespace upa
} // namespace upa::idna::punycode

#endif // UPA_IDNA_PUNYCODE_H
6 changes: 2 additions & 4 deletions src/idna.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
#include <stdexcept>
#include <string>

namespace upa { // NOLINT(modernize-concat-nested-namespaces)
namespace idna {
namespace upa::idna {
namespace {

// Split
Expand Down Expand Up @@ -368,5 +367,4 @@ bool to_unicode_mapped(std::u32string& domain, const std::u32string& mapped, Opt


} // namespace detail
} // namespace idna
} // namespace upa
} // namespace upa::idna
8 changes: 2 additions & 6 deletions src/idna_table.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
//
#include "upa/idna/idna_table.h"

namespace upa { // NOLINT(modernize-concat-nested-namespaces)
namespace idna { // NOLINT(modernize-concat-nested-namespaces)
namespace util {
namespace upa::idna::util {

// BEGIN-GENERATED
const std::uint32_t blockData[] = {
Expand Down Expand Up @@ -2136,6 +2134,4 @@ const std::uint8_t asciiData[128] = {

// END-GENERATED

} // namespace util
} // namespace idna
} // namespace upa
} // namespace upa::idna::util
6 changes: 2 additions & 4 deletions src/nfc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
#include <iterator>


namespace upa { // NOLINT(modernize-concat-nested-namespaces)
namespace idna {
namespace upa::idna {

namespace hangul {
constexpr char32_t SBase = 0xAC00;
Expand Down Expand Up @@ -160,5 +159,4 @@ bool is_normalized_nfc(const char32_t* first, const char32_t* last) {
}


} // namespace idna
} // namespace upa
} // namespace upa::idna
8 changes: 2 additions & 6 deletions src/nfc_table.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
//
#include "nfc_table.h"

namespace upa { // NOLINT(modernize-concat-nested-namespaces)
namespace idna { // NOLINT(modernize-concat-nested-namespaces)
namespace normalize {
namespace upa::idna::normalize {

// BEGIN-GENERATED
const std::uint8_t ccc_block[] = {
Expand Down Expand Up @@ -1237,6 +1235,4 @@ const char32_t decomp_block_data[] = {
};
// END-GENERATED

} // namespace normalize
} // namespace idna
} // namespace upa
} // namespace upa::idna::normalize
8 changes: 2 additions & 6 deletions src/nfc_table.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
#include <cstddef>
#include <cstdint>

namespace upa { // NOLINT(modernize-concat-nested-namespaces)
namespace idna { // NOLINT(modernize-concat-nested-namespaces)
namespace normalize {
namespace upa::idna::normalize {

struct codepoint_key_val {
char32_t key;
Expand Down Expand Up @@ -90,8 +88,6 @@ inline const char32_t* get_decomposition_chars(std::uint16_t di) {
return static_cast<const char32_t*>(decomp_block_data) + (di & 0xFFF);
}

} // namespace normalize
} // namespace idna
} // namespace upa
} // namespace upa::idna::normalize

#endif // #ifndef UPA_IDNA_NFC_TABLE_H
8 changes: 2 additions & 6 deletions src/punycode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
#include <cstdint>
#include <type_traits>

namespace upa { // NOLINT(modernize-concat-nested-namespaces)
namespace idna { // NOLINT(modernize-concat-nested-namespaces)
namespace punycode {
namespace upa::idna::punycode {

namespace {

Expand Down Expand Up @@ -257,6 +255,4 @@ status decode(std::u32string& output, const char32_t* first, const char32_t* las
}


} // namespace punycode
} // namespace idna
} // namespace upa
} // namespace upa::idna::punycode

0 comments on commit 1940042

Please sign in to comment.