CoreFoundation: add cfnumber
Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
parent
abf371c09f
commit
ead116d198
@ -92,6 +92,27 @@ namespace macstd {
|
||||
cfstring(const std::basic_string<char, TR, A> &s) : cfstring(s.c_str()) {}
|
||||
};
|
||||
|
||||
///
|
||||
/// Core Foundation number
|
||||
///
|
||||
class cfnumber : public cfobject<CFNumberRef>
|
||||
{
|
||||
public:
|
||||
cfnumber(CFNumberRef h) : cfobject<CFNumberRef>(h) {}
|
||||
|
||||
cfnumber(float n) : cfobject<CFNumberRef>(CFNumberCreate(kCFAllocatorDefault, kCFNumberFloatType, &n))
|
||||
{
|
||||
if (!valid()) [[unlikely]]
|
||||
throw std::bad_alloc();
|
||||
}
|
||||
|
||||
cfnumber(double n) : cfobject<CFNumberRef>(CFNumberCreate(kCFAllocatorDefault, kCFNumberDoubleType, &n))
|
||||
{
|
||||
if (!valid()) [[unlikely]]
|
||||
throw std::bad_alloc();
|
||||
}
|
||||
};
|
||||
|
||||
///
|
||||
/// Core Foundation runtime error
|
||||
///
|
||||
|
Loading…
x
Reference in New Issue
Block a user