1 /* 2 * Copyright 2013-2014, 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 fLatestActivePackageInfos(), 22 fLatestInactivePackageInfos(), 23 fCurrentlyActivePackageInfos(), 24 fOldStateName(), 25 fChangeCount(0) 26 { 27 } 28 29 30 BInstallationLocationInfo::~BInstallationLocationInfo() 31 { 32 } 33 34 35 void 36 BInstallationLocationInfo::Unset() 37 { 38 fLocation = B_PACKAGE_INSTALLATION_LOCATION_ENUM_COUNT; 39 fBaseDirectoryRef = node_ref(); 40 fPackageDirectoryRef = node_ref(); 41 fLatestActivePackageInfos.MakeEmpty(); 42 fLatestInactivePackageInfos.MakeEmpty(); 43 fCurrentlyActivePackageInfos.MakeEmpty(); 44 fOldStateName.Truncate(0); 45 fChangeCount = 0; 46 } 47 48 49 BPackageInstallationLocation 50 BInstallationLocationInfo::Location() const 51 { 52 return fLocation; 53 } 54 55 56 void 57 BInstallationLocationInfo::SetLocation(BPackageInstallationLocation location) 58 { 59 fLocation = location; 60 } 61 62 63 const node_ref& 64 BInstallationLocationInfo::BaseDirectoryRef() const 65 { 66 return fBaseDirectoryRef; 67 } 68 69 70 status_t 71 BInstallationLocationInfo::SetBaseDirectoryRef(const node_ref& ref) 72 { 73 fBaseDirectoryRef = ref; 74 return fBaseDirectoryRef == ref ? B_OK : B_NO_MEMORY; 75 } 76 77 78 const node_ref& 79 BInstallationLocationInfo::PackagesDirectoryRef() const 80 { 81 return fPackageDirectoryRef; 82 } 83 84 85 status_t 86 BInstallationLocationInfo::SetPackagesDirectoryRef(const node_ref& ref) 87 { 88 fPackageDirectoryRef = ref; 89 return fPackageDirectoryRef == ref ? B_OK : B_NO_MEMORY; 90 } 91 92 93 const BPackageInfoSet& 94 BInstallationLocationInfo::LatestActivePackageInfos() const 95 { 96 return fLatestActivePackageInfos; 97 } 98 99 100 void 101 BInstallationLocationInfo::SetLatestActivePackageInfos( 102 const BPackageInfoSet& infos) 103 { 104 fLatestActivePackageInfos = infos; 105 } 106 107 108 const BPackageInfoSet& 109 BInstallationLocationInfo::LatestInactivePackageInfos() const 110 { 111 return fLatestInactivePackageInfos; 112 } 113 114 115 void 116 BInstallationLocationInfo::SetLatestInactivePackageInfos( 117 const BPackageInfoSet& infos) 118 { 119 fLatestInactivePackageInfos = infos; 120 } 121 122 123 const BPackageInfoSet& 124 BInstallationLocationInfo::CurrentlyActivePackageInfos() const 125 { 126 return fCurrentlyActivePackageInfos; 127 } 128 129 130 void 131 BInstallationLocationInfo::SetCurrentlyActivePackageInfos( 132 const BPackageInfoSet& infos) 133 { 134 fCurrentlyActivePackageInfos = infos; 135 } 136 137 138 const BString& 139 BInstallationLocationInfo::OldStateName() const 140 { 141 return fOldStateName; 142 } 143 144 145 void 146 BInstallationLocationInfo::SetOldStateName(const BString& name) 147 { 148 fOldStateName = name; 149 } 150 151 152 int64 153 BInstallationLocationInfo::ChangeCount() const 154 { 155 return fChangeCount; 156 } 157 158 159 void 160 BInstallationLocationInfo::SetChangeCount(int64 changeCount) 161 { 162 fChangeCount = changeCount; 163 } 164 165 166 } // namespace BPackageKit 167