Skip to content

Commit 4dafa30

Browse files
authored
Updated package, including adding inline namespace with version and FindSkyr.cmake file (#27)
1 parent 39ae39d commit 4dafa30

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+323
-252
lines changed

cmake/FindSkyr.cmake

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,26 @@
1-
find_path(SKYR_INCLUDE_DIR skyr/url.hpp
2-
PATH_SUFFIXES skyr)
1+
# https://gitlab.kitware.com/cmake/community/wikis/doc/tutorials/How-To-Find-Libraries
32

4-
find_library(SKYR_LIBRARY NAME Skyr::skyr-url)
3+
find_package(PkgConfig)
4+
pkg_check_modules(PC_Skyr QUIET skyr-url)
55

6+
find_path(Skyr_INCLUDE_DIR
7+
NAMES skyr/url.hpp
8+
HINTS ${Skyr_INCLUDE_DIR_HINT} ${PC_Skyr_INCLUDEDIR} ${PC_Skyr_INCLUDE_DIRS}
9+
)
10+
11+
find_library(Skyr_LIBRARY
12+
NAME skyr-url
13+
HINTS ${Skyr_LIB_DIR_HINT} ${PC_Skyr_LIBDIR} ${PC_Skyr_LIBRARY_DIRS}
14+
)
615

716
include(FindPackageHandleStandardArgs)
817

9-
#Handle standard arguments to find_package like REQUIRED and QUIET
1018
find_package_handle_standard_args(Skyr
1119
DEFAULT_MSG
12-
SKYR_INCLUDE_DIR SKYR_LIBRARY_NAME)
13-
mark_as_advanced(SKYR_INCLUDE_DIR SKYR_LIBRARY_NAMES)
14-
20+
Skyr_INCLUDE_DIR Skyr_LIBRARY)
1521

16-
set(SKYR_LIBRARIES ${SKYR_LIBRARY} )
17-
set(SKYR_INCLUDE_DIRS ${SKYR_INCLUDE_DIR} )
22+
if (Skyr_FOUND)
23+
mark_as_advanced(Skyr_INCLUDE_DIR Skyr_LIBRARY)
24+
set(Skyr_LIBRARIES ${Skyr_LIBRARY})
25+
set(Skyr_INCLUDE_DIRS ${Skyr_INCLUDE_DIR})
26+
endif()

include/skyr/traits/string_traits.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) Glyn Matthews 2018.
1+
// Copyright (c) Glyn Matthews 2018-19.
22
// Distributed under the Boost Software License, Version 1.0.
33
// (See accompanying file LICENSE_1_0.txt or copy at
44
// http://www.boost.org/LICENSE_1_0.txt)
@@ -11,6 +11,7 @@
1111
#include <string_view>
1212

1313
namespace skyr {
14+
inline namespace v1 {
1415
/// Meta-function to test if the type is of the form
1516
/// basic_string<charT>
1617
template <class T, class charT>
@@ -64,6 +65,7 @@ using is_url_convertible =
6465
is_string_convertible<T, wchar_t>,
6566
is_string_convertible<T, char16_t>,
6667
is_string_convertible<T, char32_t>>;
68+
} // namespace v1
6769
} // namespace skyr
6870

6971
#endif //SKYR_STRING_TRAITS_HPP

include/skyr/unicode/code_point.hpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
#include <skyr/unicode/constants.hpp>
1212
#include <skyr/unicode/core.hpp>
1313

14-
namespace skyr::unicode {
14+
namespace skyr {
15+
inline namespace v1 {
16+
namespace unicode {
1517
/// This class defines a range over a code point in raw bytes,
1618
/// according to UTF-8.
1719
/// \tparam OctetIterator An iterator type over the raw bytes
@@ -279,6 +281,8 @@ inline tl::expected<u16_code_point_t, std::error_code> u16_value(
279281
tl::expected<u8_code_point_t<OctetIterator>, std::error_code> code_point) {
280282
return u32_value(code_point).map([] (auto code_point) { return u16_code_point(code_point); });
281283
}
282-
} // namespace skyr::unicode
284+
} // namespace unicode
285+
} // namespace v1
286+
} // namespace skyr
283287

284288
#endif //SKYR_UNICODE_CODE_POINT_HPP

include/skyr/unicode/constants.hpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
#ifndef SKYR_UNICODE_CONSTANTS_HPP
77
#define SKYR_UNICODE_CONSTANTS_HPP
88

9-
namespace skyr::unicode::constants {
9+
namespace skyr {
10+
inline namespace v1 {
11+
namespace unicode::constants {
1012
namespace surrogates {
1113
// Leading (high) surrogates: 0xd800 - 0xdbff
1214
constexpr char16_t lead_min = 0xd800u;
@@ -24,6 +26,8 @@ constexpr char32_t max = 0x0010ffffu;
2426
} // namespace code_points
2527

2628
constexpr char bom[] = {'\xef', '\xbb', '\xbf'};
27-
} // namespace skyr::unicode::constants
29+
} // namespace unicode::constants
30+
} // namespace v1
31+
} // namespace skyr
2832

