Skip to content
Closed
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
21 changes: 19 additions & 2 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ DerivePointerAlignment: false
PointerAlignment: Left
ReferenceAlignment: Left
ReflowComments: true
SortIncludes: false
SortIncludes: CaseSensitive
SortUsingDeclarations: false
MaxEmptyLinesToKeep: 1

Expand All @@ -93,7 +93,24 @@ IndentRequiresClause: true
SpaceAroundPointerQualifiers: Default

# Include formatting
IncludeBlocks: Preserve
IncludeBlocks: Regroup
IncludeCategories:
# 1. Main header (e.g., foo.cpp includes foo.hpp first)
- Regex: '^".*\.hpp"$'
Priority: 1
SortPriority: 1
# 2. C++ standard library
- Regex: '^<[^/]+>$'
Priority: 2
SortPriority: 2
# 3. Third-party libraries (uni-algo, catch2, nlohmann)
- Regex: '^<(uni|catch2|nlohmann)/'
Priority: 3
SortPriority: 3
# 4. Project headers (skyr/...)
- Regex: '^<skyr/'
Priority: 4
SortPriority: 4

# Namespace formatting
CompactNamespaces: false
Expand Down
2 changes: 1 addition & 1 deletion include/skyr/concepts/url_concepts.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
#ifndef SKYR_CONCEPTS_URL_CONCEPTS_HPP
#define SKYR_CONCEPTS_URL_CONCEPTS_HPP

#include <type_traits>
#include <string>
#include <string_view>
#include <type_traits>

