ScummVM API documentation
util.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 #ifndef NANCY_UTIL_H
22 #define NANCY_UTIL_H
23 
24 #include "common/rect.h"
25 #include "common/serializer.h"
26 
27 namespace Nancy {
28 
29 void readRect(Common::SeekableReadStream &stream, Common::Rect &inRect);
30 void readRect(Common::Serializer &stream, Common::Rect &inRect, Common::Serializer::Version minVersion = 0, Common::Serializer::Version maxVersion = Common::Serializer::kLastVersion);
31 void readRectArray(Common::SeekableReadStream &stream, Common::Array<Common::Rect> &inArray, uint num, uint totalNum = 0);
32 void readRectArray(Common::Serializer &stream, Common::Array<Common::Rect> &inArray, uint num, uint totalNum = 0, Common::Serializer::Version minVersion = 0, Common::Serializer::Version maxVersion = Common::Serializer::kLastVersion);
33 
34 void readRect16(Common::SeekableReadStream &stream, Common::Rect &inRect);
35 void readRect16(Common::Serializer &stream, Common::Rect &inRect, Common::Serializer::Version minVersion = 0, Common::Serializer::Version maxVersion = Common::Serializer::kLastVersion);
36 void readRectArray16(Common::SeekableReadStream &stream, Common::Array<Common::Rect> &inArray, uint num, uint totalNum = 0);
37 void readRectArray16(Common::Serializer &stream, Common::Array<Common::Rect> &inArray, uint num, uint totalNum = 0, Common::Serializer::Version minVersion = 0, Common::Serializer::Version maxVersion = Common::Serializer::kLastVersion);
38 
39 void readFilename(Common::SeekableReadStream &stream, Common::String &inString);
40 void readFilename(Common::Serializer &stream, Common::String &inString, Common::Serializer::Version minVersion = 0, Common::Serializer::Version maxVersion = Common::Serializer::kLastVersion);
41 inline void readFilename(Common::SeekableReadStream &stream, Common::Path &inPath) {
42  Common::String inString;
43  readFilename(stream, inString);
44  inPath = Common::Path(inString);
45 }
46 inline void readFilename(Common::Serializer &stream, Common::Path &inPath, Common::Serializer::Version minVersion = 0, Common::Serializer::Version maxVersion = Common::Serializer::kLastVersion) {
47  Common::String inString;
48  readFilename(stream, inString, minVersion, maxVersion);
49  inPath = Common::Path(inString);
50 }
51 void readFilenameArray(Common::SeekableReadStream &stream, Common::Array<Common::String> &inArray, uint num);
52 void readFilenameArray(Common::Serializer &stream, Common::Array<Common::String> &inArray, uint num, Common::Serializer::Version minVersion = 0, Common::Serializer::Version maxVersion = Common::Serializer::kLastVersion);
53 void readFilenameArray(Common::SeekableReadStream &stream, Common::Array<Common::Path> &inArray, uint num);
54 void readFilenameArray(Common::Serializer &stream, Common::Array<Common::Path> &inArray, uint num, Common::Serializer::Version minVersion = 0, Common::Serializer::Version maxVersion = Common::Serializer::kLastVersion);
55 
56 void assembleTextLine(char *rawCaption, Common::String &output, uint size);
57 
58 // Abstract base class used for loading data that would take too much time in a single frame
60 public:
61  DeferredLoader() {}
62  virtual ~DeferredLoader() {}
63 
64  // Calls loadInner() one or many times, until its allotted time is done
65  bool load(uint32 endTime);
66 
67 protected:
68  // Contains the actual loading logic, split up into tasks that are as small as possible
69  virtual bool loadInner() = 0;
70 };
71 
72 } // End of namespace Nancy
73 
74 #endif // NANCY_UTIL_H
Definition: str.h:59
Definition: rect.h:144
Definition: path.h:52
Definition: stream.h:745
Definition: serializer.h:79
Definition: util.h:59
Definition: actionmanager.h:32