添加f8命名空间

This commit is contained in:
aozhiwei 2018-11-26 21:09:20 +08:00
parent 51f7f26e4f
commit 83cf86548e
14 changed files with 1256 additions and 1212 deletions

View File

@ -1,5 +1,7 @@
#include "framework/cpp/dynmodule.h"
namespace f8
{
DynModule::DynModule()
{
}
@ -39,3 +41,5 @@ void DynModule::CancelPending()
module_state_.pending = false;
}
}

View File

@ -1,5 +1,7 @@
#pragma once
namespace f8
{
struct DynModuleState
{
bool pending = false;
@ -22,3 +24,5 @@ class DynModule
DynModuleState module_state_;
};
}

View File

@ -6,8 +6,11 @@
#include "framework/cpp/protoutils.h"
#include "framework/cpp/netmsghandler.h"
namespace f8
{
NetMsgHandler* GetNetMsgHandler(NetMsgHandlerObject* handlers,
unsigned short msgid)
{
return msgid < MAX_MSG_ID ? handlers->handlers[msgid] : nullptr;
}
}

View File

@ -7,6 +7,8 @@
#include <google/protobuf/extension_set.h>
#include <google/protobuf/unknown_field_set.h>
namespace f8
{
const unsigned short MAX_MSG_ID = 2000;
struct MsgHdr;
@ -46,7 +48,7 @@ static void RegisterNetMsgHandler(NetMsgHandlerObject* msghandler,
)
{
MsgType dumy_msg;
static int msgid = ::Net_GetMessageId(dumy_msg);
static int msgid = f8::Net_GetMessageId(dumy_msg);
assert(msgid >= 0 || msgid < MAX_MSG_ID);
if (msgid < 0 || msgid >= MAX_MSG_ID) {
abort();
@ -85,5 +87,5 @@ static bool ProcessNetMsg(NetMsgHandler* handler,
NetMsgHandler* GetNetMsgHandler(NetMsgHandlerObject* handlers,
unsigned short msgid);
}
#endif

View File

@ -8,6 +8,8 @@
#include <google/protobuf/message.h>
#include <google/protobuf/descriptor.h>
namespace f8
{
int Net_GetMessageId(::google::protobuf::Message& msg)
{
std::string msgname;
@ -173,3 +175,4 @@ int Net_SendProxyMsg(a8::TcpListener* tcp_listener, int socket_handle, unsigned
free(buff);
return sizeof(WSProxyPackHead_S) + packlen;
}
}

View File

@ -1,5 +1,22 @@
#pragma once
class Player;
namespace google
{
namespace protobuf
{
class Message;
}
}
namespace a8
{
class TcpClient;
class TcpListener;
}
namespace f8
{
//普通消息头部
struct PackHead
{
@ -45,7 +62,6 @@ struct WSProxyPackHead_S
unsigned short reserved;
};
class Player;
struct MsgHdr
{
unsigned int seqid;
@ -61,20 +77,6 @@ struct MsgHdr
const unsigned short MAGIC_CODE = (((unsigned short)'S') << 8) | ((unsigned short)'K');
namespace google
{
namespace protobuf
{
class Message;
}
}
namespace a8
{
class TcpClient;
class TcpListener;
}
int Net_GetMessageId(::google::protobuf::Message& msg);
void Net_PackMsg(unsigned short msgid, ::google::protobuf::Message& msg, std::string& out);
@ -91,3 +93,4 @@ int Net_SendProxyCMsg(a8::TcpClient* tcp_client, unsigned short msgid, ::google:
int Net_SendProxyMsg(a8::TcpListener* tcp_tlistener, int socket_handle, unsigned int seqid, unsigned short error_code,
unsigned short msgid, ::google::protobuf::Message& msg);
}

View File

@ -4,6 +4,8 @@
#include "scriptengine.h"
namespace f8
{
void ScriptEngine::Init()
{
engine_ = new a8::PyEngine();
@ -86,3 +88,4 @@ std::tuple<bool, a8::XValue> ScriptEngine::CallModuleFunc(const char* module_nam
}
return ret;
}
}

View File

@ -5,6 +5,8 @@ namespace a8
class PyEngine;
};
namespace f8
{
class ScriptEngine : public a8::Singleton<ScriptEngine>
{
private:
@ -28,3 +30,5 @@ class ScriptEngine : public a8::Singleton<ScriptEngine>
a8::PyEngine *engine_ = nullptr;
};
}

View File

@ -7,6 +7,8 @@
#include <a8/mutable_xobject.h>
#include "tglog.h"
namespace f8
{
static const char* const TGLOG_ROOT = "/data/logs/%s/upload/";
static const char* const POLY_TGLOG_ROOT = "/data/logs/%s/%s/upload/";
static const char* const TGLOG_FILENAME = "log_$pid_%Y%m%d%H.log";
@ -193,3 +195,4 @@ void TGLog::SaveToFileThreadProc()
}
}
}

View File

@ -1,5 +1,7 @@
#pragma once
namespace f8
{
struct TGLogImpl;
class TGLog : public a8::Singleton<TGLog>
{
@ -23,3 +25,4 @@ public:
bool is_poly_log_ = false;
TGLogImpl* impl_ = nullptr;
};
}

View File

@ -3,6 +3,8 @@
#include <a8/stringlist.h>
#include "framework/cpp/tiledmap.h"
namespace f8
{
a8::XValue TiledObject::GetProperty(const std::string& prop_name)
{
auto itr = prop_hash.find(prop_name);
@ -458,3 +460,4 @@ void TiledMap::SetGridCellSpeedByAreaId(std::map<int,int>& area_speed_hash)
}
}
}
}

View File

@ -1,5 +1,7 @@
#pragma once
namespace f8
{
class TiledObject
{
public:
@ -85,3 +87,4 @@ class TiledMap
std::map<std::string, std::vector<GridCell>> grid_cell_hash; //key 11|2 坐标
};
}

View File

@ -9,6 +9,8 @@
#include "framework/cpp/utils.h"
namespace f8
{
bool ReadCsvMetaFile(const std::string& filename,
google::protobuf::Message* prototype,
std::function<void (google::protobuf::Message*)> push_back_func)
@ -175,3 +177,4 @@ int ExtractChannelIdFromAccountId(const std::string& accountid)
std::string gameid = strings[1];
return a8::XValue(channelid);
}
}

View File

@ -17,6 +17,8 @@ namespace a8
}
}
namespace f8
{
bool ReadCsvMetaFile(const std::string& filename,
google::protobuf::Message* prototype,
std::function<void (google::protobuf::Message*)> push_back_func);
@ -82,3 +84,4 @@ time_t ExtractRegisterTimeFromSessionId(const std::string& sessionid);
bool IsValidSessionId(const std::string& accountid, const std::string& sessionid);
int ExtractGameIdFromAccountId(const std::string& accountid);
int ExtractChannelIdFromAccountId(const std::string& accountid);
}