1 /* 2 * Copyright 2013-2014, Stephan Aßmus <superstippi@gmx.de>. 3 * Copyright 2013, Rene Gollent <rene@gollent.com>. 4 * Copyright 2016-2024, Andrew Lindesay <apl@lindesay.co.nz>. 5 * All rights reserved. Distributed under the terms of the MIT License. 6 */ 7 8 9 #include "UserRating.h" 10 11 12 UserRating::UserRating() 13 : 14 fUserInfo(), 15 fRating(0.0f), 16 fComment(), 17 fLanguageId(), 18 fPackageVersion(), 19 fCreateTimestamp(0) 20 { 21 } 22 23 24 UserRating::UserRating(const UserInfo& userInfo, float rating, 25 const BString& comment, const BString& languageId, 26 const BString& packageVersion, uint64 createTimestamp) 27 : 28 fUserInfo(userInfo), 29 fRating(rating), 30 fComment(comment), 31 fLanguageId(languageId), 32 fPackageVersion(packageVersion), 33 fCreateTimestamp(createTimestamp) 34 { 35 } 36 37 38 UserRating::UserRating(const UserRating& other) 39 : 40 fUserInfo(other.fUserInfo), 41 fRating(other.fRating), 42 fComment(other.fComment), 43 fLanguageId(other.fLanguageId), 44 fPackageVersion(other.fPackageVersion), 45 fCreateTimestamp(other.fCreateTimestamp) 46 { 47 } 48 49 50 UserRating& 51 UserRating::operator=(const UserRating& other) 52 { 53 fUserInfo = other.fUserInfo; 54 fRating = other.fRating; 55 fComment = other.fComment; 56 fLanguageId = other.fLanguageId; 57 fPackageVersion = other.fPackageVersion; 58 fCreateTimestamp = other.fCreateTimestamp; 59 return *this; 60 } 61 62 63 bool 64 UserRating::operator==(const UserRating& other) const 65 { 66 return fUserInfo == other.fUserInfo 67 && fRating == other.fRating 68 && fComment == other.fComment 69 && fLanguageId == other.fLanguageId 70 && fPackageVersion == other.fPackageVersion 71 && fCreateTimestamp == other.fCreateTimestamp; 72 } 73 74 75 bool 76 UserRating::operator!=(const UserRating& other) const 77 { 78 return !(*this == other); 79 } 80