diff options
| author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2026-03-10 19:29:58 +0100 |
|---|---|---|
| committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2026-03-10 19:29:58 +0100 |
| commit | 2dd4663ee68419059f327545e70095c4257b19e3 (patch) | |
| tree | fe3db2baa3f6d96a6e33cc37e77faa91440b3766 /include | |
| parent | 2e314136ed58b6860c667e379bef22190fe84aa2 (diff) | |
New upstream version 5.3upstream/5.3upstream
Diffstat (limited to 'include')
| -rw-r--r-- | include/Makefile.am | 2 | ||||
| -rw-r--r-- | include/Makefile.in | 2 | ||||
| -rw-r--r-- | include/libHX/ctype_helper.h | 2 | ||||
| -rw-r--r-- | include/libHX/tie.hpp | 23 |
4 files changed, 26 insertions, 3 deletions
diff --git a/include/Makefile.am b/include/Makefile.am index e3d3f86..4122611 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -5,5 +5,5 @@ nobase_include_HEADERS = libHX.h libHX/cast.h \ libHX/endian.h libHX/endian_float.h libHX/init.h \ libHX/intdiff.hpp libHX/io.h libHX/list.h \ libHX/map.h libHX/misc.h libHX/option.h libHX/proc.h \ - libHX/scope.hpp libHX/socket.h libHX/string.h \ + libHX/scope.hpp libHX/socket.h libHX/string.h libHX/tie.hpp \ libHX/libxml_helper.h libHX/wx_helper.hpp diff --git a/include/Makefile.in b/include/Makefile.in index 3f3227d..29184bd 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -311,7 +311,7 @@ nobase_include_HEADERS = libHX.h libHX/cast.h \ libHX/endian.h libHX/endian_float.h libHX/init.h \ libHX/intdiff.hpp libHX/io.h libHX/list.h \ libHX/map.h libHX/misc.h libHX/option.h libHX/proc.h \ - libHX/scope.hpp libHX/socket.h libHX/string.h \ + libHX/scope.hpp libHX/socket.h libHX/string.h libHX/tie.hpp \ libHX/libxml_helper.h libHX/wx_helper.hpp all: all-am diff --git a/include/libHX/ctype_helper.h b/include/libHX/ctype_helper.h index 0f42c4f..85dd29b 100644 --- a/include/libHX/ctype_helper.h +++ b/include/libHX/ctype_helper.h @@ -41,7 +41,7 @@ static __inline__ bool HX_isalpha(unsigned char c) static __inline__ bool HX_isascii(unsigned char c) { - return isascii(c); + return c < 128; } static __inline__ bool HX_isdigit(unsigned char c) diff --git a/include/libHX/tie.hpp b/include/libHX/tie.hpp new file mode 100644 index 0000000..c3c9d69 --- /dev/null +++ b/include/libHX/tie.hpp @@ -0,0 +1,23 @@ +#pragma once +#include <memory> + +namespace HX { + +template<typename T, typename D> class unique_proxy { + public: + unique_proxy(std::unique_ptr<T, D> &a) : u(a), p(u.get()) {} + ~unique_proxy() { u.reset(p); } + typename std::unique_ptr<T, D>::pointer *operator&() { return &p; } + unique_proxy &operator~() { u.reset(); p = nullptr; return *this; } + private: + std::unique_ptr<T, D> &u; + typename std::unique_ptr<T, D>::pointer p; +}; + +template<typename T, typename D> unique_proxy<T, D> +unique_tie(std::unique_ptr<T, D> &u) +{ + return unique_proxy<T, D>(u); +} + +} /* namespace */ |