namespace skyr {
template <class T, class charT>
Expand Down
6 changes: 3 additions & 3 deletions include/skyr/containers/static_vector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
#ifndef SKYR_CONTAINERS_STATIC_VECTOR_HPP
#define SKYR_CONTAINERS_STATIC_VECTOR_HPP

#include <cstdlib>
#include <array>
#include <type_traits>
#include <optional>
#include <cassert>
#include <cstdlib>
#include <new>
#include <optional>
#include <type_traits>

namespace skyr {
///
Expand Down
4 changes: 2 additions & 2 deletions include/skyr/core/check_input.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
#ifndef SKYR_CORE_CHECK_INPUT_HPP
#define SKYR_CORE_CHECK_INPUT_HPP

#include <locale>
#include <string>
#include <algorithm>
#include <iterator>
#include <locale>
#include <string>

namespace skyr {
constexpr static auto is_c0_control_or_space = [](auto byte) {
Expand Down
12 changes: 6 additions & 6 deletions include/skyr/core/host.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@
#ifndef SKYR_CORE_HOST_HPP
#define SKYR_CORE_HOST_HPP

#include <variant>
#include <string>
#include <cassert>
#include <algorithm>
#include <cassert>
#include <expected>
#include <algorithm>
#include <ranges>
#include <string>
#include <variant>

#include <skyr/core/errors.hpp>
#include <skyr/domain/domain.hpp>
#include <skyr/network/ipv4_address.hpp>
#include <skyr/network/ipv6_address.hpp>
#include <skyr/percent_encoding/percent_encoded_char.hpp>
#include <skyr/percent_encoding/percent_decode.hpp>
#include <skyr/domain/domain.hpp>
#include <skyr/percent_encoding/percent_encoded_char.hpp>

namespace skyr {
/// Represents a domain name in a [URL host](https://url.spec.whatwg.org/#host-representation)
Expand Down
9 changes: 5 additions & 4 deletions include/skyr/core/parse.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@
#ifndef SKYR_CORE_PARSE_HPP
#define SKYR_CORE_PARSE_HPP

#include <system_error>
#include <optional>
#include <expected>
#include <skyr/core/url_record.hpp>
#include <skyr/core/errors.hpp>
#include <optional>
#include <system_error>

#include <skyr/core/check_input.hpp>
#include <skyr/core/errors.hpp>
#include <skyr/core/url_parser_context.hpp>
#include <skyr/core/url_record.hpp>

namespace skyr {
namespace details {
Expand Down
1 change: 1 addition & 0 deletions include/skyr/core/parse_path.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include <string>
#include <vector>

#include <skyr/core/parse.hpp>

namespace skyr {
Expand Down
3 changes: 2 additions & 1 deletion include/skyr/core/parse_query.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
#ifndef SKYR_CORE_PARSE_QUERY_HPP
#define SKYR_CORE_PARSE_QUERY_HPP

#include <ranges>
#include <string>
#include <vector>
#include <ranges>

#include <skyr/core/parse.hpp>

namespace skyr {
Expand Down
2 changes: 1 addition & 1 deletion include/skyr/core/schemes.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
#ifndef SKYR_CORE_URL_SCHEMES_HPP
#define SKYR_CORE_URL_SCHEMES_HPP

#include <string_view>
#include <cstdint>
#include <optional>
#include <string_view>

namespace skyr {
/// \param scheme
Expand Down
1 change: 1 addition & 0 deletions include/skyr/core/serialize.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include <format>
#include <ranges>

#include <skyr/core/url_record.hpp>

namespace skyr {
Expand Down
5 changes: 3 additions & 2 deletions include/skyr/core/url_parse_state.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
#ifndef SKYR_URL_PARSE_STATE_HPP
#define SKYR_URL_PARSE_STATE_HPP

#include <string>
#include <optional>
#include <expected>
#include <optional>
#include <string>

#include <skyr/core/url_record.hpp>

namespace skyr {
Expand Down
17 changes: 9 additions & 8 deletions include/skyr/core/url_parser_context.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,21 @@
#ifndef SKYR_CORE_URL_PARSER_CONTEXT_HPP
#define SKYR_CORE_URL_PARSER_CONTEXT_HPP

#include <array>
#include <cassert>
#include <string_view>
#include <optional>
#include <expected>
#include <iterator>
#include <limits>
#include <array>
#include <locale>
#include <expected>
#include <skyr/domain/domain.hpp>
#include <skyr/core/schemes.hpp>
#include <skyr/core/host.hpp>
#include <optional>
#include <string_view>

#include <skyr/core/errors.hpp>
#include <skyr/core/url_record.hpp>
#include <skyr/core/host.hpp>
#include <skyr/core/schemes.hpp>
#include <skyr/core/url_parse_state.hpp>
#include <skyr/core/url_record.hpp>
#include <skyr/domain/domain.hpp>
#include <skyr/percent_encoding/percent_encoded_char.hpp>

namespace skyr {
Expand Down
5 changes: 3 additions & 2 deletions include/skyr/core/url_record.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
#ifndef SKYR_CORE_URL_RECORD_HPP
#define SKYR_CORE_URL_RECORD_HPP

#include <vector>
#include <string>
#include <cstdint>
#include <optional>
#include <string>
#include <vector>

#include <skyr/core/host.hpp>
#include <skyr/core/schemes.hpp>

Expand Down
13 changes: 7 additions & 6 deletions include/skyr/domain/domain.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,19 @@
#ifndef SKYR_DOMAIN_DOMAIN_HPP
#define SKYR_DOMAIN_DOMAIN_HPP

#include <string>
#include <string_view>
#include <algorithm>
#include <iterator>
#include <expected>
#include <iterator>
#include <ranges>
#include <skyr/unicode/ranges/transforms/u32_transform.hpp>
#include <skyr/unicode/ranges/transforms/u8_transform.hpp>
#include <skyr/unicode/ranges/views/u8_view.hpp>
#include <string>
#include <string_view>

#include <skyr/domain/errors.hpp>
#include <skyr/domain/idna.hpp>
#include <skyr/domain/punycode.hpp>
#include <skyr/unicode/ranges/transforms/u32_transform.hpp>
#include <skyr/unicode/ranges/transforms/u8_transform.hpp>
#include <skyr/unicode/ranges/views/u8_view.hpp>

namespace skyr {
constexpr inline auto validate_label(std::u32string_view label, [[maybe_unused]] bool use_std3_ascii_rules,
Expand Down
3 changes: 2 additions & 1 deletion include/skyr/domain/idna.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
#define SKYR_DOMAIN_IDNA_HPP

#include <expected>

#include <skyr/domain/errors.hpp>
#include <skyr/unicode/traits/range_iterator.hpp>
#include <skyr/domain/idna_tables.hpp>
#include <skyr/unicode/traits/range_iterator.hpp>

namespace skyr::idna {
///
Expand Down
1 change: 1 addition & 0 deletions include/skyr/domain/idna_tables.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <algorithm>
#include <array>
#include <iterator>

#include <skyr/domain/idna_status.hpp>

namespace skyr::idna::details {
Expand Down
11 changes: 6 additions & 5 deletions include/skyr/domain/punycode.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@
#ifndef SKYR_DOMAIN_PUNYCODE_HPP
#define SKYR_DOMAIN_PUNYCODE_HPP

#include <algorithm>
#include <cstdint>
#include <expected>
#include <limits>
#include <ranges>
#include <string>
#include <string_view>
#include <limits>
#include <cstdint>
#include <vector>
#include <algorithm>
#include <ranges>
#include <expected>

#include <skyr/domain/errors.hpp>

namespace skyr {
Expand Down
5 changes: 3 additions & 2 deletions include/skyr/filesystem/path.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
#ifndef SKYR_FILESYSTEM_PATH_HPP
#define SKYR_FILESYSTEM_PATH_HPP

#include <filesystem>
#include <expected>
#include <skyr/url.hpp>
#include <filesystem>

#include <skyr/percent_encoding/percent_decode.hpp>
#include <skyr/url.hpp>

namespace skyr {
/// \namespace filesystem
Expand Down
10 changes: 6 additions & 4 deletions include/skyr/json/json.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,17 @@
#ifndef SKYR_JSON_JSON_HPP
#define SKYR_JSON_JSON_HPP

#include <string>
#include <expected>
#include <format>
#include <optional>
#include <string>
#include <vector>
#include <expected>

#include <nlohmann/json.hpp>
#include <format>

#include <skyr/core/parse_query.hpp>
#include <skyr/percent_encoding/percent_encode.hpp>
#include <skyr/percent_encoding/percent_decode.hpp>
#include <skyr/percent_encoding/percent_encode.hpp>

namespace skyr {
namespace json {
Expand Down
21 changes: 11 additions & 10 deletions include/skyr/network/ipv4_address.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,21 @@
#ifndef SKYR_NETWORK_IPV4_ADDRESS_HPP
#define SKYR_NETWORK_IPV4_ADDRESS_HPP

#include <algorithm>
#include <array>
#include <string>
#include <string_view>
#include <optional>
#include <cmath>
#include <climits>
#include <cmath>
#include <cstdint>
#include <locale>
#include <expected>
#include <skyr/platform/endianness.hpp>
#include <skyr/containers/static_vector.hpp>
#include <algorithm>
#include <ranges>
#include <format>
#include <locale>
#include <optional>
#include <ranges>
#include <string>
#include <string_view>

#include <skyr/containers/static_vector.hpp>
#include <skyr/platform/endianness.hpp>

namespace skyr {
/// Enumerates IPv4 address parsing errors
Expand All @@ -28,7 +29,7 @@ enum class ipv4_address_errc {
too_many_segments,
/// The input contains an empty segment
empty_segment,
/// The segment numers invalid
/// The segment numbers are invalid
invalid_segment_number,
/// Overflow
overflow,
Expand Down
14 changes: 7 additions & 7 deletions include/skyr/network/ipv6_address.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@
#ifndef SKYR_NETWORK_IPV6_ADDRESS_HPP
#define SKYR_NETWORK_IPV6_ADDRESS_HPP

#include <string>
#include <string_view>
#include <algorithm>
#include <array>
#include <optional>
#include <cstdint>
#include <algorithm>
#include <expected>
#include <format>
#include <iterator>
#include <locale>
#include <expected>
#include <algorithm>
#include <optional>
#include <string>
#include <string_view>

#include <skyr/containers/static_vector.hpp>
#include <skyr/platform/endianness.hpp>
#include <format>

namespace skyr {
/// Enumerates IPv6 address parsing errors
Expand Down
5 changes: 3 additions & 2 deletions include/skyr/percent_encoding/percent_decode.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
#ifndef SKYR_PERCENT_DECODING_PERCENT_DECODE_HPP
#define SKYR_PERCENT_DECODING_PERCENT_DECODE_HPP

#include <string_view>
#include <expected>
#include <skyr/percent_encoding/percent_decode_range.hpp>
#include <string_view>

#include <skyr/percent_encoding/errors.hpp>
#include <skyr/percent_encoding/percent_decode_range.hpp>

namespace skyr {
/// Percent decodes the input
Expand Down
Loading
Loading