diff --git a/examples/proto_debuger/loger.cpp b/examples/proto_debuger/loger.cpp index 520bc61c..a654368d 100644 --- a/examples/proto_debuger/loger.cpp +++ b/examples/proto_debuger/loger.cpp @@ -51,9 +51,9 @@ int _C_Loger::Debug(string dat,string function,int line){ return 0; } -void _C_Loger::operator<<(const string& wb){ +void _C_Loger::operator<<(const string& wb) { // 还没有过天 - if(getTimeDate() == this->mCurrentDate){ + if(getTimeDate() == this->mCurrentDate) { string tmp = getTime(); tmp += ":"; tmp += wb; @@ -80,17 +80,15 @@ void _C_Loger::operator<<(const string& wb){ bool file_existed(string path) { fstream _file; _file.open(path.c_str(),ios::in); - if(!_file) - { + if(!_file) { return false; } - else - { + else { _file.close(); return true; } } -_C_Loger::_C_Loger(FILE *p){ +_C_Loger::_C_Loger(FILE *p) { this->mFile = p; this->mCurrentDate = getTime(); } diff --git a/examples/proto_debuger/lua_wraper.cpp b/examples/proto_debuger/lua_wraper.cpp index 198c4c5e..6115854f 100644 --- a/examples/proto_debuger/lua_wraper.cpp +++ b/examples/proto_debuger/lua_wraper.cpp @@ -5,8 +5,7 @@ void LuaDelegate::Stop() } -int LuaDelegate::DoString(std::string scr) -{ +int LuaDelegate::DoString(std::string scr) { if (mVM != nullptr){ int ret = luaL_dostring(mVM,scr.c_str()); if (ret > 0){ @@ -18,20 +17,19 @@ int LuaDelegate::DoString(std::string scr) return 0; } -int LuaDelegate::UpdateScript(std::string scr) -{ +int LuaDelegate::UpdateScript(std::string scr) { if(nullptr != mVM){ lua_close(mVM); } free(mVM); mVM = luaL_newstate(); //打开lua - if(nullptr != mVM){ + if(nullptr != mVM) { printf("shit is nullptr"); } for (auto x : mFunc) { lua_register(mVM, x.first.c_str(), x.second); } - if (mVM != nullptr){ + if (mVM != nullptr) { int ret = luaL_dostring(mVM,scr.c_str()); if (ret > 0){ printf("lua error"); @@ -42,12 +40,11 @@ int LuaDelegate::UpdateScript(std::string scr) return 0; } -void LuaDelegate::PrintError(lua_State *L) -{ +void LuaDelegate::PrintError(lua_State *L) { std::cout<<"\nFATAL ERROR:%s\n\n"<< lua_tostring(L, -1); } -void LuaDelegate::OnSerialData(std::string data){ +void LuaDelegate::OnSerialData(std::string data) { int i = lua_getglobal(mVM,"OnDataReady"); if(i == 0) return; @@ -56,7 +53,6 @@ void LuaDelegate::OnSerialData(std::string data){ } - void LuaDelegate::DumpStack() { static int count = 0;