forked from organicmaps/organicmaps
Names refactoring.
This commit is contained in:
parent
8a80ba3423
commit
3aa3ffe156
10 changed files with 68 additions and 68 deletions
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -97,7 +97,7 @@
|
|||
|
||||
- (void)logSearchQuery:(NSString *)query
|
||||
{
|
||||
m_client.Search([query UTF8String]);
|
||||
m_tracker.TrackSearch([query UTF8String]);
|
||||
}
|
||||
|
||||
@end
|
|
@ -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
|
||||
|
|
26
stats/client/event_tracker.cpp
Normal file
26
stats/client/event_tracker.cpp
Normal file
|
@ -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
|
21
stats/client/event_tracker.hpp
Normal file
21
stats/client/event_tracker.hpp
Normal file
|
@ -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
|
|
@ -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;
|
|
@ -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)
|
|
@ -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
|
|
@ -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
|
Loading…
Add table
Reference in a new issue