1*4489c88bSIngo Weinhold /*
2*4489c88bSIngo Weinhold * Copyright 2013, Ingo Weinhold, ingo_weinhold@gmx.de.
3*4489c88bSIngo Weinhold * Distributed under the terms of the MIT License.
4*4489c88bSIngo Weinhold */
5*4489c88bSIngo Weinhold
6*4489c88bSIngo Weinhold
7*4489c88bSIngo Weinhold #include <package/GlobalWritableFileInfo.h>
8*4489c88bSIngo Weinhold
9*4489c88bSIngo Weinhold #include <package/hpkg/PackageInfoAttributeValue.h>
10*4489c88bSIngo Weinhold
11*4489c88bSIngo Weinhold
12*4489c88bSIngo Weinhold namespace BPackageKit {
13*4489c88bSIngo Weinhold
14*4489c88bSIngo Weinhold
BGlobalWritableFileInfo()15*4489c88bSIngo Weinhold BGlobalWritableFileInfo::BGlobalWritableFileInfo()
16*4489c88bSIngo Weinhold :
17*4489c88bSIngo Weinhold fPath(),
18*4489c88bSIngo Weinhold fUpdateType(B_WRITABLE_FILE_UPDATE_TYPE_ENUM_COUNT)
19*4489c88bSIngo Weinhold {
20*4489c88bSIngo Weinhold }
21*4489c88bSIngo Weinhold
22*4489c88bSIngo Weinhold
BGlobalWritableFileInfo(const BHPKG::BGlobalWritableFileInfoData & infoData)23*4489c88bSIngo Weinhold BGlobalWritableFileInfo::BGlobalWritableFileInfo(
24*4489c88bSIngo Weinhold const BHPKG::BGlobalWritableFileInfoData& infoData)
25*4489c88bSIngo Weinhold :
26*4489c88bSIngo Weinhold fPath(infoData.path),
27*4489c88bSIngo Weinhold fUpdateType(infoData.updateType),
28*4489c88bSIngo Weinhold fIsDirectory(infoData.isDirectory)
29*4489c88bSIngo Weinhold {
30*4489c88bSIngo Weinhold }
31*4489c88bSIngo Weinhold
32*4489c88bSIngo Weinhold
BGlobalWritableFileInfo(const BString & path,BWritableFileUpdateType updateType,bool isDirectory)33*4489c88bSIngo Weinhold BGlobalWritableFileInfo::BGlobalWritableFileInfo(const BString& path,
34*4489c88bSIngo Weinhold BWritableFileUpdateType updateType, bool isDirectory)
35*4489c88bSIngo Weinhold :
36*4489c88bSIngo Weinhold fPath(path),
37*4489c88bSIngo Weinhold fUpdateType(updateType),
38*4489c88bSIngo Weinhold fIsDirectory(isDirectory)
39*4489c88bSIngo Weinhold {
40*4489c88bSIngo Weinhold }
41*4489c88bSIngo Weinhold
42*4489c88bSIngo Weinhold
~BGlobalWritableFileInfo()43*4489c88bSIngo Weinhold BGlobalWritableFileInfo::~BGlobalWritableFileInfo()
44*4489c88bSIngo Weinhold {
45*4489c88bSIngo Weinhold }
46*4489c88bSIngo Weinhold
47*4489c88bSIngo Weinhold
48*4489c88bSIngo Weinhold status_t
InitCheck() const49*4489c88bSIngo Weinhold BGlobalWritableFileInfo::InitCheck() const
50*4489c88bSIngo Weinhold {
51*4489c88bSIngo Weinhold if (fPath.IsEmpty())
52*4489c88bSIngo Weinhold return B_NO_INIT;
53*4489c88bSIngo Weinhold return B_OK;
54*4489c88bSIngo Weinhold }
55*4489c88bSIngo Weinhold
56*4489c88bSIngo Weinhold
57*4489c88bSIngo Weinhold const BString&
Path() const58*4489c88bSIngo Weinhold BGlobalWritableFileInfo::Path() const
59*4489c88bSIngo Weinhold {
60*4489c88bSIngo Weinhold return fPath;
61*4489c88bSIngo Weinhold }
62*4489c88bSIngo Weinhold
63*4489c88bSIngo Weinhold
64*4489c88bSIngo Weinhold bool
IsIncluded() const65*4489c88bSIngo Weinhold BGlobalWritableFileInfo::IsIncluded() const
66*4489c88bSIngo Weinhold {
67*4489c88bSIngo Weinhold return fUpdateType != B_WRITABLE_FILE_UPDATE_TYPE_ENUM_COUNT;
68*4489c88bSIngo Weinhold }
69*4489c88bSIngo Weinhold
70*4489c88bSIngo Weinhold
71*4489c88bSIngo Weinhold BWritableFileUpdateType
UpdateType() const72*4489c88bSIngo Weinhold BGlobalWritableFileInfo::UpdateType() const
73*4489c88bSIngo Weinhold {
74*4489c88bSIngo Weinhold return fUpdateType;
75*4489c88bSIngo Weinhold }
76*4489c88bSIngo Weinhold
77*4489c88bSIngo Weinhold
78*4489c88bSIngo Weinhold bool
IsDirectory() const79*4489c88bSIngo Weinhold BGlobalWritableFileInfo::IsDirectory() const
80*4489c88bSIngo Weinhold {
81*4489c88bSIngo Weinhold return fIsDirectory;
82*4489c88bSIngo Weinhold }
83*4489c88bSIngo Weinhold
84*4489c88bSIngo Weinhold
85*4489c88bSIngo Weinhold void
SetTo(const BString & path,BWritableFileUpdateType updateType,bool isDirectory)86*4489c88bSIngo Weinhold BGlobalWritableFileInfo::SetTo(const BString& path,
87*4489c88bSIngo Weinhold BWritableFileUpdateType updateType, bool isDirectory)
88*4489c88bSIngo Weinhold {
89*4489c88bSIngo Weinhold fPath = path;
90*4489c88bSIngo Weinhold fUpdateType = updateType;
91*4489c88bSIngo Weinhold fIsDirectory = isDirectory;
92*4489c88bSIngo Weinhold }
93*4489c88bSIngo Weinhold
94*4489c88bSIngo Weinhold
95*4489c88bSIngo Weinhold } // namespace BPackageKit
96