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