aboutsummaryrefslogtreecommitdiff
path: root/src/data
diff options
context:
space:
mode:
authorLibravatar buttercat1791 <mjjurkoic@gmail.com>2024-05-31 08:36:07 -0500
committerLibravatar buttercat1791 <mjjurkoic@gmail.com>2024-05-31 08:36:07 -0500
commit308840a3a3d80616e5a61bebbcdebb6d8ad99c66 (patch)
treece12f499bd19d81278f22cfe05d440bdc2b134a5 /src/data
parentc070fcbdebc237eae47f37fe7f2f50004b9010af (diff)
Use namespaces in definition files
Diffstat (limited to 'src/data')
-rw-r--r--src/data/event.cpp13
-rw-r--r--src/data/filters.cpp5
2 files changed, 10 insertions, 8 deletions
diff --git a/src/data/event.cpp b/src/data/event.cpp
index bd37ee7..e275f31 100644
--- a/src/data/event.cpp
+++ b/src/data/event.cpp
@@ -4,9 +4,10 @@
#include "data/data.hpp"
using namespace nlohmann;
+using namespace nostr::data;
using namespace std;
-string nostr::data::Event::serialize()
+string Event::serialize()
{
try
{
@@ -30,7 +31,7 @@ string nostr::data::Event::serialize()
return j.dump();
};
-nostr::data::Event nostr::data::Event::fromString(string jstr)
+Event Event::fromString(string jstr)
{
json j = json::parse(jstr);
Event event;
@@ -47,7 +48,7 @@ nostr::data::Event nostr::data::Event::fromString(string jstr)
return event;
};
-nostr::data::Event nostr::data::Event::fromJson(json j)
+Event Event::fromJson(json j)
{
Event event;
@@ -68,7 +69,7 @@ nostr::data::Event nostr::data::Event::fromJson(json j)
return event;
};
-void nostr::data::Event::validate()
+void Event::validate()
{
bool hasPubkey = this->pubkey.length() > 0;
if (!hasPubkey)
@@ -89,7 +90,7 @@ void nostr::data::Event::validate()
}
};
-string nostr::data::Event::generateId(string serializedData) const
+string Event::generateId(string serializedData) const
{
unsigned char hash[SHA256_DIGEST_LENGTH];
EVP_Digest(serializedData.c_str(), serializedData.length(), hash, NULL, EVP_sha256(), NULL);
@@ -103,7 +104,7 @@ string nostr::data::Event::generateId(string serializedData) const
return ss.str();
};
-bool nostr::data::Event::operator==(const Event& other) const
+bool Event::operator==(const Event& other) const
{
if (this->id.empty())
{
diff --git a/src/data/filters.cpp b/src/data/filters.cpp
index e345c95..11c099b 100644
--- a/src/data/filters.cpp
+++ b/src/data/filters.cpp
@@ -3,9 +3,10 @@
#include "data/data.hpp"
using namespace nlohmann;
+using namespace nostr::data;
using namespace std;
-string nostr::data::Filters::serialize(string& subscriptionId)
+string Filters::serialize(string& subscriptionId)
{
try
{
@@ -38,7 +39,7 @@ string nostr::data::Filters::serialize(string& subscriptionId)
return jarr.dump();
};
-void nostr::data::Filters::validate()
+void Filters::validate()
{
bool hasLimit = this->limit > 0;
if (!hasLimit)