xref: /haiku/src/apps/haikudepot/packagemodel/UserRating.cpp (revision 82bfaa954dcfd90582fb2c1a0e918971eea57091)
1 /*
2  * Copyright 2013-2014, Stephan Aßmus <superstippi@gmx.de>.
3  * Copyright 2013, Rene Gollent <rene@gollent.com>.
4  * Copyright 2016-2023, 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 	fLanguage(),
18 	fPackageVersion(),
19 	fCreateTimestamp(0)
20 {
21 }
22 
23 
24 UserRating::UserRating(const UserInfo& userInfo, float rating,
25 	const BString& comment, const BString& language,
26 	const BString& packageVersion, uint64 createTimestamp)
27 	:
28 	fUserInfo(userInfo),
29 	fRating(rating),
30 	fComment(comment),
31 	fLanguage(language),
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 	fLanguage(other.fLanguage),
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 	fLanguage = other.fLanguage;
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 		&& fLanguage == other.fLanguage
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