1 /* 2 * Copyright 2013, Haiku, Inc. All Rights Reserved. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Ingo Weinhold <ingo_weinhold@gmx.de> 7 */ 8 9 10 #include <package/InstallationLocationInfo.h> 11 12 13 namespace BPackageKit { 14 15 16 BInstallationLocationInfo::BInstallationLocationInfo() 17 : 18 fLocation(B_PACKAGE_INSTALLATION_LOCATION_ENUM_COUNT), 19 fBaseDirectoryRef(), 20 fPackageDirectoryRef(), 21 fActivePackageInfos(), 22 fInactivePackageInfos(), 23 fChangeCount(0) 24 { 25 } 26 27 28 BInstallationLocationInfo::~BInstallationLocationInfo() 29 { 30 } 31 32 33 void 34 BInstallationLocationInfo::Unset() 35 { 36 fLocation = B_PACKAGE_INSTALLATION_LOCATION_ENUM_COUNT; 37 fBaseDirectoryRef = node_ref(); 38 fPackageDirectoryRef = node_ref(); 39 fActivePackageInfos.MakeEmpty(); 40 fInactivePackageInfos.MakeEmpty(); 41 fChangeCount = 0; 42 } 43 44 45 BPackageInstallationLocation 46 BInstallationLocationInfo::Location() const 47 { 48 return fLocation; 49 } 50 51 52 void 53 BInstallationLocationInfo::SetLocation(BPackageInstallationLocation location) 54 { 55 fLocation = location; 56 } 57 58 59 const node_ref& 60 BInstallationLocationInfo::BaseDirectoryRef() const 61 { 62 return fBaseDirectoryRef; 63 } 64 65 66 status_t 67 BInstallationLocationInfo::SetBaseDirectoryRef(const node_ref& ref) 68 { 69 fBaseDirectoryRef = ref; 70 return fBaseDirectoryRef == ref ? B_OK : B_NO_MEMORY; 71 } 72 73 74 const node_ref& 75 BInstallationLocationInfo::PackagesDirectoryRef() const 76 { 77 return fPackageDirectoryRef; 78 } 79 80 81 status_t 82 BInstallationLocationInfo::SetPackagesDirectoryRef(const node_ref& ref) 83 { 84 fPackageDirectoryRef = ref; 85 return fPackageDirectoryRef == ref ? B_OK : B_NO_MEMORY; 86 } 87 88 89 const BPackageInfoSet& 90 BInstallationLocationInfo::ActivePackageInfos() const 91 { 92 return fActivePackageInfos; 93 } 94 95 96 void 97 BInstallationLocationInfo::SetActivePackageInfos(const BPackageInfoSet& infos) 98 { 99 fActivePackageInfos = infos; 100 } 101 102 103 const BPackageInfoSet& 104 BInstallationLocationInfo::InactivePackageInfos() const 105 { 106 return fInactivePackageInfos; 107 } 108 109 110 void 111 BInstallationLocationInfo::SetInactivePackageInfos(const BPackageInfoSet& infos) 112 { 113 fInactivePackageInfos = infos; 114 } 115 116 117 int64 118 BInstallationLocationInfo::ChangeCount() const 119 { 120 return fChangeCount; 121 } 122 123 124 void 125 BInstallationLocationInfo::SetChangeCount(int64 changeCount) 126 { 127 fChangeCount = changeCount; 128 } 129 130 131 } // namespace BPackageKit 132