diff options
author | Chris Robinson <[email protected]> | 2023-05-04 08:03:40 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2023-05-04 08:03:40 -0700 |
commit | 7cda37a67c8f147536c53f0073df9a9e61d40587 (patch) | |
tree | 68a0997c94ec905dd3438f26418234bf63aa76f4 /core | |
parent | 40483b512218bab50fccaaeb11b51e5ca528fbe1 (diff) |
Replace al::optional with std::optional
Diffstat (limited to 'core')
-rw-r--r-- | core/ambdec.cpp | 8 | ||||
-rw-r--r-- | core/ambdec.h | 4 | ||||
-rw-r--r-- | core/cpu_caps.cpp | 4 | ||||
-rw-r--r-- | core/cpu_caps.h | 5 | ||||
-rw-r--r-- | core/helpers.cpp | 8 | ||||
-rw-r--r-- | core/hrtf.cpp | 4 | ||||
-rw-r--r-- | core/hrtf.h | 4 | ||||
-rw-r--r-- | core/voice.cpp | 4 | ||||
-rw-r--r-- | core/voice.h | 4 |
9 files changed, 22 insertions, 23 deletions
diff --git a/core/ambdec.cpp b/core/ambdec.cpp index 8ca182c4..a056e63f 100644 --- a/core/ambdec.cpp +++ b/core/ambdec.cpp @@ -47,9 +47,9 @@ enum class ReaderScope { #else [[gnu::format(printf,2,3)]] #endif -al::optional<std::string> make_error(size_t linenum, const char *fmt, ...) +std::optional<std::string> make_error(size_t linenum, const char *fmt, ...) { - al::optional<std::string> ret; + std::optional<std::string> ret; auto &str = ret.emplace(); str.resize(256); @@ -77,7 +77,7 @@ al::optional<std::string> make_error(size_t linenum, const char *fmt, ...) AmbDecConf::~AmbDecConf() = default; -al::optional<std::string> AmbDecConf::load(const char *fname) noexcept +std::optional<std::string> AmbDecConf::load(const char *fname) noexcept { al::ifstream f{fname}; if(!f.is_open()) @@ -291,7 +291,7 @@ al::optional<std::string> AmbDecConf::load(const char *fname) noexcept if(CoeffScale == AmbDecScale::Unset) return make_error(linenum, "No coefficient scaling defined"); - return al::nullopt; + return std::nullopt; } else return make_error(linenum, "Unexpected command: %s", command.c_str()); diff --git a/core/ambdec.h b/core/ambdec.h index 7f739781..19f68697 100644 --- a/core/ambdec.h +++ b/core/ambdec.h @@ -3,9 +3,9 @@ #include <array> #include <memory> +#include <optional> #include <string> -#include "aloptional.h" #include "core/ambidefs.h" /* Helpers to read .ambdec configuration files. */ @@ -49,7 +49,7 @@ struct AmbDecConf { ~AmbDecConf(); - al::optional<std::string> load(const char *fname) noexcept; + std::optional<std::string> load(const char *fname) noexcept; }; #endif /* CORE_AMBDEC_H */ diff --git a/core/cpu_caps.cpp b/core/cpu_caps.cpp index 165edb24..1a064cf4 100644 --- a/core/cpu_caps.cpp +++ b/core/cpu_caps.cpp @@ -51,14 +51,14 @@ inline std::array<reg_type,4> get_cpuid(unsigned int f) } // namespace -al::optional<CPUInfo> GetCPUInfo() +std::optional<CPUInfo> GetCPUInfo() { CPUInfo ret; #ifdef CAN_GET_CPUID auto cpuregs = get_cpuid(0); if(cpuregs[0] == 0) - return al::nullopt; + return std::nullopt; const reg_type maxfunc{cpuregs[0]}; diff --git a/core/cpu_caps.h b/core/cpu_caps.h index ffd671d0..0826a49b 100644 --- a/core/cpu_caps.h +++ b/core/cpu_caps.h @@ -1,10 +1,9 @@ #ifndef CORE_CPU_CAPS_H #define CORE_CPU_CAPS_H +#include <optional> #include <string> -#include "aloptional.h" - extern int CPUCapFlags; enum { @@ -21,6 +20,6 @@ struct CPUInfo { int mCaps{0}; }; -al::optional<CPUInfo> GetCPUInfo(); +std::optional<CPUInfo> GetCPUInfo(); #endif /* CORE_CPU_CAPS_H */ diff --git a/core/helpers.cpp b/core/helpers.cpp index 71ddbc23..58cc74e5 100644 --- a/core/helpers.cpp +++ b/core/helpers.cpp @@ -9,15 +9,15 @@ #include <cstdlib> #include <cstdio> #include <cstring> -#include <mutex> #include <limits> +#include <mutex> +#include <optional> #include <string> #include <tuple> #include "almalloc.h" #include "alfstream.h" #include "alnumeric.h" -#include "aloptional.h" #include "alspan.h" #include "alstring.h" #include "logging.h" @@ -38,7 +38,7 @@ bool AllowRTTimeLimit{true}; const PathNamePair &GetProcBinary() { - static al::optional<PathNamePair> procbin; + static std::optional<PathNamePair> procbin; if(procbin) return *procbin; auto fullpath = std::vector<WCHAR>(256); @@ -209,7 +209,7 @@ void SetRTPriority(void) const PathNamePair &GetProcBinary() { - static al::optional<PathNamePair> procbin; + static std::optional<PathNamePair> procbin; if(procbin) return *procbin; std::vector<char> pathname; diff --git a/core/hrtf.cpp b/core/hrtf.cpp index cdafe93c..c54d96d1 100644 --- a/core/hrtf.cpp +++ b/core/hrtf.cpp @@ -16,6 +16,7 @@ #include <memory> #include <mutex> #include <numeric> +#include <optional> #include <type_traits> #include <utility> @@ -25,7 +26,6 @@ #include "almalloc.h" #include "alnumbers.h" #include "alnumeric.h" -#include "aloptional.h" #include "alspan.h" #include "ambidefs.h" #include "filters/splitter.h" @@ -1221,7 +1221,7 @@ al::span<const char> GetResource(int name) } // namespace -al::vector<std::string> EnumerateHrtf(al::optional<std::string> pathopt) +al::vector<std::string> EnumerateHrtf(std::optional<std::string> pathopt) { std::lock_guard<std::mutex> _{EnumeratedHrtfLock}; EnumeratedHrtfs.clear(); diff --git a/core/hrtf.h b/core/hrtf.h index eb18682a..7215711b 100644 --- a/core/hrtf.h +++ b/core/hrtf.h @@ -4,10 +4,10 @@ #include <array> #include <cstddef> #include <memory> +#include <optional> #include <string> #include "almalloc.h" -#include "aloptional.h" #include "alspan.h" #include "atomic.h" #include "ambidefs.h" @@ -83,7 +83,7 @@ struct DirectHrtfState { }; -al::vector<std::string> EnumerateHrtf(al::optional<std::string> pathopt); +al::vector<std::string> EnumerateHrtf(std::optional<std::string> pathopt); HrtfStorePtr GetLoadedHrtf(const std::string &name, const uint devrate); #endif /* CORE_HRTF_H */ diff --git a/core/voice.cpp b/core/voice.cpp index 6a747f85..090b10a3 100644 --- a/core/voice.cpp +++ b/core/voice.cpp @@ -12,13 +12,13 @@ #include <iterator> #include <memory> #include <new> +#include <optional> #include <stdlib.h> #include <utility> #include <vector> #include "albyte.h" #include "alnumeric.h" -#include "aloptional.h" #include "alspan.h" #include "alstring.h" #include "ambidefs.h" @@ -129,7 +129,7 @@ inline HrtfMixerBlendFunc SelectHrtfBlendMixer() } // namespace -void Voice::InitMixer(al::optional<std::string> resampler) +void Voice::InitMixer(std::optional<std::string> resampler) { if(resampler) { diff --git a/core/voice.h b/core/voice.h index 57ee7b01..9d74ff6b 100644 --- a/core/voice.h +++ b/core/voice.h @@ -6,12 +6,12 @@ #include <bitset> #include <chrono> #include <memory> +#include <optional> #include <stddef.h> #include <string> #include "albyte.h" #include "almalloc.h" -#include "aloptional.h" #include "alspan.h" #include "bufferline.h" #include "buffer_storage.h" @@ -270,7 +270,7 @@ struct Voice { void prepare(DeviceBase *device); - static void InitMixer(al::optional<std::string> resampler); + static void InitMixer(std::optional<std::string> resampler); DEF_NEWDEL(Voice) }; |