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 static void* operator new(size_t size); 18 static void operator delete(void* block); 19 20 PackageDirectory(Package* package, mode_t mode); 21 virtual ~PackageDirectory(); 22 23 void AddChild(PackageNode* node); 24 void RemoveChild(PackageNode* node); 25 26 inline PackageNode* FirstChild() const; 27 inline PackageNode* NextChild(PackageNode* node) const; 28 29 const PackageNodeList& Children() const 30 { return fChildren; } 31 32 bool HasPrecedenceOver(const PackageDirectory* other) 33 const; 34 35 private: 36 PackageNodeList fChildren; 37 }; 38 39 40 PackageNode* 41 PackageDirectory::FirstChild() const 42 { 43 return fChildren.First(); 44 } 45 46 47 PackageNode* 48 PackageDirectory::NextChild(PackageNode* node) const 49 { 50 return fChildren.GetNext(node); 51 } 52 53 54 typedef DoublyLinkedList<PackageDirectory> PackageDirectoryList; 55 56 57 #endif // PACKAGE_DIRECTORY_H 58