source: trunk/gsdl/packages/isis-gdl/IsisDef.h@ 7140

Last change on this file since 7140 was 7140, checked in by mdewsnip, 20 years ago

A couple more changes so it compiles on Windows.

  • Property svn:keywords set to Author Date Id Revision
File size: 3.7 KB
Line 
1/**********************************************************************
2 *
3 * IsisDef.h
4 * Copyright (C) 2003 UNESCO
5 *
6 * A component of the Greenstone digital library software
7 * from the New Zealand Digital Library Project at the
8 * University of Waikato, New Zealand.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 *
24 *********************************************************************/
25
26
27#ifndef __ISIS_DEFINITION_H__
28#define __ISIS_DEFINITION_H__
29
30// disable warning C4786: symbol greater than 255 character,
31// okay to ignore
32#pragma warning(disable: 4786)
33
34#ifndef __ISIS_TYPE_H__
35#include "IsisTypes.h"
36#endif
37
38#include <sstream>
39
40typedef std::string ustring;
41typedef std::string cstring;
42// typedef std::wstring awstring;
43typedef std::stringstream ustringstream;
44typedef std::stringstream cstringstream;
45typedef wchar_t WCHAR;
46
47
48const size_t INVALID_NPOS = ~(size_t)0;
49
50namespace FileSystem {
51 // Generic File access/open mode enumeration
52 enum AccessMode {
53 FILE_READONLY, // Open file with read access only
54 FILE_WRITEONLY, // Open file with write access only
55 FILE_READWRITE, // Open file with read and write access
56 FILE_CREATE, // Create the file if it does not exist
57 FILE_NO_CREATE, // Do not create the file if it does not exist
58 FILE_TRUNCATE, // Truncate the file
59 FILE_APPEND, // Append to the file
60 FILE_SHARE, // Enable file sharing (Platform specific)
61 FILE_EXCLUSIVE // Disable file sharing (Platform specific)
62 };
63
64
65 // Generic File seek mode enumeration
66 enum SeekMode {
67 FILE_SEEK_BEG, // Seek starting from the beginning of the file
68 FILE_SEEK_CUR, // Seek starting from the current location
69 FILE_SEEK_END // Seek starting from the end of the file
70 };
71};
72
73#ifndef __FILE_SYSTEM__
74#include "FileSystem.h"
75#endif
76
77#ifndef __FILE_BASE__
78#include "File.h"
79#endif
80
81#ifndef __ISIS_ERROR_H__
82#include "IErrors.h"
83#endif
84
85#ifdef _WIN32
86#ifndef __DEBUG_H__
87#define _DEBUG
88#define _CONSOLE
89#include "debug.h"
90#endif
91#endif
92
93#ifndef __ABSTRACT_ISISDB_H__
94#include "AbstractIsisDb.h"
95#endif
96
97#ifndef __ISISDB_H__
98#include "IsisDb.h"
99#endif
100
101
102#ifndef __MASTER_RECORD_H__
103#include "Master.h"
104#endif
105
106#ifndef __FDT_H__
107#include "Fdt.h"
108#endif
109
110
111enum { RecordDeleted=0, RecordUpdated=1, RecordCreated=2};
112enum { Active=0, LogicalyDeleted=1, PhysicalyDeleted=2,
113 EndOfFile=-1, NewRecord = 3 };
114
115
116
117
118// Class declarations for exceptions representing program errors.
119// This implementation is provided for use C++'s built-in exception
120// handling routines.
121
122class CIsisDbException {
123public:
124 int m_iError;
125 CIsisDbException(const int iError, const char* file_name, const long line_number)
126 {
127 m_iError = iError;
128#ifdef _WIN32
129 AssertFailed(isisExceptionMessage((IsisError) m_iError), file_name, line_number);
130#else
131 std::cout << isisExceptionMessage((IsisError) m_iError) << file_name
132 << " Line=" << line_number;
133#endif
134 }
135};
136
137
138#endif // __ISIS_DEFINITION_H__
Note: See TracBrowser for help on using the repository browser.