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 BInstallationLocationInfo()16BInstallationLocationInfo::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 ~BInstallationLocationInfo()30BInstallationLocationInfo::~BInstallationLocationInfo() 31 { 32 } 33 34 35 void Unset()36BInstallationLocationInfo::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 Location() const50BInstallationLocationInfo::Location() const 51 { 52 return fLocation; 53 } 54 55 56 void SetLocation(BPackageInstallationLocation location)57BInstallationLocationInfo::SetLocation(BPackageInstallationLocation location) 58 { 59 fLocation = location; 60 } 61 62 63 const node_ref& BaseDirectoryRef() const64BInstallationLocationInfo::BaseDirectoryRef() const 65 { 66 return fBaseDirectoryRef; 67 } 68 69 70 status_t SetBaseDirectoryRef(const node_ref & ref)71BInstallationLocationInfo::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& PackagesDirectoryRef() const79BInstallationLocationInfo::PackagesDirectoryRef() const 80 { 81 return fPackageDirectoryRef; 82 } 83 84 85 status_t SetPackagesDirectoryRef(const node_ref & ref)86BInstallationLocationInfo::SetPackagesDirectoryRef(const node_ref& ref) 87 { 88 fPackageDirectoryRef = ref; 89 return fPackageDirectoryRef == ref ? B_OK : B_NO_MEMORY; 90 } 91 92 93 const BPackageInfoSet& LatestActivePackageInfos() const94BInstallationLocationInfo::LatestActivePackageInfos() const 95 { 96 return fLatestActivePackageInfos; 97 } 98 99 100 void SetLatestActivePackageInfos(const BPackageInfoSet & infos)101BInstallationLocationInfo::SetLatestActivePackageInfos( 102 const BPackageInfoSet& infos) 103 { 104 fLatestActivePackageInfos = infos; 105 } 106 107 108 const BPackageInfoSet& LatestInactivePackageInfos() const109BInstallationLocationInfo::LatestInactivePackageInfos() const 110 { 111 return fLatestInactivePackageInfos; 112 } 113 114 115 void SetLatestInactivePackageInfos(const BPackageInfoSet & infos)116BInstallationLocationInfo::SetLatestInactivePackageInfos( 117 const BPackageInfoSet& infos) 118 { 119 fLatestInactivePackageInfos = infos; 120 } 121 122 123 const BPackageInfoSet& CurrentlyActivePackageInfos() const124BInstallationLocationInfo::CurrentlyActivePackageInfos() const 125 { 126 return fCurrentlyActivePackageInfos; 127 } 128 129 130 void SetCurrentlyActivePackageInfos(const BPackageInfoSet & infos)131BInstallationLocationInfo::SetCurrentlyActivePackageInfos( 132 const BPackageInfoSet& infos) 133 { 134 fCurrentlyActivePackageInfos = infos; 135 } 136 137 138 const BString& OldStateName() const139BInstallationLocationInfo::OldStateName() const 140 { 141 return fOldStateName; 142 } 143 144 145 void SetOldStateName(const BString & name)146BInstallationLocationInfo::SetOldStateName(const BString& name) 147 { 148 fOldStateName = name; 149 } 150 151 152 int64 ChangeCount() const153BInstallationLocationInfo::ChangeCount() const 154 { 155 return fChangeCount; 156 } 157 158 159 void SetChangeCount(int64 changeCount)160BInstallationLocationInfo::SetChangeCount(int64 changeCount) 161 { 162 fChangeCount = changeCount; 163 } 164 165 166 } // namespace BPackageKit 167