Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove barrel files #840

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
1 change: 0 additions & 1 deletion .clang-format
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
BasedOnStyle: Google
SortIncludes: Never
20 changes: 4 additions & 16 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,20 +1,8 @@
cc_library(
name = "ada",
srcs = [
"src/ada.cpp",
],
hdrs = glob([
"include/*.h",
"include/ada/*.h",
# todo: this can be included by every client of the library, but there is no better way
# since .cpp files are included into each other.
"src/*.cpp",
]),
# todo: once .cpp files are not included, rather then polluting -I flags, src/ should
# be dropped from hdrs and this replaced by `strip_include_prefix = "include"`
includes = [
"include",
"include/ada",
],
srcs = glob(["src/*.cpp"]),
hdrs = glob(["include/*.h"]),
includes = ["include"],
strip_include_prefix = "include",
visibility = ["//visibility:public"],
)
8 changes: 4 additions & 4 deletions benchmarks/benchmark_header.h
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#include <cstdlib>
#include <filesystem>
#include <fstream>
#include <iostream>
#include <memory>
#include <cstdlib>
#include <sstream>
#include <fstream>
#include <filesystem>

#if ADA_VARIOUS_COMPETITION_ENABLED
#include <uriparser/Uri.h>
#include <EdUrlParser.h>
#include <http_parser.h>
#include <uriparser/Uri.h>
#endif
#if ADA_url_whatwg_ENABLED
#include <upa/url.h>
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/competitors/servo-url/servo_url.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
#include <cstdarg>
#include <cstdint>
#include <cstdlib>
#include <ostream>
#include <new>
#include <ostream>

