InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
PMFailure.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: Mat Marcus
6 //
7 // $Author$
8 //
9 // $DateTime$
10 //
11 // $Revision$
12 //
13 // $Change$
14 //
15 // Copyright 1997-2010 Adobe Systems Incorporated. All rights reserved.
16 //
17 // NOTICE: Adobe permits you to use, modify, and distribute this file in accordance
18 // with the terms of the Adobe license agreement accompanying it. If you have received
19 // this file from a source other than Adobe, then your use, modification, or
20 // distribution of it requires the prior written permission of Adobe.
21 //
22 //
23 // ADOBE CONFIDENTIAL
24 //
25 //========================================================================================
26 
27 #ifndef __PMFailure__
28 #define __PMFailure__
29 
30 #include "ErrorUtils.h"
31 
32 namespace PM {
33  inline void FailErrorCode(ErrorCode err);
34  inline void FailErrorCode();
35  template <class T>
36  inline void FailNil(T& val);
37 
38  inline void FailErrorCode(ErrorCode err) { if(kSuccess != err) throw err; }
39  inline void FailErrorCode() { FailErrorCode( ErrorUtils::PMGetGlobalErrorCode()); }
40  template <class T>
41  inline void FailNil(T& val) { if(!val) { ErrorUtils::PMSetGlobalErrorCode(kFailure); FailErrorCode(kFailure);} }
42 
43 }
44 
45 
46 #endif //__PMFailure__
47