Compare commits
2 Commits
78f79d92aa
...
dfdc4b8bdc
| Author | SHA1 | Date | |
|---|---|---|---|
| dfdc4b8bdc | |||
| 8a61cfe7ef |
@@ -1,5 +1,8 @@
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
cmake_minimum_required(VERSION 3.13)
|
||||
cmake_policy(SET CMP0017 NEW) # need include() with .cmake
|
||||
if (POLICY CMP0177)
|
||||
cmake_policy(SET CMP0177 OLD)
|
||||
endif()
|
||||
project(PIP)
|
||||
set(PIP_MAJOR 4)
|
||||
set(PIP_MINOR 7)
|
||||
@@ -13,7 +16,7 @@ if (NOT DEFINED SHSTKPROJECT)
|
||||
set(ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/cmake-download/CMakeLists.txt"
|
||||
"# This file was generated by PIP CMake, don`t edit it!
|
||||
cmake_minimum_required(VERSION 2.8.2)
|
||||
cmake_minimum_required(VERSION 3.13)
|
||||
project(cmake-download NONE)
|
||||
include(ExternalProject)
|
||||
ExternalProject_Add(cmake
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include "pihttpconstants.h"
|
||||
#include "pip_export.h"
|
||||
#include "pistring.h"
|
||||
#include "pistringlist.h"
|
||||
|
||||
|
||||
namespace PIHTTP {
|
||||
@@ -14,6 +14,7 @@ public:
|
||||
PIHTTP::Method method() const { return m_method; }
|
||||
PIHTTP::Code code() const { return m_code; }
|
||||
const PIString & path() const { return m_path; }
|
||||
PIStringList pathList() const { return m_path.split('/').removeAll({}); }
|
||||
const PIByteArray & body() const { return m_body; }
|
||||
const PIMap<PIString, PIString> & headers() const { return m_headers; }
|
||||
const PIMap<PIString, PIString> & arguments() const { return m_arguments; }
|
||||
|
||||
@@ -13,7 +13,16 @@ public:
|
||||
using RequestFunction = std::function<PIHTTP::MessageMutable(const PIHTTP::MessageConst &)>;
|
||||
|
||||
void registerPath(const PIString & path, PIHTTP::Method method, RequestFunction functor);
|
||||
template<typename T>
|
||||
void
|
||||
registerPath(const PIString & path, PIHTTP::Method method, T * o, PIHTTP::MessageMutable (T::*function)(const PIHTTP::MessageConst &)) {
|
||||
registerPath(path, method, [o, function](const PIHTTP::MessageConst & m) { return (o->*function)(m); });
|
||||
}
|
||||
void registerUnhandled(RequestFunction functor);
|
||||
template<typename T>
|
||||
void registerUnhandled(T * o, PIHTTP::MessageMutable (T::*function)(const PIHTTP::MessageConst &)) {
|
||||
registerUnhandled([o, function](const PIHTTP::MessageConst & m) { return (o->*function)(m); });
|
||||
}
|
||||
void unregisterPath(const PIString & path, PIHTTP::Method method);
|
||||
void unregisterPath(const PIString & path);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user