aboutsummaryrefslogtreecommitdiffstats
path: root/modules/ctype.ccm
diff options
context:
space:
mode:
authorLexi Winter <lexi@le-fay.org>2025-06-21 12:27:20 +0100
committerLexi Winter <lexi@le-fay.org>2025-06-21 12:27:20 +0100
commit243d958df14b85788232aca623b83826115a5eb9 (patch)
treed1f698296b053359a5563731cda8c51df9ab9a6c /modules/ctype.ccm
parent8a36eb498e1a1c2cf2e886356faa4ce67e52e874 (diff)
downloadnihil-243d958df14b85788232aca623b83826115a5eb9.tar.gz
nihil-243d958df14b85788232aca623b83826115a5eb9.tar.bz2
rename modules/ to nihil/
Diffstat (limited to 'modules/ctype.ccm')
-rw-r--r--modules/ctype.ccm86
1 files changed, 0 insertions, 86 deletions
diff --git a/modules/ctype.ccm b/modules/ctype.ccm
deleted file mode 100644
index cc058cd..0000000
--- a/modules/ctype.ccm
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * This source code is released into the public domain.
- */
-
-module;
-
-#include <concepts>
-#include <locale>
-
-export module nihil:ctype;
-
-namespace nihil {
-
-/*
- * ctype_is: wrap std::ctype<T>::is() in a form suitable for use as an algorithm
- * predicate, i.e., ctype_is(m) will return a functor object that takes any char
- * type as an argument and returns bool.
- *
- * If the locale is not specified, the current global locale is used by default.
- *
- * ctype_is copies the locale, so passing a temporary is fine.
- */
-
-export struct ctype_is final {
- ctype_is(std::ctype_base::mask mask_,
- std::locale const &locale_ = std::locale())
- : mask(mask_)
- , locale(locale_)
- {}
-
- auto operator()(this ctype_is const &self, std::integral auto c)
- {
- using ctype = std::ctype<decltype(c)>;
- auto &facet = std::use_facet<ctype>(self.locale);
- return facet.is(self.mask, c);
- }
-
-private:
- std::ctype_base::mask mask;
- std::locale locale;
-};
-
-// Predefined tests for the current global locale.
-
-export inline auto is_space = ctype_is(std::ctype_base::space);
-export inline auto is_print = ctype_is(std::ctype_base::print);
-export inline auto is_cntrl = ctype_is(std::ctype_base::cntrl);
-export inline auto is_upper = ctype_is(std::ctype_base::upper);
-export inline auto is_lower = ctype_is(std::ctype_base::lower);
-export inline auto is_alpha = ctype_is(std::ctype_base::alpha);
-export inline auto is_digit = ctype_is(std::ctype_base::digit);
-export inline auto is_punct = ctype_is(std::ctype_base::punct);
-export inline auto is_xdigit = ctype_is(std::ctype_base::xdigit);
-export inline auto is_blank = ctype_is(std::ctype_base::blank);
-export inline auto is_alnum = ctype_is(std::ctype_base::alnum);
-export inline auto is_graph = ctype_is(std::ctype_base::graph);
-
-// Predefined tests for the C locale. The C locale is guaranteed to always be
-// available, so this doesn't create lifetime issues.
-
-export inline auto is_c_space =
- ctype_is(std::ctype_base::space, std::locale::classic());
-export inline auto is_c_print =
- ctype_is(std::ctype_base::print, std::locale::classic());
-export inline auto is_c_cntrl =
- ctype_is(std::ctype_base::cntrl, std::locale::classic());
-export inline auto is_c_upper =
- ctype_is(std::ctype_base::upper, std::locale::classic());
-export inline auto is_c_lower =
- ctype_is(std::ctype_base::lower, std::locale::classic());
-export inline auto is_c_alpha =
- ctype_is(std::ctype_base::alpha, std::locale::classic());
-export inline auto is_c_digit =
- ctype_is(std::ctype_base::digit, std::locale::classic());
-export inline auto is_c_punct =
- ctype_is(std::ctype_base::punct, std::locale::classic());
-export inline auto is_c_xdigit =
- ctype_is(std::ctype_base::xdigit, std::locale::classic());
-export inline auto is_c_blank =
- ctype_is(std::ctype_base::blank, std::locale::classic());
-export inline auto is_c_alnum =
- ctype_is(std::ctype_base::alnum, std::locale::classic());
-export inline auto is_c_graph =
- ctype_is(std::ctype_base::graph, std::locale::classic());
-
-} // namespace nihil