All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Common.h
Go to the documentation of this file.
1 //---------------------------------------------------------------------------------------
2 // Copyright (c) 2001-2020 by PDFTron Systems Inc. All Rights Reserved.
3 // Consult legal.txt regarding legal and license information.
4 //---------------------------------------------------------------------------------------
5 #ifndef PDFTRON_H_CPPCommonCommon
6 #define PDFTRON_H_CPPCommonCommon
7 
8 #include <C/Common/TRN_Types.h>
9 #include <Common/BasicTypes.h>
10 #include <Common/Exception.h>
11 #include <string.h>
12 
13 #define REX(action) { TRN_Exception ex=action; if(ex!=0) throw Common::Exception(ex); }
14 #define DREX(impl, destroy_action) \
15  if (impl) {\
16  destroy_action;\
17  impl = 0;\
18  }
19 #define DREX_NO_IMPL(destroy_action) destroy_action
20 
21 #define RetObj(ex) TRN_Obj result; REX(ex); return SDF::Obj(result);
22 #define RetBool(ex) TRN_Bool result; REX(ex); return TBToB(result);
23 #define RetInt(ex) int result; REX(ex); return result;
24 #define RetCCS(ex) const char* result; REX(ex); return result;
25 #define RetDbl(ex) double result; REX(ex); return result;
26 #define RetStr(ex) TRN_UString result; REX(ex); return UString(result);
27 
28 #define RetPC(ex) TRN_PatternColor result; REX(ex); return PatternColor(result);
29 #define RetFont(ex) TRN_Font result; REX(ex); return Font(result);
30 #define RetRec(ex) TRN_Rect result; REX(ex); return *((Rect*)&result);
31 #define RetMtx(ex) TRN_Matrix2D result; REX(ex); return *((Common::Matrix2D*)&result)
32 #define RetCPT(ex) TRN_ColorPt result; TRN_ColorPtInit(0,0,0,0, &result); REX(ex); return *((ColorPt*)&result)
33 #define RetFDFField(ex) TRN_FDFField result; REX(ex); return *((FDFField*)&result)
34 
35 #endif // PDFTRON_H_CPPCommonCommon