2933
#endif //SKYR_UNICODE_CONSTANTS_HPP

include/skyr/unicode/core.hpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
#include <skyr/unicode/errors.hpp>
1212
#include <skyr/unicode/constants.hpp>
1313

14-
namespace skyr::unicode {
14+
namespace skyr {
15+
inline namespace v1 {
16+
namespace unicode {
1517
///
1618
/// \param octet
1719
/// \return
@@ -301,6 +303,8 @@ tl::expected<sequence_state<OctetIterator>, std::error_code> find_code_point(
301303
tl::make_unexpected(make_error_code(unicode_errc::overflow))
302304
;
303305
}
304-
} // namespace skyr::unicode
306+
} // namespace unicode
307+
} // namespace v1
308+
} // namespace skyr
305309

306310
#endif //SKYR_UNICODE_CORE_HPP

include/skyr/unicode/errors.hpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88

99
#include <system_error>
1010

11-
namespace skyr::unicode {
11+
namespace skyr {
12+
inline namespace v1 {
13+
namespace unicode {
1214
/// Enumerates Unicode errors
1315
enum class unicode_errc {
1416
/// Overflow
@@ -25,11 +27,13 @@ enum class unicode_errc {
2527
/// \param error A Unicode error
2628
/// \returns A `std::error_code` object
2729
std::error_code make_error_code(unicode_errc error) noexcept;
28-
} // namespace skyr::unicode
30+
} // namespace unicode
31+
} // namespace v1
32+
} // namespace skyr
2933

3034
namespace std {
3135
template <>
32-
struct is_error_code_enum<skyr::unicode::unicode_errc> : true_type {};
36+
struct is_error_code_enum<skyr::v1::unicode::unicode_errc> : true_type {};
3337
} // namespace std
3438

3539
#endif //SKYR_UNICODE_ERROR_HPP

include/skyr/unicode/ranges/traits.hpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
#ifndef SKYR_UNICODE_RANGE_TRAITS_HPP
77
#define SKYR_UNICODE_RANGE_TRAITS_HPP
88

9-
namespace skyr::unicode::traits {
9+
namespace skyr {
10+
inline namespace v1 {
11+
namespace unicode::traits {
1012
///
1113
/// \tparam Range
1214
template <class Range>
@@ -23,7 +25,8 @@ class iterator<T[N]> {
2325
public:
2426
using type = const T *;
2527
};
26-
} // namespace skyr::unicode::traits
27-
28+
} // namespace unicode::traits
29+
} // namespace v1
30+
} // namespace skyr
2831

2932
#endif //SKYR_UNICODE_RANGE_TRAITS_HPP

include/skyr/unicode/ranges/transforms/byte_transform.hpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414
#include <skyr/unicode/ranges/traits.hpp>
1515
#include <skyr/unicode/ranges/views/u16_view.hpp>
1616

17-
namespace skyr::unicode {
17+
namespace skyr {
18+
inline namespace v1 {
19+
namespace unicode {
1820
/// An iterator that converts a code point to bytes when dereferenced
1921
/// \tparam CodePointIterator
2022
template<class CodePointIterator>
@@ -259,6 +261,8 @@ tl::expected<Output, std::error_code> as(
259261
}
260262
return result;
261263
}
262-
} // namespace skyr::unicode
264+
} // namespace unicode
265+
} // namespace v1
266+
} // namespace skyr
263267

264268
#endif //SKYR_UNICODE_BYTE_RANGE_HPP

include/skyr/unicode/ranges/transforms/u16_transform.hpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616
#include <skyr/unicode/ranges/views/u8_view.hpp>
1717
#include <skyr/unicode/ranges/transforms/u32_transform.hpp>
1818

19-
namespace skyr::unicode {
19+
namespace skyr {
20+
inline namespace v1 {
21+
namespace unicode {
2022
///
2123
/// \tparam CodePointIterator
2224
template <class CodePointIterator>
@@ -209,6 +211,8 @@ tl::expected<Output, std::error_code> as(transform_u16_range<CodePointRange> &&r
209211
}
210212
return result;
211213
}
212-
} // namespace skyr::unicode
214+
} // namespace unicode
215+
} // namespace v1
216+
} // namespace skyr
213217

214218
#endif //SKYR_UNICODE_U16_RANGE_HPP

include/skyr/unicode/ranges/transforms/u32_transform.hpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
#include <skyr/unicode/ranges/traits.hpp>
1616
#include <skyr/unicode/ranges/views/u8_view.hpp>
1717

18-
namespace skyr::unicode {
18+
namespace skyr {
19+
inline namespace v1 {
20+
namespace unicode {
1921
///
2022
/// \tparam CodePointIterator
2123
template <class CodePointIterator>
@@ -200,6 +202,8 @@ tl::expected<Output, std::error_code> as(transform_u32_range<CodePointRange> &&r
200202
}
201203
return result;
202204
}
203-
} // namespace skyr::unicode
205+
} // namespace unicode
206+
} // namespace v1
207+
} // namespace skyr
204208

205209
#endif //SKYR_UNICODE_U32_RANGE_HPP

0 commit comments

Comments
 (0)