namespace servo_url {

Expand Down
4 changes: 1 addition & 3 deletions benchmarks/performancecounters/event_counter.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@
#ifndef _MSC_VER
#include <dirent.h>
#endif
#include <chrono>
#include <cinttypes>

#include <cstring>

#include <chrono>
#include <vector>

#include "linux-perf-events.h"
Expand Down
3 changes: 1 addition & 2 deletions benchmarks/performancecounters/linux-perf-events.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@

#include <cerrno> // for errno
#include <cstring> // for memset
#include <stdexcept>

#include <iostream>
#include <stdexcept>
#include <vector>

template <int TYPE = PERF_TYPE_HARDWARE>
Expand Down
38 changes: 0 additions & 38 deletions include/ada.h

This file was deleted.

50 changes: 0 additions & 50 deletions include/ada/unicode-inl.h

This file was deleted.

2 changes: 1 addition & 1 deletion include/ada_c.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
#define ADA_C_H

#include <stdbool.h>
#include <stdint.h>
#include <stddef.h>
#include <stdint.h>

// This is a reference to ada::url_components::omitted
// It represents "uint32_t(-1)"
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#ifndef ADA_CHARACTER_SETS_INL_H
#define ADA_CHARACTER_SETS_INL_H

#include "ada/character_sets.h"
#include "character_sets.h"

/**
* These functions are not part of our public API and may
Expand Down
3 changes: 2 additions & 1 deletion include/ada/character_sets.h → include/character_sets.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
#ifndef ADA_CHARACTER_SETS_H
#define ADA_CHARACTER_SETS_H

#include "ada/common_defs.h"
#include <cstdint>

#include "common_defs.h"

/**
* These functions are not part of our public API and may
* change at any time.
Expand Down
2 changes: 2 additions & 0 deletions include/ada/checkers-inl.h → include/checkers-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#include <bit>
#include <string_view>

#include "checkers.h"

namespace ada::checkers {

constexpr bool has_hex_prefix_unsafe(std::string_view input) {
Expand Down
4 changes: 2 additions & 2 deletions include/ada/checkers.h → include/checkers.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
#ifndef ADA_CHECKERS_H
#define ADA_CHECKERS_H

#include "ada/common_defs.h"

#include <cstring>
#include <string_view>

#include "common_defs.h"

/**
* These functions are not part of our public API and may
* change at any time.
Expand Down
4 changes: 4 additions & 0 deletions include/ada/common_defs.h → include/common_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
#ifndef ADA_COMMON_DEFS_H
#define ADA_COMMON_DEFS_H

#ifdef ADA_DEVELOPMENT_CHECKS
#include <iostream>
#endif

// https://en.cppreference.com/w/cpp/feature_test#Library_features
// detect C++20 features
#include <version>
Expand Down
3 changes: 2 additions & 1 deletion include/ada/encoding_type.h → include/encoding_type.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
#ifndef ADA_ENCODING_TYPE_H
#define ADA_ENCODING_TYPE_H

#include "ada/common_defs.h"
#include <string>

#include "common_defs.h"

namespace ada {

/**
Expand Down
File renamed without changes.
10 changes: 5 additions & 5 deletions include/ada/helpers.h → include/helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
#ifndef ADA_HELPERS_H
#define ADA_HELPERS_H

#include "ada/common_defs.h"
#include "ada/state.h"
#include "ada/url_base.h"

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

#include "common_defs.h"
#include "state.h"
#include "url_base.h"

#if ADA_DEVELOPMENT_CHECKS
#include <iostream>
Expand Down
35 changes: 21 additions & 14 deletions include/ada/implementation.h → include/implementation.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,27 @@
#define ADA_IMPLEMENTATION_H

#include <string>
#include <optional>

#include "ada/parser.h"
#include "ada/common_defs.h"
#include "ada/encoding_type.h"
#include "ada/url.h"
#include "ada/state.h"
#include "ada/url_aggregator.h"
#include "common_defs.h"
#include "expected.h"

/**
* @private
* Forward declarations.
*/
namespace ada {
struct url_pattern_options;
struct url_pattern_init;
class url_pattern;
struct url_aggregator;
struct url;
} // namespace ada

namespace ada {
enum class errors : uint8_t { type_error };

template <class result_type = ada::url_aggregator>
using result = tl::expected<result_type, ada::errors>;
template <class result_type = url_aggregator>
using result = tl::expected<result_type, errors>;

/**
* The URL parser takes a scalar value string input, with an optional null or
Expand All @@ -31,13 +38,13 @@ using result = tl::expected<result_type, ada::errors>;
* @param base_url the optional URL input to use as a base url.
* @return a parsed URL.
*/
template <class result_type = ada::url_aggregator>
ada_warn_unused ada::result<result_type> parse(
template <class result_type>
ada_warn_unused result<result_type> parse(
std::string_view input, const result_type* base_url = nullptr);

extern template ada::result<url> parse<url>(std::string_view input,
const url* base_url);
extern template ada::result<url_aggregator> parse<url_aggregator>(
extern template result<url> parse<url>(std::string_view input,
const url* base_url);
extern template result<url_aggregator> parse<url_aggregator>(
std::string_view input, const url_aggregator* base_url);

/**
Expand Down
2 changes: 1 addition & 1 deletion include/ada/log.h → include/log.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/
#ifndef ADA_LOG_H
#define ADA_LOG_H
#include "ada/common_defs.h"
#include "common_defs.h"

// To enable logging, set ADA_LOGGING to 1:
#ifndef ADA_LOGGING
Expand Down
16 changes: 3 additions & 13 deletions include/ada/parser.h → include/parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,9 @@
#include <string_view>
#include <variant>

#include "ada/expected.h"

/**
* @private
*/
namespace ada {
struct url_aggregator;
struct url;
class url_pattern;
struct url_pattern_options;
struct url_pattern_init;
enum class errors : uint8_t;
} // namespace ada
#include "expected.h"
#include "url.h"
#include "url_aggregator.h"

/**
* @namespace ada::parser
Expand Down
2 changes: 1 addition & 1 deletion include/ada/scheme-inl.h → include/scheme-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#ifndef ADA_SCHEME_INL_H
#define ADA_SCHEME_INL_H

#include "ada/scheme.h"
#include "scheme.h"

namespace ada::scheme {

Expand Down
4 changes: 2 additions & 2 deletions include/ada/scheme.h → include/scheme.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
#ifndef ADA_SCHEME_H
#define ADA_SCHEME_H

#include "ada/common_defs.h"

#include <array>
#include <string>

#include "common_defs.h"

/**
* @namespace ada::scheme
* @brief Includes the scheme declarations
Expand Down
4 changes: 2 additions & 2 deletions include/ada/serializers.h → include/serializers.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
#ifndef ADA_SERIALIZERS_H
#define ADA_SERIALIZERS_H

#include "ada/common_defs.h"

#include <array>
#include <string>

#include "common_defs.h"

/**
* @namespace ada::serializers
* @brief Includes the definitions for URL serializers
Expand Down
Loading
Loading