yum-mirror/VkFFT
git clone https://git.yummers.dev/yum-mirror/VkFFT
ba7001c
master
1//------------------------------------------------------------------------------------------------------------------------------------------------------------- 2// 3// Foundation/NSError.hpp 4// 5// Copyright 2020-2021 Apple Inc. 6// 7// Licensed under the Apache License, Version 2.0 (the "License"); 8// you may not use this file except in compliance with the License. 9// You may obtain a copy of the License at 10// 11// http://www.apache.org/licenses/LICENSE-2.0 12// 13// Unless required by applicable law or agreed to in writing, software 14// distributed under the License is distributed on an "AS IS" BASIS, 15// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16// See the License for the specific language governing permissions and 17// limitations under the License. 18// 19//------------------------------------------------------------------------------------------------------------------------------------------------------------- 20 21#pragma once 22 23//------------------------------------------------------------------------------------------------------------------------------------------------------------- 24 25#include "NSDefines.hpp" 26#include "NSObject.hpp" 27#include "NSPrivate.hpp" 28#include "NSTypes.hpp" 29 30//------------------------------------------------------------------------------------------------------------------------------------------------------------- 31 32namespace NS 33{ 34using ErrorDomain = class String * ; 35 36_NS_CONST (ErrorDomain ,CocoaErrorDomain ); 37_NS_CONST (ErrorDomain ,POSIXErrorDomain ); 38_NS_CONST (ErrorDomain ,OSStatusErrorDomain ); 39_NS_CONST (ErrorDomain ,MachErrorDomain ); 40 41using ErrorUserInfoKey = class String * ; 42 43_NS_CONST (ErrorUserInfoKey ,UnderlyingErrorKey ); 44_NS_CONST (ErrorUserInfoKey ,LocalizedDescriptionKey ); 45_NS_CONST (ErrorUserInfoKey ,LocalizedFailureReasonErrorKey ); 46_NS_CONST (ErrorUserInfoKey ,LocalizedRecoverySuggestionErrorKey ); 47_NS_CONST (ErrorUserInfoKey ,LocalizedRecoveryOptionsErrorKey ); 48_NS_CONST (ErrorUserInfoKey ,RecoveryAttempterErrorKey ); 49_NS_CONST (ErrorUserInfoKey ,HelpAnchorErrorKey ); 50_NS_CONST (ErrorUserInfoKey ,DebugDescriptionErrorKey ); 51_NS_CONST (ErrorUserInfoKey ,LocalizedFailureErrorKey ); 52_NS_CONST (ErrorUserInfoKey ,StringEncodingErrorKey ); 53_NS_CONST (ErrorUserInfoKey ,URLErrorKey ); 54_NS_CONST (ErrorUserInfoKey ,FilePathErrorKey ); 55 56class Error :public Copying < Error > 57{ 58public : 59static Error * error (ErrorDomain domain ,Integer code ,class Dictionary * pDictionary ); 60 61static Error * alloc (); 62Error * init (); 63Error * init (ErrorDomain domain ,Integer code ,class Dictionary * pDictionary ); 64 65Integer code ()const ; 66ErrorDomain domain ()const ; 67class Dictionary * userInfo ()const ; 68 69class String * localizedDescription ()const ; 70class Array * localizedRecoveryOptions ()const ; 71class String * localizedRecoverySuggestion ()const ; 72class String * localizedFailureReason ()const ; 73}; 74} 75 76//------------------------------------------------------------------------------------------------------------------------------------------------------------- 77 78_NS_PRIVATE_DEF_CONST (NS ::ErrorDomain ,CocoaErrorDomain ); 79_NS_PRIVATE_DEF_CONST (NS ::ErrorDomain ,POSIXErrorDomain ); 80_NS_PRIVATE_DEF_CONST (NS ::ErrorDomain ,OSStatusErrorDomain ); 81_NS_PRIVATE_DEF_CONST (NS ::ErrorDomain ,MachErrorDomain ); 82 83_NS_PRIVATE_DEF_CONST (NS ::ErrorUserInfoKey ,UnderlyingErrorKey ); 84_NS_PRIVATE_DEF_CONST (NS ::ErrorUserInfoKey ,LocalizedDescriptionKey ); 85_NS_PRIVATE_DEF_CONST (NS ::ErrorUserInfoKey ,LocalizedFailureReasonErrorKey ); 86_NS_PRIVATE_DEF_CONST (NS ::ErrorUserInfoKey ,LocalizedRecoverySuggestionErrorKey ); 87_NS_PRIVATE_DEF_CONST (NS ::ErrorUserInfoKey ,LocalizedRecoveryOptionsErrorKey ); 88_NS_PRIVATE_DEF_CONST (NS ::ErrorUserInfoKey ,RecoveryAttempterErrorKey ); 89_NS_PRIVATE_DEF_CONST (NS ::ErrorUserInfoKey ,HelpAnchorErrorKey ); 90_NS_PRIVATE_DEF_CONST (NS ::ErrorUserInfoKey ,DebugDescriptionErrorKey ); 91_NS_PRIVATE_DEF_CONST (NS ::ErrorUserInfoKey ,LocalizedFailureErrorKey ); 92_NS_PRIVATE_DEF_CONST (NS ::ErrorUserInfoKey ,StringEncodingErrorKey ); 93_NS_PRIVATE_DEF_CONST (NS ::ErrorUserInfoKey ,URLErrorKey ); 94_NS_PRIVATE_DEF_CONST (NS ::ErrorUserInfoKey ,FilePathErrorKey ); 95 96//------------------------------------------------------------------------------------------------------------------------------------------------------------- 97 98_NS_INLINE NS ::Error * NS ::Error ::error (ErrorDomain domain ,Integer code ,class Dictionary * pDictionary ) 99{ 100return Object ::sendMessage < Error *> (_NS_PRIVATE_CLS (NSError ),_NS_PRIVATE_SEL (errorWithDomain_code_userInfo_ ),domain ,code ,pDictionary ); 101} 102 103//------------------------------------------------------------------------------------------------------------------------------------------------------------- 104 105_NS_INLINE NS ::Error * NS ::Error ::alloc () 106{ 107return Object ::alloc < Error > (_NS_PRIVATE_CLS (NSError )); 108} 109 110//------------------------------------------------------------------------------------------------------------------------------------------------------------- 111 112_NS_INLINE NS ::Error * NS ::Error ::init () 113{ 114return Object ::init < Error > (); 115} 116 117//------------------------------------------------------------------------------------------------------------------------------------------------------------- 118 119_NS_INLINE NS ::Error * NS ::Error ::init (ErrorDomain domain ,Integer code ,class Dictionary * pDictionary ) 120{ 121return Object ::sendMessage < Error *> (this ,_NS_PRIVATE_SEL (initWithDomain_code_userInfo_ ),domain ,code ,pDictionary ); 122} 123 124//------------------------------------------------------------------------------------------------------------------------------------------------------------- 125 126_NS_INLINE NS ::Integer NS ::Error ::code ()const 127{ 128return Object ::sendMessage < Integer > (this ,_NS_PRIVATE_SEL (code )); 129} 130 131//------------------------------------------------------------------------------------------------------------------------------------------------------------- 132 133_NS_INLINE NS ::ErrorDomain NS ::Error ::domain ()const 134{ 135return Object ::sendMessage < ErrorDomain > (this ,_NS_PRIVATE_SEL (domain )); 136} 137 138//------------------------------------------------------------------------------------------------------------------------------------------------------------- 139 140_NS_INLINE NS ::Dictionary * NS ::Error ::userInfo ()const 141{ 142return Object ::sendMessage < Dictionary *> (this ,_NS_PRIVATE_SEL (userInfo )); 143} 144 145//------------------------------------------------------------------------------------------------------------------------------------------------------------- 146 147_NS_INLINE NS ::String * NS ::Error ::localizedDescription ()const 148{ 149return Object ::sendMessage < String *> (this ,_NS_PRIVATE_SEL (localizedDescription )); 150} 151 152//------------------------------------------------------------------------------------------------------------------------------------------------------------- 153 154_NS_INLINE NS ::Array * NS ::Error ::localizedRecoveryOptions ()const 155{ 156return Object ::sendMessage < Array *> (this ,_NS_PRIVATE_SEL (localizedRecoveryOptions )); 157} 158 159//------------------------------------------------------------------------------------------------------------------------------------------------------------- 160 161_NS_INLINE NS ::String * NS ::Error ::localizedRecoverySuggestion ()const 162{ 163return Object ::sendMessage < String *> (this ,_NS_PRIVATE_SEL (localizedRecoverySuggestion )); 164} 165 166//------------------------------------------------------------------------------------------------------------------------------------------------------------- 167 168_NS_INLINE NS ::String * NS ::Error ::localizedFailureReason ()const 169{ 170return Object ::sendMessage < String *> (this ,_NS_PRIVATE_SEL (localizedFailureReason )); 171} 172 173//-------------------------------------------------------------------------------------------------------------------------------------------------------------