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