| 1 |
/* FileInMemory_def.h |
| 2 |
* |
| 3 |
* Copyright (C) 2017-2020 David Weenink, 2024 Paul Boersma |
| 4 |
* |
| 5 |
* This code is free software; you can redistribute it and/or modify |
| 6 |
* it under the terms of the GNU General Public License as published by |
| 7 |
* the Free Software Foundation; either version 2 of the License, or (at |
| 8 |
* your option) any later version. |
| 9 |
* |
| 10 |
* This code is distributed in the hope that it will be useful, but |
| 11 |
* WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 |
* General Public License for more details. |
| 14 |
* |
| 15 |
* You should have received a copy of the GNU General Public License |
| 16 |
* along with this work. If not, see <http://www.gnu.org/licenses/>. |
| 17 |
*/ |
| 18 |
|
| 19 |
#define ooSTRUCT FileInMemory |
| 20 |
oo_DEFINE_CLASS (FileInMemory, SimpleString) |
| 21 |
|
| 22 |
oo_INTEGER (d_numberOfBytes) // not including any final null byte |
| 23 |
oo_INTEGER (d_position) |
| 24 |
oo_INT16 (d_errno) |
| 25 |
oo_INT16 (d_eof) |
| 26 |
oo_INT32 (ungetChar) |
| 27 |
|
| 28 |
/* |
| 29 |
The order of the following two statements doesn't matter! |
| 30 |
This is because d_data autodestroys with the FileInMemory *after* this code block. |
| 31 |
*/ |
| 32 |
#if oo_DESTROYING |
| 33 |
if (_dontOwnData) |
| 34 |
our d_data.cells = nullptr; // prevent autodestruction |
| 35 |
#endif |
| 36 |
oo_BYTEVEC (d_data, d_numberOfBytes + 1) // final null byte possible |
| 37 |
|
| 38 |
oo_UBYTE (isOpen) |
| 39 |
|
| 40 |
#if oo_DECLARING || oo_DESCRIBING |
| 41 |
oo_UBYTE (_dontOwnData) |
| 42 |
#endif |
| 43 |
|
| 44 |
#if oo_DECLARING |
| 45 |
void v1_info () |
| 46 |
override; |
| 47 |
#endif |
| 48 |
|
| 49 |
oo_END_CLASS (FileInMemory) |
| 50 |
#undef ooSTRUCT |
| 51 |
|
| 52 |
/* End of file FileInMemory_def.h */ |