Pajdeg  0.2.2
Pajdeg
PDNumber.h
Go to the documentation of this file.
1 //
2 // PDNumber.h
3 //
4 // Copyright (c) 2012 - 2015 Karl-Johan Alm (http://github.com/kallewoof)
5 //
6 // Permission is hereby granted, free of charge, to any person obtaining a copy
7 // of this software and associated documentation files (the "Software"), to deal
8 // in the Software without restriction, including without limitation the rights
9 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 // copies of the Software, and to permit persons to whom the Software is
11 // furnished to do so, subject to the following conditions:
12 //
13 // The above copyright notice and this permission notice shall be included in
14 // all copies or substantial portions of the Software.
15 //
16 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 // THE SOFTWARE.
23 //
24 
39 #ifndef INCLUDED_PDNUMBER_H
40 #define INCLUDED_PDNUMBER_H
41 
42 #include "PDDefines.h"
43 
44 extern PDNumberRef PDNullObject;
45 
46 // retained variants
47 extern PDNumberRef PDNumberCreateWithInteger(PDInteger i);
48 extern PDNumberRef PDNumberCreateWithSize(PDSize s);
49 extern PDNumberRef PDNumberCreateWithReal(PDReal r);
50 extern PDNumberRef PDNumberCreateWithBool(PDBool b);
51 extern PDNumberRef PDNumberCreateWithPointer(void *p);
52 extern PDNumberRef PDNumberCreateWithCString(const char *cString);
53 
54 // autoreleased variants
55 #define PDNumberWithInteger(i) PDAutorelease(PDNumberCreateWithInteger(i))
56 #define PDNumberWithSize(s) PDAutorelease(PDNumberCreateWithSize(s))
57 #define PDNumberWithReal(r) PDAutorelease(PDNumberCreateWithReal(r))
58 #define PDNumberWithBool(b) PDAutorelease(PDNumberCreateWithBool(b))
59 #define PDNumberWithPointer(p) PDAutorelease(PDNumberCreateWithPointer(p))
60 
61 // NULL n safe
62 extern PDInteger PDNumberGetInteger(PDNumberRef n);
63 extern PDSize PDNumberGetSize(PDNumberRef n);
64 extern PDReal PDNumberGetReal(PDNumberRef n);
65 extern PDBool PDNumberGetBool(PDNumberRef n);
66 extern void *PDNumberGetPointer(PDNumberRef n);
67 
68 extern PDInteger PDNumberPrinter(void *inst, char **buf, PDInteger offs, PDInteger *cap);
69 
70 extern PDObjectType PDNumberGetObjectType(PDNumberRef n);
71 
72 extern char *PDNumberToString(PDNumberRef n);
73 
74 #endif // INCLUDED_PDNUMBER_H
75 
float PDReal
Definition: PDDefines.h:194
long PDInteger
Definition: PDDefines.h:184
unsigned char PDBool
Definition: PDDefines.h:207
size_t PDSize
Definition: PDDefines.h:213
PDObjectType
Definition: PDDefines.h:611
Definition: pd_internal.h:869
Definitions for the Pajdeg interface.