Colobot
CBotFileUtils.h
1 /*
2  * This file is part of the Colobot: Gold Edition source code
3  * Copyright (C) 2001-2016, Daniel Roux, EPSITEC SA & TerranovaTeam
4  * http://epsitec.ch; http://colobot.info; http://github.com/colobot
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14  * See the GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see http://gnu.org/licenses
18  */
19 
20 #pragma once
21 
22 #include <cstdio>
23 #include <string>
24 
25 namespace CBot
26 {
27 
28 class CBotVar;
29 class CBotTypResult;
30 
32 // routines for file management (* FILE)
33 
40 FILE* fOpen(const char* name, const char* mode);
41 
47 int fClose(FILE* filehandle);
48 
57 std::size_t fWrite(const void *buffer,
58  std::size_t elemsize,
59  std::size_t length,
60  FILE* filehandle);
61 
70 std::size_t fRead(void *buffer,
71  std::size_t elemsize,
72  std::size_t length,
73  FILE* filehandle);
74 
81 bool SaveVars(FILE* pf, CBotVar* pVar);
82 
89 bool WriteWord(FILE* pf, unsigned short w);
90 
97 bool ReadWord(FILE* pf, unsigned short& w);
98 
105 bool ReadLong(FILE* pf, long& w);
106 
113 bool WriteFloat(FILE* pf, float w);
114 
121 bool WriteLong(FILE* pf, long w);
122 
129 bool ReadFloat(FILE* pf, float& w);
130 
137 bool ReadString(FILE* pf, std::string& s);
138 
145 bool WriteType(FILE* pf, const CBotTypResult &type);
146 
153 bool ReadType(FILE* pf, CBotTypResult &type);
154 
155 } // namespace CBot
bool ReadString(FILE *pf, std::string &s)
ReadString.
Definition: CBotFileUtils.cpp:107
std::size_t fRead(void *buffer, std::size_t elemsize, std::size_t length, FILE *filehandle)
fRead
Definition: CBotFileUtils.cpp:57
FILE * fOpen(const char *name, const char *mode)
fOpen
Definition: CBotFileUtils.cpp:36
bool ReadFloat(FILE *pf, float &w)
ReadFloat.
Definition: CBotFileUtils.cpp:77
bool WriteWord(FILE *pf, unsigned short w)
WriteWord.
Definition: CBotUtils.cpp:112
bool WriteType(FILE *pf, const CBotTypResult &type)
WriteType.
Definition: CBotFileUtils.cpp:123
std::size_t fWrite(const void *buffer, std::size_t elemsize, std::size_t length, FILE *filehandle)
fWrite
Definition: CBotFileUtils.cpp:48
bool SaveVars(FILE *pf, CBotVar *pVar)
SaveVars.
Definition: CBotStack.cpp:711
bool ReadType(FILE *pf, CBotTypResult &type)
ReadType.
Definition: CBotFileUtils.cpp:143
bool ReadLong(FILE *pf, long &w)
ReadLong.
Definition: CBotFileUtils.cpp:97
int fClose(FILE *filehandle)
fClose
Definition: CBotFileUtils.cpp:42
bool WriteFloat(FILE *pf, float w)
WriteFloat.
Definition: CBotUtils.cpp:134
bool ReadWord(FILE *pf, unsigned short &w)
ReadWord.
Definition: CBotFileUtils.cpp:67
bool WriteLong(FILE *pf, long w)
WriteLong.
Definition: CBotFileUtils.cpp:87
CBot engine.
Definition: CBotCallMethode.cpp:28