Debian Codegraph @

src/io/file.h

raw symbols SCIP
1
2 /**
3 *
4 * @file file.h
5 *
6 * Part of the OpenJazz project
7 *
8 * @par History:
9 * - 23rd August 2005: Created OpenJazz.h
10 * - 3rd February 2009: Created file.h from parts of OpenJazz.h
11 *
12 * @par Licence:
13 * Copyright (c) 2005-2010 AJ Thomson
14 * Copyright (c) 2015-2026 Carsten Teibes
15 *
16 * OpenJazz is distributed under the terms of
17 * the GNU General Public License, version 2.0
18 *
19 */
20
21
22 #ifndef _FILE_H
23 #define _FILE_Hcxx . . $ `src/io/file.h:23:9`!
24
25
26 #include "OpenJazz.h"cxx . . $ `<file>/src/OpenJazz.h`/
27 #include "io/gfx/video.h"cxx . . $ `<file>/src/io/gfx/video.h`/
28
29 #include <stdio.h>
30 #include <memory>
31
32 // Classes
33
34 struct SDL_Surfacecxx . . $ SDL_Surface#;
35 struct SDL_Colorcxx . . $ SDL_Color#;
36
37 /// File i/o
38 class Filecxx . . $ File# {
39
40 private:
41 FILE* filecxx . . $ File#file.;
42 char* filePathcxx . . $ File#filePath.;
43 bool forWritingcxx . . $ File#forWriting.;
44
45 bool opencxx . . $ File#open(567fbfac950d45). (const char* path, const char* name, bool write);
46
47 public:
48 Filecxx . . $ File#File(e99a0a23efd851c6). (const char* name, int pathType, bool write = false);
49 ~cxx . . $ File#`~File`(49f6e7a06ebc5aa8).Filecxx . . $ File# ();
50
51 int getSizecxx . . $ File#getSize(b126dc7c1de90089). ();
52 void seekcxx . . $ File#seek(918ebd27a9ddbad3). (int offset, bool reset = false);
53 int tellcxx . . $ File#tell(b126dc7c1de90089). ();
54 unsigned char loadCharcxx . . $ File#loadChar(7c4be072098b358f). ();
55 void storeCharcxx . . $ File#storeChar(ac50b47256ae7414). (unsigned char val);
56 unsigned short int loadShortcxx . . $ File#loadShort(32a7769d58713265). ();
57 unsigned short int loadShortcxx . . $ File#loadShort(a18c05e4017afb3d). (unsigned short int max);
58 void storeShortcxx . . $ File#storeShort(ed53e3bbd3fa2f69). (unsigned short int val);
59 signed int loadIntcxx . . $ File#loadInt(b126dc7c1de90089). ();
60 void storeIntcxx . . $ File#storeInt(d4f767463ce0a6b3). (signed int val);
61 void storeDatacxx . . $ File#storeData(d0320739773070f2). (void* data, int length);
62 unsigned char* loadBlockcxx . . $ File#loadBlock(f18dc31a6ecbac56). (int length);
63 unsigned char* loadRLEcxx . . $ File#loadRLE(bf8b529691269f26). (int length, bool checkSize = true);
64 void skipRLEcxx . . $ File#skipRLE(49f6e7a06ebc5aa8). ();
65 unsigned char* loadLZcxx . . $ File#loadLZ(1393c316e1be7356). (int compressedLength, int length);
66 char* loadTerminatedStringcxx . . $ File#loadTerminatedString(ff224f080444ee45). (int maxSize = 0);
67 char* loadFileNamecxx . . $ File#loadFileName(41208ce6ca65dd58).();
68 char* loadStringcxx . . $ File#loadString(ff224f080444ee45). (int length);
69 SDL_Surface* loadSurfacecxx . . $ File#loadSurface(efa8a2aaf13882cf). (int width, int height, bool checkSize = true);
70 unsigned char* loadPixelscxx . . $ File#loadPixels(f18dc31a6ecbac56). (int length);
71 unsigned char* loadPixelscxx . . $ File#loadPixels(1393c316e1be7356). (int length, int key);
72 void loadPalettecxx . . $ File#loadPalette(a8e7e0a5cf0a5bef). (SDL_Color* palette, bool rle = true);
73
74 };
75
76 using FilePtrcxx . . $ FilePtr# = stdcxx . . $ std/::unique_ptrcxx . . $ std/unique_ptr#<Filecxx . . $ File#>;
77
78
79 /// Directory path
80
81 enum path_typecxx . . $ path_type# {
82 PATH_TYPE_INVALIDcxx . . $ PATH_TYPE_INVALID. = 0, ///< Invalid directory, do not use
83 PATH_TYPE_SYSTEMcxx . . $ PATH_TYPE_SYSTEM. = 1 << 0, ///< Read-only system directory
84 PATH_TYPE_CONFIGcxx . . $ PATH_TYPE_CONFIG. = 1 << 1, ///< User writable configuration directory
85 PATH_TYPE_GAMEcxx . . $ PATH_TYPE_GAME. = 1 << 2, ///< Directory containing game data
86 PATH_TYPE_TEMPcxx . . $ PATH_TYPE_TEMP. = 1 << 3, ///< User writable temporary directory
87 PATH_TYPE_ANYcxx . . $ PATH_TYPE_ANY. = 1 << 4 ///< Special case: any type
88 };
89
90 class Pathcxx . . $ Path# {
91
92 public:
93 Pathcxx . . $ Path#* nextcxx . . $ Path#next.; ///< Next path to check
94 char* pathcxx . . $ Path#path.; ///< Path
95 int pathTypecxx . . $ Path#pathType.; ///< One or more of path_type enum
96
97 Pathcxx . . $ Path#Path(ced3bab86df392e6). (Pathcxx . . $ Path#* newNext, char* newPath, int newPathType);
98 ~cxx . . $ Path#`~Path`(49f6e7a06ebc5aa8).Pathcxx . . $ Path# ();
99
100 };
101
102
103 class PathMgrcxx . . $ PathMgr# {
104
105 public:
106 PathMgrcxx . . $ PathMgr#PathMgr(49f6e7a06ebc5aa8).();
107 ~cxx . . $ PathMgr#`~PathMgr`(49f6e7a06ebc5aa8).PathMgrcxx . . $ PathMgr#();
108
109 bool addcxx . . $ PathMgr#add(37e8d18a243bba77).(char* newPath, int newPathType = PATH_TYPE_ANYcxx . . $ PATH_TYPE_ANY.);
110
111 Pathcxx . . $ Path#* pathscxx . . $ PathMgr#paths.;
112
113 bool has_configcxx . . $ PathMgr#has_config.;
114 bool has_tempcxx . . $ PathMgr#has_temp.;
115
116 };
117
118
119 // Directory Seperator
120
121 #ifdef _WIN32
122 #define OJ_DIR_SEP '\\'
123 #define OJ_DIR_SEP_STR "\\"
124 #else
125 #define OJ_DIR_SEPcxx . . $ `src/io/file.h:125:10`! '/'
126 #define OJ_DIR_SEP_STRcxx . . $ `src/io/file.h:126:10`! "/"
127 #endif
128
129
130 // Variable
131
132 EXTERNcxx . . $ `src/OpenJazz.h:38:10`! PathMgrcxx . . $ PathMgr# gamePathscxx . . $ gamePaths.; ///< Paths to files
133
134 #endif
135