1 /* 2 * Copyright 2011, Ingo Weinhold, ingo_weinhold@gmx.de. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef RESOLVABLE_H 6 #define RESOLVABLE_H 7 8 9 #include <Referenceable.h> 10 11 #include <util/DoublyLinkedList.h> 12 13 #include "Dependency.h" 14 15 16 class Package; 17 class ResolvableFamily; 18 class Version; 19 20 21 class Resolvable : public BReferenceable, 22 public DoublyLinkedListLinkImpl<Resolvable> { 23 public: 24 Resolvable(::Package* package); 25 virtual ~Resolvable(); 26 27 status_t Init(const char* name, ::Version* version, 28 ::Version* compatibleVersion); 29 // version and compatibleVersion are 30 // optional; object takes over ownership 31 // (even in case of error) 32 Package()33 ::Package* Package() const { return fPackage; } 34 SetFamily(ResolvableFamily * family)35 void SetFamily(ResolvableFamily* family) 36 { fFamily = family; } Family()37 ResolvableFamily* Family() const 38 { return fFamily; } 39 Name()40 const String& Name() const { return fName; } Version()41 ::Version* Version() const { return fVersion; } CompatibleVersion()42 ::Version* CompatibleVersion() const 43 { return fCompatibleVersion; } 44 45 void AddDependency(Dependency* dependency); 46 void RemoveDependency(Dependency* dependency); 47 void MoveDependencies( 48 ResolvableDependencyList& dependencies); 49 50 private: 51 ::Package* fPackage; 52 ResolvableFamily* fFamily; 53 String fName; 54 ::Version* fVersion; 55 ::Version* fCompatibleVersion; 56 ResolvableDependencyList fDependencies; 57 58 public: // conceptually package private 59 DoublyLinkedListLink<Resolvable> fFamilyListLink; 60 }; 61 62 63 typedef DoublyLinkedList<Resolvable> ResolvableList; 64 65 typedef DoublyLinkedList<Resolvable, 66 DoublyLinkedListMemberGetLink<Resolvable, 67 &Resolvable::fFamilyListLink> > FamilyResolvableList; 68 69 70 #endif // RESOLVABLE_H 71