Build without /usr/local/snark14
[snark14.git] / include / DIGFile / DIG.h
1 /*
2
3   This file is part of DIG Library.
4   DIG Library is a free software; you can redistribute it and/or modify
5   it under the terms of the GNU General Public License as published
6   by the Free Software Foundation; either version 2 of the License,
7   or (at your option) any later version.
8   DIG Library is distributed in the hope that it will be useful, but
9   WITHOUT ANY WARRANTY; without even the implied warranty of
10   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11   General Public License for more details.
12   You should have received a copy of the GNU General Public License
13   along with Foobar; if not, write to the Free Software Foundation,
14   Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15
16 */
17
18 // DIG.h,v 1.2 2005/07/27 16:39:05 jdubowy Exp
19
20 #ifndef DIG_H
21 #define DIG_H
22
23 #include <cstring>
24
25 //#include <DIGEndian.h>
26 #include <DIGFile/DIGEndian.h>
27
28 #if defined _MSC_VER
29
30 typedef signed char    DIGint8;
31 typedef signed __int16 DIGint16;
32 typedef signed __int32 DIGint32;
33 typedef signed __int64 DIGint64;
34
35 typedef unsigned char    DIGuint8;
36 typedef unsigned __int16 DIGuint16;
37 typedef unsigned __int32 DIGuint32;
38 typedef unsigned __int64 DIGuint64;
39
40 typedef float        DIGreal32;
41 typedef double       DIGreal64;
42 typedef long double  DIGreal80;
43
44 #if defined _M_ALPHA //Defined for DEC ALPHA platforms.
45
46 #elif defined _M_IX86 //Defined for x86 processors.
47
48 #elif defined _M_MPPC //Defined for Power Macintosh platforms.
49
50 #elif defined _M_MRX000 //Defined for MIPS platforms.
51
52 #elif defined _M_PPC //Defined for PowerPC platforms.
53
54 #endif
55
56 #elif defined __GNUC__
57
58 typedef signed char      DIGint8;
59 typedef signed short     DIGint16;
60 typedef signed int       DIGint32;
61 typedef signed long long DIGint64;
62
63 typedef unsigned char      DIGuint8;
64 typedef unsigned short     DIGuint16;
65 typedef unsigned int       DIGuint32;
66 typedef unsigned long long DIGuint64;
67
68 typedef float        DIGreal32;
69 typedef double       DIGreal64;
70 typedef long double  DIGreal80;
71
72 #if defined __i386__ //Defined for x86 processors.
73
74
75 #endif
76
77 #endif
78
79
80 class DIGString
81 {
82 protected:
83
84   char*   String;
85
86 public:
87
88   DIGString()
89   {
90     String = NULL;
91   }
92
93   int Set(const char* pString)
94   {
95     if(String != NULL) {         // if not empty 
96       delete String;             // destroy old buffer
97     }
98
99     if(pString == NULL) {        // if NULL as parameter
100       String = NULL;             // stet to NULL
101       return 0;
102     }
103
104     int len = strlen(pString);   // get length of string
105     String = new char[len + 1];  // create new buffer
106     strcpy(String, pString);     // copy string to buffer
107
108     return 0;
109   }
110
111   int Get(const char** pString)
112   {
113     *pString = String;
114     return 0;
115   }
116
117   const char* Get()
118   {
119     return String;
120   }
121
122   ~DIGString()
123   {
124     if(String != NULL) {
125       delete String;
126     }
127   }
128 };
129
130 #endif // DIG_H