1 /* 2 * Copyright 2013-2014, Stephan Aßmus <superstippi@gmx.de>. 3 * Copyright 2016-2024, Andrew Lindesay <apl@lindesay.co.nz>. 4 * All rights reserved. Distributed under the terms of the MIT License. 5 */ 6 #ifndef USER_RATING_H 7 #define USER_RATING_H 8 9 10 #include <Referenceable.h> 11 12 #include "UserInfo.h" 13 14 15 class UserRating : public BReferenceable { 16 public: 17 UserRating(); 18 UserRating(const UserInfo& userInfo, 19 float rating, 20 const BString& comment, 21 const BString& languageId, 22 const BString& packageVersion, 23 uint64 createTimestamp); 24 UserRating(const UserRating& other); 25 26 UserRating& operator=(const UserRating& other); 27 bool operator==(const UserRating& other) const; 28 bool operator!=(const UserRating& other) const; 29 30 const UserInfo& User() const 31 { return fUserInfo; } 32 const BString& Comment() const 33 { return fComment; } 34 const BString& LanguageId() const 35 { return fLanguageId; } 36 const float Rating() const 37 { return fRating; } 38 const BString& PackageVersion() const 39 { return fPackageVersion; } 40 const uint64 CreateTimestamp() const 41 { return fCreateTimestamp; } 42 private: 43 UserInfo fUserInfo; 44 float fRating; 45 BString fComment; 46 BString fLanguageId; 47 BString fPackageVersion; 48 uint64 fCreateTimestamp; 49 // milliseconds since epoch 50 }; 51 52 53 typedef BReference<UserRating> UserRatingRef; 54 55 56 #endif // USER_RATING_H 57