diff options
author | Dmitry Kunin <dkunin@mapswith.me> | 2013-12-20 13:33:56 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 02:09:09 +0300 |
commit | 3aa3ffe156f73fb5f9508a37d759d5395f6e5288 (patch) | |
tree | 5cd5a0ebb8f12fc3e1e67bddbd9a0c408e732847 | |
parent | 8a80ba34236dc0a6cea112a02c805d662177afac (diff) |
Names refactoring.
-rw-r--r-- | android/jni/com/mapswithme/maps/StatsClient.cpp | 14 | ||||
-rw-r--r-- | iphone/Maps/Statistics/Statistics.h | 4 | ||||
-rw-r--r-- | iphone/Maps/Statistics/Statistics.mm | 2 | ||||
-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 |
10 files changed, 68 insertions, 68 deletions
diff --git a/android/jni/com/mapswithme/maps/StatsClient.cpp b/android/jni/com/mapswithme/maps/StatsClient.cpp index 283861d66d..59f8ac90d8 100644 --- a/android/jni/com/mapswithme/maps/StatsClient.cpp +++ b/android/jni/com/mapswithme/maps/StatsClient.cpp @@ -1,20 +1,20 @@ -#include "../../../../../stats/client/stats_client.hpp" +#include "../../../../../stats/client/event_tracker.hpp" #include "../core/jni_helper.hpp" extern "C" { - static stats::Client * g_client = 0; + static stats::EventTracker * g_nativeTracker = 0; - stats::Client * NativeStat() + stats::EventTracker * NativeTracker() { - if (!g_client) - g_client = new stats::Client(); - return g_client; + if (!g_nativeTracker) + g_nativeTracker = new stats::EventTracker(); + return g_nativeTracker; } JNIEXPORT jboolean JNICALL Java_com_mapswithme_util_StatsClient_trackSearchQuery(JNIEnv * env, jclass clazz, jstring query) { - return NativeStat()->Search(jni::ToNativeString(env, query)); + return NativeTracker()->TrackSearch(jni::ToNativeString(env, query)); } } diff --git a/iphone/Maps/Statistics/Statistics.h b/iphone/Maps/Statistics/Statistics.h index d72cc75c14..0d8b9abb34 100644 --- a/iphone/Maps/Statistics/Statistics.h +++ b/iphone/Maps/Statistics/Statistics.h @@ -1,10 +1,10 @@ #import <Foundation/Foundation.h> -#include "../../stats/client/stats_client.hpp" +#include "../../stats/client/event_tracker.hpp" @interface Statistics : NSObject { - stats::Client m_client; + stats::EventTracker m_tracker; } - (void)startSession; diff --git a/iphone/Maps/Statistics/Statistics.mm b/iphone/Maps/Statistics/Statistics.mm index c0f9744923..a71a50b952 100644 --- a/iphone/Maps/Statistics/Statistics.mm +++ b/iphone/Maps/Statistics/Statistics.mm @@ -97,7 +97,7 @@ - (void)logSearchQuery:(NSString *)query { - m_client.Search([query UTF8String]); + m_tracker.TrackSearch([query UTF8String]); } @end
\ No newline at end of file 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 |