xref: /haiku/src/add-ons/kernel/file_systems/packagefs/package/PackageDirectory.h (revision 83b1a68c52ba3e0e8796282759f694b7fdddf06d)
1 /*
2  * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef PACKAGE_DIRECTORY_H
6 #define PACKAGE_DIRECTORY_H
7 
8 
9 #include <util/DoublyLinkedList.h>
10 
11 #include "PackageNode.h"
12 
13 
14 class PackageDirectory : public PackageNode,
15 	public DoublyLinkedListLinkImpl<PackageDirectory> {
16 public:
17 								PackageDirectory(Package* package, mode_t mode);
18 	virtual						~PackageDirectory();
19 
20 			void				AddChild(PackageNode* node);
21 			void				RemoveChild(PackageNode* node);
22 
23 	inline	PackageNode*		FirstChild() const;
24 	inline	PackageNode*		NextChild(PackageNode* node) const;
25 
26 			const PackageNodeList& Children() const
27 									{ return fChildren; }
28 
29 private:
30 			PackageNodeList		fChildren;
31 };
32 
33 
34 PackageNode*
35 PackageDirectory::FirstChild() const
36 {
37 	return fChildren.First();
38 }
39 
40 
41 PackageNode*
42 PackageDirectory::NextChild(PackageNode* node) const
43 {
44 	return fChildren.GetNext(node);
45 }
46 
47 
48 typedef DoublyLinkedList<PackageDirectory> PackageDirectoryList;
49 
50 
51 #endif	// PACKAGE_DIRECTORY_H
52