equal
deleted
inserted
replaced
|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * |
|
5 * This program is free software: you can redistribute it and/or modify |
|
6 * it under the terms of the GNU Lesser General Public License as published by |
|
7 * the Free Software Foundation, either version 3 of the License, or |
|
8 * (at your option) any later version. |
|
9 * |
|
10 * This program is distributed in the hope that it will be useful, |
|
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 * GNU Lesser General Public License for more details. |
|
14 * |
|
15 * You should have received a copy of the GNU Lesser General Public License |
|
16 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
17 */ |
|
18 |
|
19 #ifndef INPUTFILE_H_ |
|
20 #define INPUTFILE_H_ |
|
21 |
|
22 #include <cassert> |
|
23 |
|
24 #include "defs.h" |
|
25 |
|
26 class InputFile { |
|
27 public: |
|
28 InputFile(PathName & aPath) : |
|
29 iPathName(aPath), iFd(0), iOpened(false), iSize(0), iSizeValid(false), iOffset(0) |
|
30 { |
|
31 assert(iPathName.size() != 0); |
|
32 } |
|
33 ~InputFile(); |
|
34 void Open(); |
|
35 void Close(); |
|
36 size_t Size(); |
|
37 char * GetData(); |
|
38 char * GetData(size_t nbytes); |
|
39 void GetData(void * data, size_t nbytes); |
|
40 void SetOffset(size_t aOffset) { iOffset = aOffset; } |
|
41 size_t GetOffset() { return iOffset; } |
|
42 |
|
43 InputFile & operator=(const InputFile & aInputFile); |
|
44 InputFile(const InputFile & aInputFile); |
|
45 |
|
46 |
|
47 private: |
|
48 |
|
49 void SetSize(); |
|
50 private: |
|
51 PathName iPathName; |
|
52 int iFd; |
|
53 bool iOpened; |
|
54 size_t iSize; |
|
55 bool iSizeValid; |
|
56 size_t iOffset; |
|
57 }; |
|
58 |
|
59 #endif /*INPUTFILE_H_*/ |