Skip to content

Commit

Permalink
Merge pull request #318 from ketoo/blueprint
Browse files Browse the repository at this point in the history
Blueprint
  • Loading branch information
ketoo committed Mar 28, 2021
2 parents 3126d2d + 3a47e93 commit 76c393a
Show file tree
Hide file tree
Showing 514 changed files with 22,251 additions and 10,005 deletions.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Expand Up @@ -108,8 +108,9 @@ elseif(${BUILD_MID_WARE_SDK} STREQUAL "ON")
message("Build SDK & MIDWARE")
add_subdirectory(Dependencies)
add_subdirectory(NFComm)
add_subdirectory(NFExamples)
add_subdirectory(NFServer)
add_subdirectory(Tutorial)
add_subdirectory(NFExamples)
add_subdirectory(../NFMidWare NFMidWare)
add_subdirectory(../NFComm/NFMessageDefineEx NFComm/NFMessageDefineEx)
add_subdirectory(../NFComm/NFServerEx NFComm/NFServerEx)
Expand Down
19 changes: 8 additions & 11 deletions Dependencies/build_dep.bat
@@ -1,23 +1,20 @@

git submodule update --init --recursive

rd /s /q vcpkg

git clone https://github.com/Microsoft/vcpkg.git
cd Dependencies

cd vcpkg

call .\bootstrap-vcpkg.bat
rm -rf vcpkg

vcpkg install libevent:x64-windows-static

vcpkg install protobuf:x64-windows-static
git clone https://github.com/ketoo/vcpkg_for_nf.git
rename vcpkg_for_nf vcpkg
cd vcpkg

::vcpkg install lua:x64-windows-static

vcpkg install sdl2:x64-windows-static
7z.exe x installed\x64-windows-static\debug\lib\libprotobufd.zip -oinstalled\x64-windows-static\debug\lib\
7z.exe x installed\x64-windows-static\lib\libprotobuf.rar -oinstalled\x64-windows-static\lib\

cd..
cd ..

xcopy vcpkg\installed\x64-windows-static\lib lib\Release\ /s /e /Y
xcopy vcpkg\installed\x64-windows-static\bin ..\_Out\Release\ /s /e /Y
Expand Down
35 changes: 35 additions & 0 deletions Dependencies/build_dep_with_source_code.bat
@@ -0,0 +1,35 @@

git submodule update --init --recursive

rd /s /q vcpkg

git clone https://github.com/Microsoft/vcpkg.git

cd vcpkg

call .\bootstrap-vcpkg.bat

vcpkg install libevent:x64-windows-static

vcpkg install protobuf:x64-windows-static

::vcpkg install lua:x64-windows-static

vcpkg install sdl2:x64-windows-static

cd..

xcopy vcpkg\installed\x64-windows-static\lib lib\Release\ /s /e /Y
xcopy vcpkg\installed\x64-windows-static\bin ..\_Out\Release\ /s /e /Y

xcopy vcpkg\installed\x64-windows-static\debug\lib lib\Debug\ /s /e /Y
xcopy vcpkg\installed\x64-windows-static\debug\bin ..\_Out\Debug\ /s /e /Y



xcopy vcpkg\installed\x64-windows-static\tools\protobuf\protoc.exe ..\NFComm\NFMessageDefine\ /s /e /Y




cd..
40 changes: 20 additions & 20 deletions Dependencies/common/http_util.hpp
Expand Up @@ -54,36 +54,36 @@ namespace http
};

using iequal_string_functor_t = iequal_string_functor<std::string>;
using iequal_string_view_functor_t = iequal_string_functor<string_view_t>;
using iequal_string_view_functor_t = iequal_string_functor<std::string_view>;

using ihash_string_view_functor_t = ihash_string_functor<string_view_t>;
using case_insensitive_multimap_view = std::unordered_multimap<string_view_t, string_view_t, ihash_string_view_functor_t, iequal_string_view_functor_t>;
using ihash_string_view_functor_t = ihash_string_functor<std::string_view>;
using case_insensitive_multimap_view = std::unordered_multimap<std::string_view, std::string_view, ihash_string_view_functor_t, iequal_string_view_functor_t>;

string_view_t readline(const char* data, size_t size, size_t& readpos)
std::string_view readline(const char* data, size_t size, size_t& readpos)
{
string_view_t strref(data + readpos, size);
std::string_view strref(data + readpos, size);
size_t pos = strref.find("\r\n");
if (pos != string_view_t::npos)
if (pos != std::string_view::npos)
{
readpos += (pos + 2);
return string_view_t(strref.data(), pos);
return std::string_view(strref.data(), pos);
}
pos = size;
readpos += pos;
return string_view_t(strref.data(), pos);
return std::string_view(strref.data(), pos);
}

