Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion include/upa/idna/bitmask_operators.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,13 @@
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

#include<type_traits>
#include "config.h"

#ifndef UPA_MODULE
# include<type_traits>
#endif // UPA_MODULE

UPA_EXPORT_BEGIN

namespace upa::idna {

Expand Down Expand Up @@ -104,4 +110,6 @@ operator^=(E& lhs, E rhs) noexcept {
return lhs;
}

UPA_EXPORT_END

#endif // UPA_IDNA_BITMASK_OPERATORS_HPP
8 changes: 8 additions & 0 deletions include/upa/idna/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,12 @@
# define UPA_IDNA_API
#endif

// The following macros have values when the library is compiled as a module

#ifndef UPA_EXPORT
# define UPA_EXPORT
# define UPA_EXPORT_BEGIN
# define UPA_EXPORT_END
#endif

#endif // UPA_IDNA_CONFIG_H
12 changes: 10 additions & 2 deletions include/upa/idna/idna.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2017-2025 Rimas Misevičius
// Copyright 2017-2026 Rimas Misevičius
// Distributed under the BSD-style license that can be
// found in the LICENSE file.
//
Expand All @@ -8,10 +8,15 @@
#include "bitmask_operators.hpp"
#include "config.h" // IWYU pragma: export
#include "idna_version.h" // IWYU pragma: export
#include <string>

#ifndef UPA_MODULE
# include <string>
#endif // UPA_MODULE

namespace upa::idna {

UPA_EXPORT_BEGIN

enum class Option {
Default = 0,
UseSTD3ASCIIRules = 0x0001,
Expand All @@ -27,6 +32,7 @@ enum class Option {
template<>
struct enable_bitmask_operators<Option> : public std::true_type {};

UPA_EXPORT_END

namespace detail {

Expand Down Expand Up @@ -64,6 +70,7 @@ UPA_IDNA_API bool to_unicode_mapped(std::u32string& domain, const std::u32string

} // namespace detail

UPA_EXPORT_BEGIN

/// @brief Implements the Unicode IDNA ToASCII
///
Expand Down Expand Up @@ -166,6 +173,7 @@ inline bool domain_to_unicode(std::u32string& domain, const CharT* input, const
return make_unicode_version(17);
}

UPA_EXPORT_END

} // namespace upa::idna

Expand Down
7 changes: 5 additions & 2 deletions include/upa/idna/nfc.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
// Copyright 2024-2025 Rimas Misevičius
// Copyright 2024-2026 Rimas Misevičius
// Distributed under the BSD-style license that can be
// found in the LICENSE file.
//
#ifndef UPA_IDNA_NFC_H
#define UPA_IDNA_NFC_H

#include "config.h" // IWYU pragma: export
#include <string>

#ifndef UPA_MODULE
# include <string>
#endif // UPA_MODULE

namespace upa::idna {

Expand Down
7 changes: 5 additions & 2 deletions include/upa/idna/punycode.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
// Copyright 2017-2025 Rimas Misevičius
// Copyright 2017-2026 Rimas Misevičius
// Distributed under the BSD-style license that can be
// found in the LICENSE file.
//
#ifndef UPA_IDNA_PUNYCODE_H
#define UPA_IDNA_PUNYCODE_H

#include "config.h" // IWYU pragma: export
#include <string>

#ifndef UPA_MODULE
# include <string>
#endif

namespace upa::idna::punycode {

Expand Down
20 changes: 11 additions & 9 deletions src/idna.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,19 @@
// Distributed under the BSD-style license that can be
// found in the LICENSE file.
//
#include "upa/idna/idna.h"
#ifndef UPA_MODULE
# include "upa/idna/idna.h"
# include "upa/idna/nfc.h"
# include "upa/idna/punycode.h"
# include <algorithm>
# include <iterator>
# include <stdexcept>
# include <string>
# include <type_traits> // std::make_unsigned
#endif // UPA_MODULE

#include "idna_table.h"
#include "iterate_utf.h"
#include "upa/idna/nfc.h"
#include "upa/idna/punycode.h"

#include <algorithm>
#include <iterator>
#include <stdexcept>
#include <string>
#include <type_traits> // std::make_unsigned

namespace upa::idna {
namespace {
Expand Down
6 changes: 4 additions & 2 deletions src/idna_table.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
#ifndef UPA_IDNA_IDNA_TABLE_H
#define UPA_IDNA_IDNA_TABLE_H

#include <cstddef>
#include <cstdint>
#ifndef UPA_MODULE
# include <cstddef>
# include <cstdint>
#endif // UPA_MODULE

namespace upa::idna::util {

Expand Down
4 changes: 3 additions & 1 deletion src/iterate_utf.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
#ifndef UPA_IDNA_ITERATE_UTF_H
#define UPA_IDNA_ITERATE_UTF_H

#include <cstdint>
#ifndef UPA_MODULE
# include <cstdint>
#endif // UPA_MODULE

namespace upa::idna::util {

Expand Down
12 changes: 7 additions & 5 deletions src/nfc.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
// Copyright 2024-2025 Rimas Misevičius
// Copyright 2024-2026 Rimas Misevičius
// Distributed under the BSD-style license that can be
// found in the LICENSE file.
//
#include "upa/idna/nfc.h"
#include "nfc_table.h"
#include <algorithm>
#include <utility> // std::move
#ifndef UPA_MODULE
# include "upa/idna/nfc.h"
# include <algorithm>
# include <utility> // std::move
#endif // UPA_MODULE

#include "nfc_table.h"

namespace upa::idna {

Expand Down
8 changes: 5 additions & 3 deletions src/nfc_table.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
// Copyright 2024-2025 Rimas Misevičius
// Copyright 2024-2026 Rimas Misevičius
// Distributed under the BSD-style license that can be
// found in the LICENSE file.
//
#ifndef UPA_IDNA_NFC_TABLE_H
#define UPA_IDNA_NFC_TABLE_H

#include <cstddef>
#include <cstdint>
#ifndef UPA_MODULE
# include <cstddef>
# include <cstdint>
#endif // UPA_MODULE

namespace upa::idna::normalize {

Expand Down
12 changes: 7 additions & 5 deletions src/punycode.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
// Copyright 2017-2024 Rimas Misevičius
// Copyright 2017-2026 Rimas Misevičius
// Distributed under the BSD-style license that can be
// found in the LICENSE file.
//
#include "upa/idna/punycode.h"
#include <algorithm>
#include <cstdint>
#include <type_traits>
#ifndef UPA_MODULE
# include "upa/idna/punycode.h"
# include <algorithm>
# include <cstdint>
# include <type_traits>
#endif // UPA_MODULE

namespace upa::idna::punycode {

Expand Down
6 changes: 4 additions & 2 deletions tools/amalgamate/config-cpp.prologue
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Copyright 2017-2025 Rimas Misevičius
// Copyright 2017-2026 Rimas Misevičius
// Distributed under the BSD-style license that can be
// found in the LICENSE file.
//
#include "upa/idna.h"
#ifndef UPA_MODULE
# include "upa/idna.h"
#endif // UPA_MODULE