vfs: check userland buffers before reading them.
[haiku.git] / src / libs / icon / flat_icon / FlatIconImporter.h
blob1beea22bbbdcb2f051dab2515db087df6cdf3fed
1 /*
2 * Copyright 2006-2007, Haiku. All rights reserved.
3 * Distributed under the terms of the MIT License.
5 * Authors:
6 * Stephan Aßmus <superstippi@gmx.de>
7 */
8 #ifndef FLAT_ICON_IMPORTER_H
9 #define FLAT_ICON_IMPORTER_H
12 #ifdef ICON_O_MATIC
13 # include "Importer.h"
14 #else
15 # include <SupportDefs.h>
16 #endif
18 #include "IconBuild.h"
21 class BMessage;
22 class BPositionIO;
25 _BEGIN_ICON_NAMESPACE
28 class Icon;
29 class LittleEndianBuffer;
30 class PathContainer;
31 class Shape;
32 class ShapeContainer;
33 class StyleContainer;
35 #ifdef ICON_O_MATIC
36 class FlatIconImporter : public Importer {
37 #else
38 class FlatIconImporter {
39 #endif
40 public:
41 FlatIconImporter();
42 virtual ~FlatIconImporter();
44 // FlatIconImporter
45 status_t Import(Icon* icon,
46 BPositionIO* stream);
48 status_t Import(Icon* icon,
49 uint8* buffer, size_t size);
51 private:
52 status_t _ParseSections(LittleEndianBuffer& buffer,
53 Icon* icon);
55 status_t _ParseStyles(LittleEndianBuffer& buffer,
56 StyleContainer* styles);
57 status_t _ParsePaths(LittleEndianBuffer& buffer,
58 PathContainer* paths);
59 Shape* _ReadPathSourceShape(
60 LittleEndianBuffer& buffer,
61 StyleContainer* styles,
62 PathContainer* paths);
63 status_t _ParseShapes(LittleEndianBuffer& buffer,
64 StyleContainer* styles,
65 PathContainer* paths,
66 ShapeContainer* shapes);
70 _END_ICON_NAMESPACE
73 #endif // FLAT_ICON_IMPORTER_H