class http_header {
public:
/// Parse header fields
static case_insensitive_multimap_view parse(string_view_t sv) noexcept {
static case_insensitive_multimap_view parse(std::string_view sv) noexcept {
case_insensitive_multimap_view result;
auto data = sv.data();
auto size = sv.size();
size_t rpos = 0;
string_view_t line = readline(data, size, rpos);
std::string_view line = readline(data, size, rpos);
size_t param_end = 0;
while ((param_end = line.find(':')) != string_view_t::npos) {
while ((param_end = line.find(':')) != std::string_view::npos) {
size_t value_start = param_end + 1;
if (value_start < line.size()) {
if (line[value_start] == ' ')
Expand All @@ -101,19 +101,19 @@ namespace http
{
public:
/// Parse request line and header fields
static bool parse(string_view_t sv, string_view_t& method, string_view_t& path, string_view_t& query_string, string_view_t& http_version, case_insensitive_multimap_view& header) noexcept
static bool parse(std::string_view sv, std::string_view& method, std::string_view& path, std::string_view& query_string, std::string_view& http_version, case_insensitive_multimap_view& header) noexcept
{
auto data = sv.data();
auto size = sv.size();
size_t rpos = 0;
string_view_t line = readline(data, size, rpos);
std::string_view line = readline(data, size, rpos);

size_t method_end;
if ((method_end = line.find(' ')) != string_view_t::npos)
if ((method_end = line.find(' ')) != std::string_view::npos)
{
method = line.substr(0, method_end);
size_t query_start = string_view_t::npos;
size_t path_and_query_string_end = string_view_t::npos;
size_t query_start = std::string_view::npos;
size_t path_and_query_string_end = std::string_view::npos;
for (size_t i = method_end + 1; i < line.size(); ++i)
{
if (line[i] == '?' && (i + 1) < line.size())
Expand All @@ -126,24 +126,24 @@ namespace http
break;
}
}
if (path_and_query_string_end != string_view_t::npos)
if (path_and_query_string_end != std::string_view::npos)
{
if (query_start != string_view_t::npos) {
if (query_start != std::string_view::npos) {
path = line.substr(method_end + 1, query_start - method_end - 2);
query_string = line.substr(query_start, path_and_query_string_end - query_start);
}
else
path = line.substr(method_end + 1, path_and_query_string_end - method_end - 1);
size_t protocol_end;
if ((protocol_end = line.find('/', path_and_query_string_end + 1)) != string_view_t::npos) {
if ((protocol_end = line.find('/', path_and_query_string_end + 1)) != std::string_view::npos) {
if (line.compare(path_and_query_string_end + 1, protocol_end - path_and_query_string_end - 1, "HTTP") != 0)
return false;
http_version = line.substr(protocol_end + 1, line.size() - protocol_end - 1);
}
else
return false;

header = http_header::parse(string_view_t{ data + rpos,size - rpos });
header = http_header::parse(std::string_view{ data + rpos,size - rpos });
}
else
return false;
Expand Down
181 changes: 0 additions & 181 deletions Dependencies/common/string_ref.hpp

This file was deleted.

1 change: 0 additions & 1 deletion NFComm/CMakeLists.txt
@@ -1,4 +1,3 @@
add_subdirectory(NFServer)
add_subdirectory(NFPluginLoader)
add_subdirectory(NFActorPlugin)
add_subdirectory(NFConfigPlugin)
Expand Down
2 changes: 1 addition & 1 deletion NFComm/NFActorPlugin/NFActor.cpp
Expand Up @@ -3,7 +3,7 @@
NoahFrame
https://github.com/ketoo/NoahGameFrame
Copyright 2009 - 2020 NoahFrame(NoahGameFrame)
Copyright 2009 - 2021 NoahFrame(NoahGameFrame)
File creator: lvsheng.huang
Expand Down
2 changes: 1 addition & 1 deletion NFComm/NFActorPlugin/NFActor.h
Expand Up @@ -3,7 +3,7 @@
NoahFrame
https://github.com/ketoo/NoahGameFrame
Copyright 2009 - 2020 NoahFrame(NoahGameFrame)
Copyright 2009 - 2021 NoahFrame(NoahGameFrame)
File creator: lvsheng.huang
Expand Down
2 changes: 1 addition & 1 deletion NFComm/NFActorPlugin/NFActorModule.cpp
Expand Up @@ -3,7 +3,7 @@
NoahFrame
https://github.com/ketoo/NoahGameFrame
Copyright 2009 - 2020 NoahFrame(NoahGameFrame)
Copyright 2009 - 2021 NoahFrame(NoahGameFrame)
File creator: lvsheng.huang
Expand Down

0 comments on commit 76c393a

Please sign in to comment.