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/array.h"
25 #include "common/path.h"
26 #include "common/rect.h"
27 #include "common/serializer.h"
28 
29 namespace Nancy {
30 
31 void readRect(Common::SeekableReadStream &stream, Common::Rect &inRect);
32 void readRect(Common::Serializer &stream, Common::Rect &inRect, Common::Serializer::Version minVersion = 0, Common::Serializer::Version maxVersion = Common::Serializer::kLastVersion);
33 void readRectArray(Common::SeekableReadStream &stream, Common::Array<Common::Rect> &inArray, uint num, uint totalNum = 0);
34 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);
35 
36 void readRect16(Common::SeekableReadStream &stream, Common::Rect &inRect);
37 void readRect16(Common::Serializer &stream, Common::Rect &inRect, Common::Serializer::Version minVersion = 0, Common::Serializer::Version maxVersion = Common::Serializer::kLastVersion);
38 void readRectArray16(Common::SeekableReadStream &stream, Common::Array<Common::Rect> &inArray, uint num, uint totalNum = 0);
39 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);
40 
41 void readFilename(Common::SeekableReadStream &stream, Common::String &inString);
42 void readFilename(Common::Serializer &stream, Common::String &inString, Common::Serializer::Version minVersion = 0, Common::Serializer::Version maxVersion = Common::Serializer::kLastVersion);
43 inline void readFilename(Common::SeekableReadStream &stream, Common::Path &inPath) {
44  Common::String inString;
45  readFilename(stream, inString);
46  inPath = Common::Path(inString);
47 }
48 inline void readFilename(Common::Serializer &stream, Common::Path &inPath, Common::Serializer::Version minVersion = 0, Common::Serializer::Version maxVersion = Common::Serializer::kLastVersion) {
49  Common::String inString;
50  readFilename(stream, inString, minVersion, maxVersion);
51  inPath = Common::Path(inString);
52 }
53 void readFilenameArray(Common::SeekableReadStream &stream, Common::Array<Common::String> &inArray, uint num);
54 void readFilenameArray(Common::Serializer &stream, Common::Array<Common::String> &inArray, uint num, Common::Serializer::Version minVersion = 0, Common::Serializer::Version maxVersion = Common::Serializer::kLastVersion);
55 void readFilenameArray(Common::SeekableReadStream &stream, Common::Array<Common::Path> &inArray, uint num);
56 void readFilenameArray(Common::Serializer &stream, Common::Array<Common::Path> &inArray, uint num, Common::Serializer::Version minVersion = 0, Common::Serializer::Version maxVersion = Common::Serializer::kLastVersion);
57 
58 void assembleTextLine(char *rawCaption, Common::String &output, uint size);
59 
60 // Abstract base class used for loading data that would take too much time in a single frame
62 public:
63  DeferredLoader() {}
64  virtual ~DeferredLoader() {}
65 
66  // Calls loadInner() one or many times, until its allotted time is done
67  bool load(uint32 endTime);
68 
69 protected:
70  // Contains the actual loading logic, split up into tasks that are as small as possible
71  virtual bool loadInner() = 0;
72 };
73 
74 } // End of namespace Nancy
75 
76 #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:61
Definition: actionmanager.h:32