1/*
2 * Copyright 2006-2007, Haiku. All rights reserved.
3 * Distributed under the terms of the MIT License.
4 *
5 * Authors:
6 *		Stephan A��mus <superstippi@gmx.de>
7 */
8#ifndef FLAT_ICON_IMPORTER_H
9#define FLAT_ICON_IMPORTER_H
10
11
12#ifdef ICON_O_MATIC
13#	include "Importer.h"
14#else
15#	include <SupportDefs.h>
16#endif
17
18#include "Container.h"
19#include "IconBuild.h"
20
21
22class BMessage;
23class BPositionIO;
24
25
26_BEGIN_ICON_NAMESPACE
27
28
29class Icon;
30class LittleEndianBuffer;
31class PathContainer;
32class Shape;
33class Style;
34class VectorPath;
35
36#ifdef ICON_O_MATIC
37class FlatIconImporter : public Importer {
38#else
39class FlatIconImporter {
40#endif
41 public:
42								FlatIconImporter();
43	virtual						~FlatIconImporter();
44
45	// FlatIconImporter
46			status_t			Import(Icon* icon,
47									   BPositionIO* stream);
48
49			status_t			Import(Icon* icon,
50									   uint8* buffer, size_t size);
51
52 private:
53			status_t			_ParseSections(LittleEndianBuffer& buffer,
54											   Icon* icon);
55
56			status_t			_ParseStyles(LittleEndianBuffer& buffer,
57											 Container<Style>* styles);
58			status_t			_ParsePaths(LittleEndianBuffer& buffer,
59											Container<VectorPath>* paths);
60			Shape*				_ReadPathSourceShape(
61									LittleEndianBuffer& buffer,
62									Container<Style>* styles,
63									Container<VectorPath>* paths);
64			status_t			_ParseShapes(LittleEndianBuffer& buffer,
65											 Container<Style>* styles,
66											 Container<VectorPath>* paths,
67											 Container<Shape>* shapes);
68};
69
70
71_END_ICON_NAMESPACE
72
73
74#endif	// FLAT_ICON_IMPORTER_H
75