diff options
Diffstat (limited to 'src/event.cpp')
-rw-r--r-- | src/event.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/event.cpp b/src/event.cpp index 7b5bfb2..347065c 100644 --- a/src/event.cpp +++ b/src/event.cpp @@ -125,4 +125,18 @@ string Event::generateId(string serializedData) const return ss.str(); }; + +bool Event::operator==(const Event& other) const +{ + if (this->id.empty()) + { + throw invalid_argument("Event::operator==: Cannot check equality, the left-side argument is undefined."); + } + if (other.id.empty()) + { + throw invalid_argument("Event::operator==: Cannot check equality, the right-side argument is undefined."); + } + + return this->id == other.id; +}; } // namespace nostr |