1 /* 2 * Copyright 2013, 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/solver/SolverPackage.h> 11 12 13 namespace BPackageKit { 14 15 16 BSolverPackage::BSolverPackage(BSolverRepository* repository, 17 const BPackageInfo& packageInfo) 18 : 19 fRepository(repository), 20 fInfo(packageInfo) 21 { 22 } 23 24 25 BSolverPackage::BSolverPackage(const BSolverPackage& other) 26 : 27 fRepository(other.fRepository), 28 fInfo(other.fInfo) 29 { 30 } 31 32 33 BSolverPackage::~BSolverPackage() 34 { 35 } 36 37 38 BSolverRepository* 39 BSolverPackage::Repository() const 40 { 41 return fRepository; 42 } 43 44 45 const BPackageInfo& 46 BSolverPackage::Info() const 47 { 48 return fInfo; 49 } 50 51 52 BString 53 BSolverPackage::Name() const 54 { 55 return fInfo.Name(); 56 } 57 58 59 BString 60 BSolverPackage::VersionedName() const 61 { 62 if (fInfo.Version().InitCheck() != B_OK) 63 return Name(); 64 BString result = Name(); 65 return result << '-' << fInfo.Version().ToString(); 66 } 67 68 69 const BPackageVersion& 70 BSolverPackage::Version() const 71 { 72 return fInfo.Version(); 73 } 74 75 76 BSolverPackage& 77 BSolverPackage::operator=(const BSolverPackage& other) 78 { 79 fRepository = other.fRepository; 80 fInfo = other.fInfo; 81 return *this; 82 } 83 84 85 } // namespace BPackageKit 86