diff options
author | Daniel Wilhelm <daniel@wili.li> | 2015-10-02 14:53:20 +0200 |
---|---|---|
committer | Daniel Wilhelm <daniel@wili.li> | 2015-10-02 14:53:20 +0200 |
commit | 94db751716dd2851f99b5c4c2981da1d1f4780f8 (patch) | |
tree | e4ffc9f5ae2b2873f267a6e5d3d2092c8aad49a7 /zen/osx_throw_exception.h | |
parent | 6.10 (diff) | |
download | FreeFileSync-94db751716dd2851f99b5c4c2981da1d1f4780f8.tar.gz FreeFileSync-94db751716dd2851f99b5c4c2981da1d1f4780f8.tar.bz2 FreeFileSync-94db751716dd2851f99b5c4c2981da1d1f4780f8.zip |
6.11
Diffstat (limited to 'zen/osx_throw_exception.h')
-rw-r--r-- | zen/osx_throw_exception.h | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/zen/osx_throw_exception.h b/zen/osx_throw_exception.h deleted file mode 100644 index 07e3af3e..00000000 --- a/zen/osx_throw_exception.h +++ /dev/null @@ -1,56 +0,0 @@ -// ************************************************************************** -// * This file is part of the FreeFileSync project. It is distributed under * -// * GNU General Public License: http://www.gnu.org/licenses/gpl.html * -// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved * -// ************************************************************************** - -#ifndef OSX_EXCEPTION_89274305834255 -#define OSX_EXCEPTION_89274305834255 - -#import <Cocoa/Cocoa.h> -#include "sys_error.h" -#include "utf.h" - -namespace osx -{ -//for use in Objective C implementation files only! -void throwSysError(NSException* e); //throw SysError - -#define ZEN_OSX_ASSERT(obj) ZEN_OSX_ASSERT_IMPL(obj, #obj) //throw SysError -/* -Example: ZEN_OSX_ASSERT(obj); - -Equivalent to: - if (!obj) - throw zen::SysError(L"Assertion failed: \"obj\"."); -*/ - - - - - - -//######################## implmentation ############################ -inline -void throwSysError(NSException* e) //throw SysError -{ - std::string msg; - if (const char* name = [[e name ] cStringUsingEncoding:NSUTF8StringEncoding]) //"const char*" NOT owned by us! - msg += name; - if (const char* descr = [[e reason] cStringUsingEncoding:NSUTF8StringEncoding]) - { - msg += "\n"; - msg += descr; - } - throw zen::SysError(zen::utfCvrtTo<std::wstring>(msg)); - /* - e.g. - NSInvalidArgumentException - *** +[NSString stringWithCString:encoding:]: NULL cString - */ -} -} - -#define ZEN_OSX_ASSERT_IMPL(obj, txt) if (!(obj)) throw zen::SysError(std::wstring(L"Assertion failed: \"") + L ## txt + L"\"."); - -#endif //OSX_EXCEPTION_89274305834255 |