1 /* 2 * Copyright 2024, Andrew Lindesay <apl@lindesay.co.nz>. 3 * All rights reserved. Distributed under the terms of the MIT License. 4 */ 5 6 7 #include "PackageLocalizedText.h" 8 9 PackageLocalizedText()10PackageLocalizedText::PackageLocalizedText() 11 : 12 fTitle(), 13 fSummary(), 14 fDescription(), 15 fHasChangelog(false), 16 fChangelog() 17 { 18 } 19 20 PackageLocalizedText(const PackageLocalizedText & other)21PackageLocalizedText::PackageLocalizedText(const PackageLocalizedText& other) 22 : 23 fTitle(other.Title()), 24 fSummary(other.Summary()), 25 fDescription(other.Description()), 26 fHasChangelog(other.HasChangelog()), 27 fChangelog(other.Changelog()) 28 { 29 } 30 31 32 const BString& Title() const33PackageLocalizedText::Title() const 34 { 35 return fTitle; 36 } 37 38 39 void SetTitle(const BString & value)40PackageLocalizedText::SetTitle(const BString& value) 41 { 42 fTitle = value; 43 } 44 45 46 const BString& Summary() const47PackageLocalizedText::Summary() const 48 { 49 return fSummary; 50 } 51 52 53 void SetSummary(const BString & value)54PackageLocalizedText::SetSummary(const BString& value) 55 { 56 fSummary = value; 57 } 58 59 60 const BString& Description() const61PackageLocalizedText::Description() const 62 { 63 return fDescription; 64 } 65 66 67 void SetDescription(const BString & value)68PackageLocalizedText::SetDescription(const BString& value) 69 { 70 fDescription = value; 71 } 72 73 74 const bool HasChangelog() const75PackageLocalizedText::HasChangelog() const 76 { 77 return fHasChangelog; 78 } 79 80 81 void SetHasChangelog(bool value)82PackageLocalizedText::SetHasChangelog(bool value) 83 { 84 fHasChangelog = value; 85 86 if (!value) 87 SetChangelog(""); 88 } 89 90 91 void SetChangelog(const BString & value)92PackageLocalizedText::SetChangelog(const BString& value) 93 { 94 fChangelog = value; 95 fHasChangelog = !value.IsEmpty(); 96 } 97 98 99 const BString& Changelog() const100PackageLocalizedText::Changelog() const 101 { 102 return fChangelog; 103 } 104 105 106 bool operator ==(const PackageLocalizedText & other) const107PackageLocalizedText::operator==(const PackageLocalizedText& other) const 108 { 109 return fTitle == other.Title() && fSummary == other.Summary() 110 && fDescription == other.Description() && fHasChangelog == other.HasChangelog() 111 && fChangelog == other.Changelog(); 112 } 113 114 115 bool operator !=(const PackageLocalizedText & other) const116PackageLocalizedText::operator!=(const PackageLocalizedText& other) const 117 { 118 return !(*this == other); 119 } 120