diff options
Diffstat (limited to 'stats')
-rw-r--r-- | stats/client/client.pro | 8 | ||||
-rw-r--r-- | stats/client/event_tracker.cpp | 26 | ||||
-rw-r--r-- | stats/client/event_tracker.hpp | 21 | ||||
-rw-r--r-- | stats/client/event_writer.cpp (renamed from stats/client/stats_writer.cpp) | 8 | ||||
-rw-r--r-- | stats/client/event_writer.hpp (renamed from stats/client/stats_writer.hpp) | 6 | ||||
-rw-r--r-- | stats/client/stats_client.cpp | 26 | ||||
-rw-r--r-- | stats/client/stats_client.hpp | 21 |
7 files changed, 58 insertions, 58 deletions
diff --git a/stats/client/client.pro b/stats/client/client.pro index c0910d46fe..6bc96e8a8e 100644 --- a/stats/client/client.pro +++ b/stats/client/client.pro @@ -11,13 +11,13 @@ INCLUDEPATH += $$ROOT_DIR/3party/protobuf/src DEPENDENCIES = base protobuf SOURCES += \ - stats_client.cpp \ - stats_writer.cpp \ ../common/wire.pb.cc \ + event_tracker.cpp \ + event_writer.cpp HEADERS += \ - stats_client.hpp \ - stats_writer.hpp \ ../common/wire.pb.h \ + event_tracker.hpp \ + event_writer.hpp OTHER_FILES += ../common/wire.proto diff --git a/stats/client/event_tracker.cpp b/stats/client/event_tracker.cpp new file mode 100644 index 0000000000..ae63626b07 --- /dev/null +++ b/stats/client/event_tracker.cpp @@ -0,0 +1,26 @@ +#include "event_tracker.hpp" +#include "event_writer.hpp" + +#include "../common/wire.pb.h" + +namespace stats +{ + +EventTracker::EventTracker() + : m_writer(new EventWriter(GetPlatform().UniqueClientId(), GetPlatform().WritableDir() + "stats")) +{ +} + +EventTracker::~EventTracker() +{ + delete m_writer; +} + +bool EventTracker::TrackSearch(string const & query) +{ + class Search s; + s.set_query(query); + return m_writer->Write(s); +} + +} // namespace stats diff --git a/stats/client/event_tracker.hpp b/stats/client/event_tracker.hpp new file mode 100644 index 0000000000..2d138774a1 --- /dev/null +++ b/stats/client/event_tracker.hpp @@ -0,0 +1,21 @@ +#pragma once + +#include "../../platform/platform.hpp" + +namespace stats +{ + +class EventWriter; + +class EventTracker +{ +public: + EventTracker(); + ~EventTracker(); + bool TrackSearch(string const & query); + +private: + EventWriter * m_writer; +}; + +} // namespace stats diff --git a/stats/client/stats_writer.cpp b/stats/client/event_writer.cpp index 94e4286b05..83d5ff8c83 100644 --- a/stats/client/stats_writer.cpp +++ b/stats/client/event_writer.cpp @@ -1,4 +1,4 @@ -#include "stats_writer.hpp" +#include "event_writer.hpp" #include "../../base/string_format.hpp" @@ -7,18 +7,18 @@ namespace stats { -StatsWriter::StatsWriter(string const & uniqueClientId, string const & dbPath) +EventWriter::EventWriter(string const & uniqueClientId, string const & dbPath) : m_cnt(0), m_db(0), m_path(dbPath), m_uid(0) { } -bool StatsWriter::Store(const Event & e) +bool EventWriter::Store(const Event & e) { // @todo add impl return false; } -bool StatsWriter::OpenDb(string const & path) +bool EventWriter::OpenDb(string const & path) { // @todo add impl return false; diff --git a/stats/client/stats_writer.hpp b/stats/client/event_writer.hpp index 388a6cfaf3..b0b192130c 100644 --- a/stats/client/stats_writer.hpp +++ b/stats/client/event_writer.hpp @@ -7,14 +7,14 @@ namespace stats { -class StatsWriter +class EventWriter { public: - StatsWriter(string const & uniqueClientId, string const & dbPath); + EventWriter(string const & uniqueClientId, string const & dbPath); bool Store(Event const & e); - ~StatsWriter() {} + ~EventWriter() {} template<class T> bool Write(T const & m) diff --git a/stats/client/stats_client.cpp b/stats/client/stats_client.cpp deleted file mode 100644 index d0858090aa..0000000000 --- a/stats/client/stats_client.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#include "stats_client.hpp" -#include "stats_writer.hpp" - -#include "../common/wire.pb.h" - -namespace stats -{ - -Client::Client() - : m_writer(new StatsWriter(GetPlatform().UniqueClientId(), GetPlatform().WritableDir() + "stats")) -{ -} - -Client::~Client() -{ - delete m_writer; -} - -bool Client::Search(string const & query) -{ - class Search s; - s.set_query(query); - return m_writer->Write(s); -} - -} // namespace stats diff --git a/stats/client/stats_client.hpp b/stats/client/stats_client.hpp deleted file mode 100644 index c313c78c5c..0000000000 --- a/stats/client/stats_client.hpp +++ /dev/null @@ -1,21 +0,0 @@ -#pragma once - -#include "../../platform/platform.hpp" - -namespace stats -{ - -class StatsWriter; - -class Client -{ -public: - Client(); - ~Client(); - bool Search(string const & query); - -private: - StatsWriter * m_writer; -}; - -} // namespace stats |