namespace
commonNamespaces
- namespace detail
Classes
- struct Cards
- struct Error
- class Exception
- class InvalidUTF8
-
template <typename T>class Lazy
-
template <class... Ts>struct Overload
- class UTF8Iterator
-
template <class T>struct is_mutable_lambda
-
template <class>struct is_mutable_lambda_helper
-
template <class Ret, class Class, class... Args>struct is_mutable_lambda_helper<Ret(Class::*)(Args...) const>
-
template <class Ret, class Class, class... Args>struct is_mutable_lambda_helper<Ret(Class::*)(Args...)>
-
template <class T, class U>struct is_variant_member
-
template <class T, class... Ts>struct is_variant_member<T, std::variant<Ts...>>
-
template <typename GuardedData, basic_lockable MutexType>class synchronized
-
template <typename GuardedType, basic_lockable MutexType = std::class update_guard
mutex>
Concepts
-
template <typename L>concept basic_lockable
-
template <class Func, class Arg>concept invocable_l_or_r
Enums
-
enum class CaseSensitive: std::
uint8_t { Yes, No }
Typedefs
- using ThreadPool = BS::thread_pool
- using U8Unit = int32_t
-
template <typename T, typename U>using is_equiv = std::
is_same<std:: remove_cvref_t<T>, std:: remove_cvref_t<U>>
Functions
-
template <class... Ts>Overload(Ts...) → Overload< Ts... >
-
auto as_ascii(std::
u8string_view str) → std:: string_view -
auto as_ascii_string(std::
u8string str) → std:: string -
auto as_utf8(std::
string_view str) → std:: u8string_view -
auto as_utf8_string(std::
string str) → std:: u8string -
template <typename CharT>void backslash_to_slash(std::
basic_string<CharT>& path) noexcept - Convert backslashes to slashes in path.
- auto compare_directories(const Path& dir1, const Path& dir2) → bool noexcept
- auto compare_files(const Path& filename1, const Path& filename2) → bool noexcept
-
void concat_codepoint(std::
u8string& string, U8Unit cp) -
template <class Container, class ValueType>auto contains(const Container& cont, const ValueType& val) → auto
-
auto find_matching_paths_icase(const btu::
Path& directory, std:: span<const btu:: Path> relative_lowercase_paths) → std:: vector<btu:: Path> noexcept -
auto first_codepoint(std::
u8string_view string) → U8Unit constexpr -
template <typename Range, typename Func>auto for_each_mt(Range&& rng, Func&& func) → auto
-
template <class T, class U>auto forward_like(U&& x) → decltype(auto) constexpr noexcept
- See https://en.cppreference.com/w/cpp/utility/forward_
like. - auto hard_link(const Path& from, const Path& to) → tl::expected<void, Error> noexcept
- auto hardware_concurrency() → unsigned noexcept
-
auto is_lower(std::
u8string_view string) → bool constexpr -
auto make_path_canonizer(std::
u8string_view start) → auto constexpr -
template <typename Out, typename Range, typename Func>auto make_producer_mt(Range&& rng, Func&& func) → auto
- Creates a multi-threaded producer for the specified range and function.
- auto make_thread_pool()
- Creates a thread pool with the number of threads equal to the number of hardware threads minus one.
-
auto make_valid(std::
u8string& string, char8_t replacement) → std:: u8string& noexcept -
template <class It, class Predicate, class Sum, class ValueType = typename std::auto merge_if(It first, It last, const Predicate& predicate, const Sum& sum) → It
iterator_traits<It>::value_type> -
template <class It, class Predicate>auto merge_if(It first, It last, Predicate&& predicate) → It
- auto merge_if(Container& cont, Predicate&& predicate) → auto
- auto merge_if(Container& cont, Predicate&& pred, Sum&& sum) → auto
-
auto operator<<(std::
ostream& os, std:: source_location loc) → std:: ostream& -
auto operator<<(std::
ostream& os, const Error& err) → std:: ostream& -
auto read_file(const Path& a_path) → tl::expected<std::
vector<std:: byte>, Error> noexcept -
template <class ValueType>void remove_duplicates(std::
vector<ValueType>& cont) -
auto str_compare(std::
u8string_view lhs, std:: u8string_view rhs, CaseSensitive case_sensitive = CaseSensitive:: Yes) → bool constexpr -
auto str_contain(std::
u8string_view string, std:: u8string_view snippet, CaseSensitive case_sensitive = CaseSensitive:: Yes) → bool constexpr -
auto str_find(std::
u8string_view string, std:: u8string_view snippet, CaseSensitive case_sensitive = CaseSensitive:: Yes) → size_t constexpr -
auto str_match(std::
u8string_view string, std:: u8string_view pattern, CaseSensitive case_sensitive = CaseSensitive:: Yes, Cards cards = default_ cards) → bool constexpr -
auto str_random(size_t length,
std::
span<const char8_t> charset = k_ lower_ alphabetic_ charset) → std:: u8string noexcept -
auto str_replace_once(std::
u8string& string, std:: u8string_view from, std:: u8string_view to, CaseSensitive case_sensitive) → std:: u8string& constexpr -
auto str_starts_with(std::
u8string_view string, std:: u8string_view snippet, CaseSensitive case_sensitive = CaseSensitive:: Yes) → bool constexpr -
auto str_trim(std::
u8string_view in) → std:: u8string_view constexpr noexcept -
auto to_lower(std::
u8string_view string) → std:: u8string -
template <typename E>auto to_underlying(E e) → std::
underlying_type_t<E> constexpr -
auto to_utf16(const std::
u8string& str) → std:: wstring -
auto to_utf8(const std::
wstring& str) → std:: u8string -
auto write_file(const Path& a_path,
std::
span<const std:: byte> data) → tl::expected<void, Error> noexcept -
auto write_file_new(const Path& a_path,
std::
span<const std:: byte> data) → tl::expected<void, Error> noexcept
Variables
-
detail::
bind_back_fn bind_back constexpr - Cards default_cards constexpr
-
template <typename T, typename U>bool is_equiv_v constexpr
-
template <class T>bool is_mutable_lambda_v constexpr
-
template <class T, class... Ts>bool is_variant_member_v constexpr
- auto k_lower_alphabetic_charset constexpr
Enum documentation
enum class btu:: common:: CaseSensitive: std:: uint8_t
#include <btu/common/string.hpp>
Typedef documentation
using btu:: common:: ThreadPool = BS::thread_pool
#include <btu/common/threading.hpp>
using btu:: common:: U8Unit = int32_t
#include <btu/common/string.hpp>
#include <btu/common/metaprogramming.hpp>
template <typename T, typename U>
using btu:: common:: is_equiv = std:: is_same<std:: remove_cvref_t<T>, std:: remove_cvref_t<U>>
Function documentation
#include <btu/common/metaprogramming.hpp>
template <class... Ts>
btu:: common:: Overload(Ts...) → Overload< Ts... >
std:: string_view btu:: common:: as_ascii(std:: u8string_view str)
#include <btu/common/string.hpp>
std:: string btu:: common:: as_ascii_string(std:: u8string str)
#include <btu/common/string.hpp>
std:: u8string_view btu:: common:: as_utf8(std:: string_view str)
#include <btu/common/string.hpp>
std:: u8string btu:: common:: as_utf8_string(std:: string str)
#include <btu/common/string.hpp>
#include <btu/common/path.hpp>
template <typename CharT>
void btu:: common:: backslash_to_slash(std:: basic_string<CharT>& path) noexcept
Convert backslashes to slashes in path.
std::fs do not consider '\' as a separator on Linux. In fact, it is a valid character in file names. But in our case, we want to treat it as a separator. Let's hope no one will use it in file names.
bool btu:: common:: compare_directories(const Path& dir1,
const Path& dir2) noexcept
#include <btu/common/filesystem.hpp>
bool btu:: common:: compare_files(const Path& filename1,
const Path& filename2) noexcept
#include <btu/common/filesystem.hpp>
void btu:: common:: concat_codepoint(std:: u8string& string,
U8Unit cp)
#include <btu/common/string.hpp>
#include <btu/common/algorithms.hpp>
template <class Container, class ValueType>
auto btu:: common:: contains(const Container& cont,
const ValueType& val)
std:: vector<btu:: Path> btu:: common:: find_matching_paths_icase(const btu:: Path& directory,
std:: span<const btu:: Path> relative_lowercase_paths) noexcept
#include <btu/common/filesystem.hpp>
U8Unit btu:: common:: first_codepoint(std:: u8string_view string) constexpr
#include <btu/common/string.hpp>
#include <btu/common/threading.hpp>
template <typename Range, typename Func>
auto btu:: common:: for_each_mt(Range&& rng,
Func&& func)
#include <btu/common/metaprogramming.hpp>
template <class T, class U>
decltype(auto) btu:: common:: forward_like(U&& x) constexpr noexcept
tl::expected<void, Error> btu:: common:: hard_link(const Path& from,
const Path& to) noexcept
#include <btu/common/filesystem.hpp>
unsigned btu:: common:: hardware_concurrency() noexcept
#include <btu/common/threading.hpp>
bool btu:: common:: is_lower(std:: u8string_view string) constexpr
#include <btu/common/string.hpp>
auto btu:: common:: make_path_canonizer(std:: u8string_view start) constexpr
#include <btu/common/path.hpp>
#include <btu/common/threading.hpp>
template <typename Out, typename Range, typename Func>
auto btu:: common:: make_producer_mt(Range&& rng,
Func&& func)
Creates a multi-threaded producer for the specified range and function.
Template parameters | |
---|---|
Out | |
Range | The type of the range. |
Func | The type of the function. |
Parameters | |
rng | The range of elements to process. |
func | The function to apply to each element in the range. |
Returns | The multi-threaded producer object. |
This function creates a multi-threaded producer that generates values by applying the specified function to each element in the given range. The producer distributes the workload across multiple threads to improve performance.
auto btu:: common:: make_thread_pool()
#include <btu/common/threading.hpp>
Creates a thread pool with the number of threads equal to the number of hardware threads minus one.
Returns | The thread pool object. |
---|