diff options
author | Mike Buland <mbuland@penny-arcade.com> | 2021-09-27 08:04:28 -0700 |
---|---|---|
committer | Mike Buland <mbuland@penny-arcade.com> | 2021-09-27 08:04:28 -0700 |
commit | 7ebfdb3e7b71fdd315032adb0854e28f0073e1f7 (patch) | |
tree | a69ac57986342792cc76e2759091e855b3255ca8 /c++-libbu++/src/integer.cpp | |
parent | 701b05de4d2e79afd88ef8ddf93ba0fcc0eb5b14 (diff) | |
download | libgats-7ebfdb3e7b71fdd315032adb0854e28f0073e1f7.tar.gz libgats-7ebfdb3e7b71fdd315032adb0854e28f0073e1f7.tar.bz2 libgats-7ebfdb3e7b71fdd315032adb0854e28f0073e1f7.tar.xz libgats-7ebfdb3e7b71fdd315032adb0854e28f0073e1f7.zip |
Added explicit assignment/comparison operators.
Added = and == to all primitive types, not to the container types
(yet?).
Diffstat (limited to '')
-rw-r--r-- | c++-libbu++/src/integer.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/c++-libbu++/src/integer.cpp b/c++-libbu++/src/integer.cpp index f63dd37..1f10279 100644 --- a/c++-libbu++/src/integer.cpp +++ b/c++-libbu++/src/integer.cpp | |||
@@ -39,6 +39,28 @@ void Gats::Integer::read( Bu::Stream &rIn, char cType ) | |||
39 | readPackedInt( rIn, iVal ); | 39 | readPackedInt( rIn, iVal ); |
40 | } | 40 | } |
41 | 41 | ||
42 | Gats::Integer &Gats::Integer::operator=( const Gats::Integer &rhs ) | ||
43 | { | ||
44 | iVal = rhs.iVal; | ||
45 | return *this; | ||
46 | } | ||
47 | |||
48 | Gats::Integer &Gats::Integer::operator=( int64_t rhs ) | ||
49 | { | ||
50 | iVal = rhs; | ||
51 | return *this; | ||
52 | } | ||
53 | |||
54 | bool Gats::Integer::operator==( const Gats::Integer &rhs ) | ||
55 | { | ||
56 | return iVal == rhs.iVal; | ||
57 | } | ||
58 | |||
59 | bool Gats::Integer::operator==( int64_t rhs ) | ||
60 | { | ||
61 | return iVal == rhs; | ||
62 | } | ||
63 | |||
42 | Bu::Formatter &operator<<( Bu::Formatter &f, const Gats::Integer &i ) | 64 | Bu::Formatter &operator<<( Bu::Formatter &f, const Gats::Integer &i ) |
43 | { | 65 | { |
44 | return f << "(int) " << i.getValue(); | 66 | return f << "(int) " << i.getValue(); |