vfs: check userland buffers before reading them.
[haiku.git] / src / libs / icon / shape / PathContainer.h
blob8177e03083f0938cc9c45856dca6e5ccf0883a4e
1 /*
2 * Copyright 2006-2007, Haiku.
3 * Distributed under the terms of the MIT License.
5 * Authors:
6 * Stephan Aßmus <superstippi@gmx.de>
7 */
8 #ifndef PATH_CONTAINER_H
9 #define PATH_CONTAINER_H
12 #include <List.h>
14 #include "IconBuild.h"
17 _BEGIN_ICON_NAMESPACE
20 class VectorPath;
22 #ifdef ICON_O_MATIC
23 class PathContainerListener {
24 public:
25 PathContainerListener();
26 virtual ~PathContainerListener();
28 virtual void PathAdded(VectorPath* path, int32 index) = 0;
29 virtual void PathRemoved(VectorPath* path) = 0;
31 #endif // ICON_O_MATIC
33 class PathContainer {
34 public:
35 PathContainer(bool ownsPaths);
36 virtual ~PathContainer();
38 bool AddPath(VectorPath* path);
39 bool AddPath(VectorPath* path, int32 index);
40 bool RemovePath(VectorPath* path);
41 VectorPath* RemovePath(int32 index);
43 void MakeEmpty();
45 int32 CountPaths() const;
46 bool HasPath(VectorPath* path) const;
47 int32 IndexOf(VectorPath* path) const;
49 VectorPath* PathAt(int32 index) const;
50 VectorPath* PathAtFast(int32 index) const;
52 private:
53 void _MakeEmpty();
55 BList fPaths;
56 bool fOwnsPaths;
58 #ifdef ICON_O_MATIC
59 public:
60 bool AddListener(PathContainerListener* listener);
61 bool RemoveListener(PathContainerListener* listener);
63 private:
64 void _NotifyPathAdded(VectorPath* path,
65 int32 index) const;
66 void _NotifyPathRemoved(VectorPath* path) const;
68 BList fListeners;
69 #endif // ICON_O_MATIC
73 _END_ICON_NAMESPACE
76 #endif // PATH_CONTAINER_H