xref: /haiku/src/add-ons/kernel/file_systems/packagefs/package/PackageDirectory.h (revision 6ec69f4426d9d171c683124d62cfbd7762a37f27)
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 			bool				HasPrecedenceOver(const PackageDirectory* other)
30 									const;
31 
32 private:
33 			PackageNodeList		fChildren;
34 };
35 
36 
37 PackageNode*
38 PackageDirectory::FirstChild() const
39 {
40 	return fChildren.First();
41 }
42 
43 
44 PackageNode*
45 PackageDirectory::NextChild(PackageNode* node) const
46 {
47 	return fChildren.GetNext(node);
48 }
49 
50 
51 typedef DoublyLinkedList<PackageDirectory> PackageDirectoryList;
52 
53 
54 #endif	// PACKAGE_DIRECTORY_H
55