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/UserSettingsFileInfo.h> 8 9 #include <package/hpkg/PackageInfoAttributeValue.h> 10 11 12 namespace BPackageKit { 13 14 15 BUserSettingsFileInfo::BUserSettingsFileInfo() 16 : 17 fPath(), 18 fTemplatePath() 19 { 20 } 21 22 23 BUserSettingsFileInfo::BUserSettingsFileInfo( 24 const BHPKG::BUserSettingsFileInfoData& infoData) 25 : 26 fPath(infoData.path), 27 fTemplatePath(infoData.templatePath), 28 fIsDirectory(infoData.isDirectory) 29 { 30 } 31 32 33 BUserSettingsFileInfo::BUserSettingsFileInfo(const BString& path, 34 const BString& templatePath) 35 : 36 fPath(path), 37 fTemplatePath(templatePath), 38 fIsDirectory(false) 39 { 40 } 41 42 43 BUserSettingsFileInfo::BUserSettingsFileInfo(const BString& path, 44 bool isDirectory) 45 : 46 fPath(path), 47 fTemplatePath(), 48 fIsDirectory(isDirectory) 49 { 50 } 51 52 53 BUserSettingsFileInfo::~BUserSettingsFileInfo() 54 { 55 } 56 57 58 status_t 59 BUserSettingsFileInfo::InitCheck() const 60 { 61 return fPath.IsEmpty() ? B_NO_INIT : B_OK; 62 } 63 64 65 const BString& 66 BUserSettingsFileInfo::Path() const 67 { 68 return fPath; 69 } 70 71 72 const BString& 73 BUserSettingsFileInfo::TemplatePath() const 74 { 75 return fTemplatePath; 76 } 77 78 79 bool 80 BUserSettingsFileInfo::IsDirectory() const 81 { 82 return fIsDirectory; 83 } 84 85 86 void 87 BUserSettingsFileInfo::SetTo(const BString& path, const BString& templatePath) 88 { 89 fPath = path; 90 fTemplatePath = templatePath; 91 fIsDirectory = false; 92 } 93 94 95 void 96 BUserSettingsFileInfo::SetTo(const BString& path, bool isDirectory) 97 { 98 fPath = path; 99 fTemplatePath.Truncate(0); 100 fIsDirectory = isDirectory; 101 } 102 103 104 } // namespace BPackageKit 105