Skip to content

Commit

Permalink
Rename macros: WHATWG_... to UPA_...
Browse files Browse the repository at this point in the history
  • Loading branch information
rmisev committed Aug 25, 2023
1 parent 826e6aa commit 5a38abe
Show file tree
Hide file tree
Showing 18 changed files with 101 additions and 101 deletions.
2 changes: 1 addition & 1 deletion examples/urlparse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ void read_samples(const char* file_name, SamplesOutput& out)
if (line.empty())
break;
state = State::header;
WHATWG_FALLTHROUGH
UPA_FALLTHROUGH
case State::header: {
bool ok = true;
auto icolon = line.find(':');
Expand Down
6 changes: 3 additions & 3 deletions src/buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
// Copyright 2013 The Chromium Authors. All rights reserved.
//

#ifndef WHATWG_BUFFER_H
#define WHATWG_BUFFER_H
#ifndef UPA_BUFFER_H
#define UPA_BUFFER_H

#include <array>
#include <memory>
Expand Down Expand Up @@ -195,4 +195,4 @@ class simple_buffer {

} // namespace upa

#endif // WHATWG_BUFFER_H
#endif // UPA_BUFFER_H
30 changes: 15 additions & 15 deletions src/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,36 @@
// found in the LICENSE file.
//

#ifndef WHATWG_CONFIG_H
#define WHATWG_CONFIG_H
#ifndef UPA_CONFIG_H
#define UPA_CONFIG_H

#ifdef __has_include
# if __has_include(<version>)
# include <version>
# endif
#endif

// Define WHATWG_CPP_20 if compiler supports C++20 or later standard
// Define UPA_CPP_20 if compiler supports C++20 or later standard
#if defined(_MSVC_LANG) ? (_MSVC_LANG >= 202002) : (__cplusplus >= 202002)
# define WHATWG_CPP_20
# define UPA_CPP_20
#endif

// Define WHATWG_CPP_17 if compiler supports C++17 or later standard
// Define UPA_CPP_17 if compiler supports C++17 or later standard
// https://devblogs.microsoft.com/cppblog/msvc-now-correctly-reports-__cplusplus/
#if defined(_MSVC_LANG) ? (_MSVC_LANG >= 201703) : (__cplusplus >= 201703)
# define WHATWG_CPP_17
# define WHATWG_FALLTHROUGH [[fallthrough]];
# define WHATWG_CONSTEXPR_17 constexpr
# define WHATWG_NOEXCEPT_17 noexcept
# define UPA_CPP_17
# define UPA_FALLTHROUGH [[fallthrough]];
# define UPA_CONSTEXPR_17 constexpr
# define UPA_NOEXCEPT_17 noexcept
#else
# define WHATWG_FALLTHROUGH
# define WHATWG_CONSTEXPR_17 inline
# define WHATWG_NOEXCEPT_17
# define UPA_FALLTHROUGH
# define UPA_CONSTEXPR_17 inline
# define UPA_NOEXCEPT_17
#endif

// Define WHATWG_CPP_14 if compiler supports C++14 or later
// Define UPA_CPP_14 if compiler supports C++14 or later
#if defined(_MSVC_LANG) ? (_MSVC_LANG >= 201402) : (__cplusplus >= 201402)
# define WHATWG_CPP_14
# define UPA_CPP_14
#endif

#endif // WHATWG_CONFIG_H
#endif // UPA_CONFIG_H
14 changes: 7 additions & 7 deletions src/str_arg.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ inline void procfn(Args&&... args) {
}
**************************************************************/
#ifndef WHATWG_STR_ARG_H
#define WHATWG_STR_ARG_H
#ifndef UPA_STR_ARG_H
#define UPA_STR_ARG_H

#include "config.h"
#include "url_utf.h"
Expand All @@ -25,19 +25,19 @@ inline void procfn(Args&&... args) {
#include <string>
#include <type_traits>

#ifdef WHATWG_CPP_17
#ifdef UPA_CPP_17
# include <string_view>
# define WHATWG_URL_STR_VIEW_TYPE std::string_view
# define UPA_URL_STR_VIEW_TYPE std::string_view
#else
# include "str_view.h"
# define WHATWG_URL_STR_VIEW_TYPE upa::str_view<char>
# define UPA_URL_STR_VIEW_TYPE upa::str_view<char>
#endif

namespace upa {

// String view type

using url_str_view_t = WHATWG_URL_STR_VIEW_TYPE;
using url_str_view_t = UPA_URL_STR_VIEW_TYPE;

// Supported char and size types

Expand Down Expand Up @@ -279,4 +279,4 @@ inline std::string make_string(Args&&... args) {

} // namespace upa

#endif // WHATWG_STR_ARG_H
#endif // UPA_STR_ARG_H
6 changes: 3 additions & 3 deletions src/str_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
// found in the LICENSE file.
//

#ifndef STR_VIEW_H
#define STR_VIEW_H
#ifndef UPA_STR_VIEW_H
#define UPA_STR_VIEW_H

#include <algorithm>
#include <string>
Expand Down Expand Up @@ -135,4 +135,4 @@ std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>&

} // namespace upa

#endif // STR_VIEW_H
#endif // UPA_STR_VIEW_H
36 changes: 18 additions & 18 deletions src/url.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
// https://infra.spec.whatwg.org/
//

#ifndef WHATWG_URL_H
#define WHATWG_URL_H
#ifndef UPA_URL_H
#define UPA_URL_H

#include "buffer.h"
#include "config.h"
Expand All @@ -33,7 +33,7 @@
#include <vector>

// not yet
// #define WHATWG_URL_USE_ENCODING
// #define UPA_URL_USE_ENCODING

namespace upa {

Expand Down Expand Up @@ -105,7 +105,7 @@ class url {
///
/// @param[in,out] other URL to move to this object
/// @return *this
url& operator=(url&& other) WHATWG_NOEXCEPT_17;
url& operator=(url&& other) UPA_NOEXCEPT_17;

/// @brief Safe move assignment.
///
Expand Down Expand Up @@ -162,7 +162,7 @@ class url {
/// @brief Swaps the contents of two URLs
///
/// @param[in,out] other URL to exchange the contents with
void swap(url& other) WHATWG_NOEXCEPT_17;
void swap(url& other) UPA_NOEXCEPT_17;

// Parser

Expand Down Expand Up @@ -562,7 +562,7 @@ class url {
bool canHaveUsernamePasswordPort() const;

// url record
void move_record(url& other) WHATWG_NOEXCEPT_17;
void move_record(url& other) UPA_NOEXCEPT_17;

// search params
void clear_search_params() noexcept;
Expand Down Expand Up @@ -971,7 +971,7 @@ inline url::url(url&& other) noexcept
search_params_ptr_.set_url_ptr(this);
}

inline url& url::operator=(url&& other) WHATWG_NOEXCEPT_17 {
inline url& url::operator=(url&& other) UPA_NOEXCEPT_17 {
// move data
move_record(other);
search_params_ptr_ = std::move(other.search_params_ptr_);
Expand Down Expand Up @@ -999,7 +999,7 @@ inline url& url::safe_assign(url&& other) {
return *this;
}

inline void url::move_record(url& other) WHATWG_NOEXCEPT_17 {
inline void url::move_record(url& other) UPA_NOEXCEPT_17 {
norm_url_ = std::move(other.norm_url_);
part_end_ = other.part_end_;
scheme_inf_ = other.scheme_inf_;
Expand Down Expand Up @@ -1259,7 +1259,7 @@ inline void url::clear() {
clear_search_params();
}

inline void url::swap(url& other) WHATWG_NOEXCEPT_17 {
inline void url::swap(url& other) UPA_NOEXCEPT_17 {
url tmp{ std::move(*this) };
*this = std::move(other);
other = std::move(tmp);
Expand Down Expand Up @@ -1465,7 +1465,7 @@ inline url_result url_parser::url_parse(url_serializer& urls, const CharT* first
const auto length = std::distance(first, last);
urls.reserve(length + 32);

#ifdef WHATWG_URL_USE_ENCODING
#ifdef UPA_URL_USE_ENCODING
const char* encoding = "UTF-8";
// TODO: If encoding override is given, set encoding to the result of getting an output encoding from encoding override.
#endif
Expand Down Expand Up @@ -1645,7 +1645,7 @@ inline url_result url_parser::url_parse(url_serializer& urls, const CharT* first
state = relative_slash_state;
break;
}
WHATWG_FALLTHROUGH
UPA_FALLTHROUGH
default:
// Set url's username to base's username, url's password to base's password, url's host to base's host,
// url's port to base's port, url's path to base's path, and then remove url's path's last entry, if any
Expand All @@ -1672,7 +1672,7 @@ inline url_result url_parser::url_parse(url_serializer& urls, const CharT* first
++pointer;
break;
}
WHATWG_FALLTHROUGH
UPA_FALLTHROUGH
default:
// set url's username to base's username, url's password to base's password, url's host to base's host,
// url's port to base's port
Expand Down Expand Up @@ -1981,7 +1981,7 @@ inline url_result url_parser::url_parse(url_serializer& urls, const CharT* first
break;
case '/':
++pointer;
WHATWG_FALLTHROUGH
UPA_FALLTHROUGH
default:
state = path_state;
break;
Expand Down Expand Up @@ -2059,7 +2059,7 @@ inline url_result url_parser::url_parse(url_serializer& urls, const CharT* first
// // 2. If c is "%" and remaining does not start with two ASCII hex digits, validation error.
//}

#ifdef WHATWG_URL_USE_ENCODING
#ifdef UPA_URL_USE_ENCODING
// scheme_inf_ == nullptr, if unknown scheme
if (!urls.scheme_inf() || !urls.scheme_inf()->is_special || urls.scheme_inf()->is_ws)
encoding = "UTF-8";
Expand Down Expand Up @@ -2394,7 +2394,7 @@ inline std::string& url_serializer::start_part(url::PartType new_pt) {
url_.part_end_[url::PASSWORD] = url_.norm_url_.length();
fill_start_pt = url::HOST_START; // (url::PASSWORD + 1)
}
WHATWG_FALLTHROUGH
UPA_FALLTHROUGH
case url::PASSWORD:
if (new_pt == url::HOST)
url_.norm_url_ += '@';
Expand Down Expand Up @@ -2707,7 +2707,7 @@ inline void url_setter::save_part() {
replace_part(url::HOST_START, "", 0, curr_pt_, 0);
break;
}
WHATWG_FALLTHROUGH
UPA_FALLTHROUGH
default:
if ((curr_pt_ == url::PASSWORD || curr_pt_ == url::PORT) && empty_val)
strp_.clear(); // drop ':'
Expand Down Expand Up @@ -2880,7 +2880,7 @@ inline bool is_unc_path(const CharT* first, const CharT* last)
///
/// @param[in,out] lhs
/// @param[in,out] rhs
inline void swap(url& lhs, url& rhs) WHATWG_NOEXCEPT_17 {
inline void swap(url& lhs, url& rhs) UPA_NOEXCEPT_17 {
lhs.swap(rhs);
}

Expand Down Expand Up @@ -2949,4 +2949,4 @@ inline url url_from_file_path(StrT&& str) {

} // namespace upa

#endif // WHATWG_URL_H
#endif // UPA_URL_H
8 changes: 4 additions & 4 deletions src/url_host.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
// found in the LICENSE file.
//

#ifndef WHATWG_URL_HOST_H
#define WHATWG_URL_HOST_H
#ifndef UPA_URL_HOST_H
#define UPA_URL_HOST_H

#include "buffer.h"
#include "str_arg.h"
Expand Down Expand Up @@ -68,7 +68,7 @@ class url_host {
url_host(const url_host&) = default;
url_host(url_host&&) noexcept = default;
url_host& operator=(const url_host&) = default;
url_host& operator=(url_host&&) WHATWG_NOEXCEPT_17 = default;
url_host& operator=(url_host&&) UPA_NOEXCEPT_17 = default;

/// Parsing constructor
///
Expand Down Expand Up @@ -329,4 +329,4 @@ inline url_result host_parser::parse_ipv6(const CharT* first, const CharT* last,

} // namespace upa

#endif // WHATWG_URL_HOST_H
#endif // UPA_URL_HOST_H
6 changes: 3 additions & 3 deletions src/url_idna.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
// found in the LICENSE file.
//

#ifndef WHATWG_URL_IDNA_H
#define WHATWG_URL_IDNA_H
#ifndef UPA_URL_IDNA_H
#define UPA_URL_IDNA_H

#include "buffer.h"
#include "url_result.h"
Expand All @@ -18,4 +18,4 @@ void IDNClose();

} // namespace upa

#endif // WHATWG_URL_IDNA_H
#endif // UPA_URL_IDNA_H
6 changes: 3 additions & 3 deletions src/url_ip.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
// found in the LICENSE file.
//

#ifndef WHATWG_URL_IP_H
#define WHATWG_URL_IP_H
#ifndef UPA_URL_IP_H
#define UPA_URL_IP_H

#include "url_percent_encode.h"
#include "url_result.h"
Expand Down Expand Up @@ -384,4 +384,4 @@ void ipv6_serialize(const uint16_t(&address)[8], std::string& output);

} // namespace upa

#endif // WHATWG_URL_IP_H
#endif // UPA_URL_IP_H
2 changes: 1 addition & 1 deletion src/url_percent_encode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

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

#ifndef WHATWG_CPP_17
#ifndef UPA_CPP_17

// These data were generated by tools/dumpCharBitSets.cpp program.
const code_point_set fragment_no_encode_set = {
Expand Down
Loading

0 comments on commit 5a38abe

Please sign in to comment.