Showing preview only (2,954K chars total). Download the full file or copy to clipboard to get everything.
Repository: d2school/da4qi4
Branch: master
Commit: 9dfb8902427d
Files: 224
Total size: 2.8 MB
Directory structure:
gitextract_s01djq4q/
├── .gitignore
├── CMakeLists.txt
├── LICENSE
├── README.md
├── cmake_install.cmake
├── da4qi4.astylerc
├── include/
│ └── daqi/
│ ├── application.hpp
│ ├── client/
│ │ └── connection_client.hpp
│ ├── connection.hpp
│ ├── context.hpp
│ ├── cookie.hpp
│ ├── da4qi4.hpp
│ ├── def/
│ │ ├── asio_def.hpp
│ │ ├── boost_def.hpp
│ │ ├── debug_def.hpp
│ │ ├── def.hpp
│ │ ├── inja_def.hpp
│ │ ├── json_def.hpp
│ │ ├── log_def.hpp
│ │ └── redis_def.hpp
│ ├── handler.hpp
│ ├── intercepter.hpp
│ ├── intercepters/
│ │ ├── session_redis.hpp
│ │ └── static_file.hpp
│ ├── net-detail/
│ │ ├── net_detail_client.hpp
│ │ └── net_detail_server.hpp
│ ├── redis-client/
│ │ ├── redis_buffer.hpp
│ │ ├── redis_client.hpp
│ │ ├── redis_command.hpp
│ │ ├── redis_parser.hpp
│ │ └── redis_value.hpp
│ ├── rediscli_pool.hpp
│ ├── request.hpp
│ ├── response.hpp
│ ├── router.hpp
│ ├── server.hpp
│ ├── server_engine.hpp
│ ├── session.hpp
│ ├── templates.hpp
│ ├── url.hpp
│ ├── utilities/
│ │ ├── asio_utilities.hpp
│ │ ├── base64_utilities.hpp
│ │ ├── container_utilities.hpp
│ │ ├── des3_utilities.hpp
│ │ ├── encoding_utilities.hpp
│ │ ├── file_utilities.hpp
│ │ ├── hmac_sha1_utilities.hpp
│ │ ├── html_utilities.hpp
│ │ ├── http_utilities.hpp
│ │ ├── md5_utilities.hpp
│ │ └── string_utilities.hpp
│ └── websocket/
│ ├── connection_websocket.hpp
│ ├── context_websocket.hpp
│ ├── frame_websocket.hpp
│ ├── handler_websocket.hpp
│ └── websocket.hpp
├── inja/
│ ├── bytecode.hpp
│ ├── config.hpp
│ ├── environment.hpp
│ ├── function_storage.hpp
│ ├── inja.hpp
│ ├── lexer.hpp
│ ├── parser.hpp
│ ├── polyfill.hpp
│ ├── renderer.hpp
│ ├── string_view.hpp
│ ├── template.hpp
│ ├── token.hpp
│ └── utils.hpp
├── llhttp/
│ ├── CMakeLists.txt
│ ├── LICENSE-MIT
│ ├── README.md
│ ├── api.c
│ ├── helper/
│ │ ├── http_status_def.h
│ │ ├── http_url_def.c
│ │ └── http_url_def.h
│ ├── http.c
│ ├── llhttp.c
│ └── llhttp.h
├── multipart-parser/
│ ├── .gitignore
│ ├── CMakeLists.txt
│ ├── README.md
│ ├── multipart_parser.c
│ └── multipart_parser.h
├── nlohmann_json/
│ ├── .github/
│ │ ├── CONTRIBUTING.md
│ │ ├── ISSUE_TEMPLATE/
│ │ │ ├── Bug_report.md
│ │ │ └── Feature_request.md
│ │ ├── PULL_REQUEST_TEMPLATE.md
│ │ ├── config.yml
│ │ └── stale.yml
│ ├── .travis.yml
│ ├── CMakeLists.txt
│ ├── CODE_OF_CONDUCT.md
│ ├── ChangeLog.md
│ ├── LICENSE.MIT
│ ├── Makefile
│ ├── README.md
│ ├── appveyor.yml
│ ├── cmake/
│ │ └── config.cmake.in
│ ├── include/
│ │ └── nlohmann/
│ │ ├── adl_serializer.hpp
│ │ ├── detail/
│ │ │ ├── conversions/
│ │ │ │ ├── from_json.hpp
│ │ │ │ ├── to_chars.hpp
│ │ │ │ └── to_json.hpp
│ │ │ ├── exceptions.hpp
│ │ │ ├── input/
│ │ │ │ ├── binary_reader.hpp
│ │ │ │ ├── input_adapters.hpp
│ │ │ │ ├── json_sax.hpp
│ │ │ │ ├── lexer.hpp
│ │ │ │ ├── parser.hpp
│ │ │ │ └── position_t.hpp
│ │ │ ├── iterators/
│ │ │ │ ├── internal_iterator.hpp
│ │ │ │ ├── iter_impl.hpp
│ │ │ │ ├── iteration_proxy.hpp
│ │ │ │ ├── iterator_traits.hpp
│ │ │ │ ├── json_reverse_iterator.hpp
│ │ │ │ └── primitive_iterator.hpp
│ │ │ ├── json_pointer.hpp
│ │ │ ├── json_ref.hpp
│ │ │ ├── macro_scope.hpp
│ │ │ ├── macro_unscope.hpp
│ │ │ ├── meta/
│ │ │ │ ├── cpp_future.hpp
│ │ │ │ ├── detected.hpp
│ │ │ │ ├── is_sax.hpp
│ │ │ │ ├── type_traits.hpp
│ │ │ │ └── void_t.hpp
│ │ │ ├── output/
│ │ │ │ ├── binary_writer.hpp
│ │ │ │ ├── output_adapters.hpp
│ │ │ │ └── serializer.hpp
│ │ │ └── value_t.hpp
│ │ ├── json.hpp
│ │ └── json_fwd.hpp
│ ├── meson.build
│ ├── nlohmann_json.natvis
│ └── single_include/
│ └── nlohmann/
│ └── json.hpp
├── spdlog/
│ ├── async_logger.h
│ ├── common.h
│ ├── contrib/
│ │ ├── README.md
│ │ └── sinks/
│ │ ├── .gitignore
│ │ └── step_file_sink.h
│ ├── details/
│ │ ├── async_log_helper.h
│ │ ├── async_logger_impl.h
│ │ ├── file_helper.h
│ │ ├── log_msg.h
│ │ ├── logger_impl.h
│ │ ├── mpmc_blocking_q.h
│ │ ├── null_mutex.h
│ │ ├── os.h
│ │ ├── pattern_formatter_impl.h
│ │ ├── registry.h
│ │ └── spdlog_impl.h
│ ├── fmt/
│ │ ├── bundled/
│ │ │ ├── LICENSE.rst
│ │ │ ├── format.cc
│ │ │ ├── format.h
│ │ │ ├── ostream.cc
│ │ │ ├── ostream.h
│ │ │ ├── posix.cc
│ │ │ ├── posix.h
│ │ │ ├── printf.cc
│ │ │ ├── printf.h
│ │ │ └── time.h
│ │ ├── fmt.h
│ │ └── ostr.h
│ ├── formatter.h
│ ├── logger.h
│ ├── sinks/
│ │ ├── android_sink.h
│ │ ├── ansicolor_sink.h
│ │ ├── base_sink.h
│ │ ├── dist_sink.h
│ │ ├── file_sinks.h
│ │ ├── msvc_sink.h
│ │ ├── null_sink.h
│ │ ├── ostream_sink.h
│ │ ├── sink.h
│ │ ├── stdout_sinks.h
│ │ ├── syslog_sink.h
│ │ ├── wincolor_sink.h
│ │ └── windebug_sink.h
│ ├── spdlog.h
│ └── tweakme.h
└── src/
├── application.cpp
├── client/
│ └── connection_client.cpp
├── connection.cpp
├── context.cpp
├── cookie.cpp
├── def/
│ ├── boost_def.cpp
│ ├── def.cpp
│ ├── json_def.cpp
│ ├── log_def.cpp
│ └── redis_def.cpp
├── handler.cpp
├── intercepter.cpp
├── intercepters/
│ ├── session_redis.cpp
│ └── static_file.cpp
├── main_demo.cpp
├── net-detail/
│ ├── net_detail_client.cpp
│ └── net_detail_server.cpp
├── redis-client/
│ ├── redis_buffer.cpp
│ ├── redis_client.cpp
│ ├── redis_command.cpp
│ ├── redis_parser.cpp
│ └── redis_value.cpp
├── rediscli_pool.cpp
├── request.cpp
├── response.cpp
├── router.cpp
├── server.cpp
├── server_engine.cpp
├── session.cpp
├── templates.cpp
├── url.cpp
├── utilities/
│ ├── asio_utilities.cpp
│ ├── base64_utilities.cpp
│ ├── des3_utilities.cpp
│ ├── encoding_utilities.cpp
│ ├── file_utilities.cpp
│ ├── hmac_sha1_utilities.cpp
│ ├── html_utilities.cpp
│ ├── http_utilities.cpp
│ ├── md5_utilities.cpp
│ └── string_utilities.cpp
└── websocket/
├── connection_websocket.cpp
├── context_websocket.cpp
├── frame_websocket.cpp
└── handler_websocket.cpp
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitignore
================================================
# Prerequisites
*.d
# Compiled Object files
*.slo
*.lo
*.o
*.obj
# Precompiled Headers
*.gch
*.pch
# Compiled Dynamic libraries
*.so
*.dylib
*.dll
# Fortran module files
*.mod
*.smod
# Compiled Static libraries
*.lai
*.la
*.a
*.lib
# Executables
*.exe
*.out
*.app
# CMakeUserfile
*.user
*.user.*
================================================
FILE: CMakeLists.txt
================================================
cmake_minimum_required(VERSION 3.9)
project(da4qi4)
#set(_DAQI_TARGET_TYPE_ "DEMO_SERVER")
#set(_DAQI_TARGET_TYPE_ "STATIC_LIB")
#set(_DAQI_TARGET_TYPE_ "SHARED_LIB")
include_directories(.)
include_directories(include/)
include_directories(nlohmann_json/include/)
set(USE_LOCAL_BOOST_VERSION OFF)
if (USE_LOCAL_BOOST_VERSION)
SET(BOOST_INCLUDEDIR /usr/local/include)
SET(BOOST_LIBRARYDIR /usr/local/lib)
find_package(Boost 1.67.0 REQUIRED COMPONENTS filesystem system)
else()
SET(BOOST_INCLUDEDIR /usr/include)
SET(BOOST_LIBRARYDIR /usr/lib)
find_package(Boost 1.65.0 REQUIRED COMPONENTS filesystem system)
endif()
if (Boost_FOUND)
message(STATUS ${Boost_VERSION})
message(STATUS ${Boost_INCLUDE_DIRS})
message(STATUS ${Boost_LIBRARY_DIRS})
if ((Boost_VERSION EQUAL 106600) OR (Boost_VERSION GREATER 106600))
add_definitions(-D_USE_BOOST_VERSION_GE_1_66_=1)
endif()
add_definitions(-D_USE_BOOST_VERSION_=${Boost_VERSION})
include_directories(${Boost_INCLUDE_DIRS})
endif()
find_library(LIBICONV iconv /usr/local/lib)
link_libraries(${LIBICONV} pthread)
set(JSON_MultipleHeaders ON CACHE INTERNAL "")
set(JSON_BuildTests OFF CACHE INTERNAL "")
add_subdirectory(nlohmann_json)
add_subdirectory(llhttp)
add_subdirectory(multipart-parser)
aux_source_directory(./src/redis-client DAQI_SRC_FILES)
aux_source_directory(./src/utilities DAQI_SRC_FILES)
aux_source_directory(./src/def DAQI_SRC_FILES)
aux_source_directory(./src/intercepters DAQI_SRC_FILES)
aux_source_directory(./src/client DAQI_SRC_FILES)
aux_source_directory(./src/net-detail DAQI_SRC_FILES)
aux_source_directory(./src/websocket DAQI_SRC_FILES)
aux_source_directory(./src DAQI_SRC_FILES)
aux_source_directory(./ DAQI_SRC_FILES)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -Wall")
link_libraries(multipart_parser)
link_libraries(llhttp)
link_libraries(nlohmann_json)
if(_DAQI_TARGET_TYPE_ STREQUAL "DEMO_SERVER")
message(STATUS "~BUILD DAQI AS DEMO SERVER~")
link_libraries(ssl)
link_libraries(crypto)
add_definitions(-D_BUILD_DAQI_DEMO_SERVER_=1)
add_executable(${PROJECT_NAME} ${DAQI_SRC_FILES})
target_link_libraries (${PROJECT_NAME} ${Boost_LIBRARIES})
elseif(_DAQI_TARGET_TYPE_ STREQUAL "STATIC_LIB")
message(STATUS "~BUILD DAQI AS STATIC LIB~")
add_library(${PROJECT_NAME} STATIC ${DAQI_SRC_FILES})
set_target_properties (${PROJECT_NAME} PROPERTIES DEBUG_POSTFIX _d)
target_link_libraries (${PROJECT_NAME} ${Boost_LIBRARIES})
elseif(_DAQI_TARGET_TYPE_ STREQUAL "SHARED_LIB")
message(STATUS "~BUILD DAQI AS SHARED LIB~")
add_library(${PROJECT_NAME} SHARED ${DAQI_SRC_FILES})
set_target_properties (${PROJECT_NAME} PROPERTIES DEBUG_POSTFIX _d)
endif()
function(echo_all_cmake_variable_values)
get_cmake_property(vs VARIABLES)
foreach(v ${vs})
message(STATUS “${v}=’${${v}}'”)
endforeach(v)
message(STATUS “”)
endfunction()
#echo_all_cmake_variable_values()
================================================
FILE: LICENSE
================================================
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction, and
distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by the copyright
owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all other entities
that control, are controlled by, or are under common control with that entity.
For the purposes of this definition, "control" means (i) the power, direct or
indirect, to cause the direction or management of such entity, whether by
contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity exercising
permissions granted by this License.
"Source" form shall mean the preferred form for making modifications, including
but not limited to software source code, documentation source, and configuration
files.
"Object" form shall mean any form resulting from mechanical transformation or
translation of a Source form, including but not limited to compiled object code,
generated documentation, and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or Object form, made
available under the License, as indicated by a copyright notice that is included
in or attached to the work (an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object form, that
is based on (or derived from) the Work and for which the editorial revisions,
annotations, elaborations, or other modifications represent, as a whole, an
original work of authorship. For the purposes of this License, Derivative Works
shall not include works that remain separable from, or merely link (or bind by
name) to the interfaces of, the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including the original version
of the Work and any modifications or additions to that Work or Derivative Works
thereof, that is intentionally submitted to Licensor for inclusion in the Work
by the copyright owner or by an individual or Legal Entity authorized to submit
on behalf of the copyright owner. For the purposes of this definition,
"submitted" means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems, and
issue tracking systems that are managed by, or on behalf of, the Licensor for
the purpose of discussing and improving the Work, but excluding communication
that is conspicuously marked or otherwise designated in writing by the copyright
owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf
of whom a Contribution has been received by Licensor and subsequently
incorporated within the Work.
2. Grant of Copyright License.
Subject to the terms and conditions of this License, each Contributor hereby
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
irrevocable copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the Work and such
Derivative Works in Source or Object form.
3. Grant of Patent License.
Subject to the terms and conditions of this License, each Contributor hereby
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
irrevocable (except as stated in this section) patent license to make, have
made, use, offer to sell, sell, import, and otherwise transfer the Work, where
such license applies only to those patent claims licensable by such Contributor
that are necessarily infringed by their Contribution(s) alone or by combination
of their Contribution(s) with the Work to which such Contribution(s) was
submitted. If You institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work or a
Contribution incorporated within the Work constitutes direct or contributory
patent infringement, then any patent licenses granted to You under this License
for that Work shall terminate as of the date such litigation is filed.
4. Redistribution.
You may reproduce and distribute copies of the Work or Derivative Works thereof
in any medium, with or without modifications, and in Source or Object form,
provided that You meet the following conditions:
You must give any other recipients of the Work or Derivative Works a copy of
this License; and
You must cause any modified files to carry prominent notices stating that You
changed the files; and
You must retain, in the Source form of any Derivative Works that You distribute,
all copyright, patent, trademark, and attribution notices from the Source form
of the Work, excluding those notices that do not pertain to any part of the
Derivative Works; and
If the Work includes a "NOTICE" text file as part of its distribution, then any
Derivative Works that You distribute must include a readable copy of the
attribution notices contained within such NOTICE file, excluding those notices
that do not pertain to any part of the Derivative Works, in at least one of the
following places: within a NOTICE text file distributed as part of the
Derivative Works; within the Source form or documentation, if provided along
with the Derivative Works; or, within a display generated by the Derivative
Works, if and wherever such third-party notices normally appear. The contents of
the NOTICE file are for informational purposes only and do not modify the
License. You may add Your own attribution notices within Derivative Works that
You distribute, alongside or as an addendum to the NOTICE text from the Work,
provided that such additional attribution notices cannot be construed as
modifying the License.
You may add Your own copyright statement to Your modifications and may provide
additional or different license terms and conditions for use, reproduction, or
distribution of Your modifications, or for any such Derivative Works as a whole,
provided Your use, reproduction, and distribution of the Work otherwise complies
with the conditions stated in this License.
5. Submission of Contributions.
Unless You explicitly state otherwise, any Contribution intentionally submitted
for inclusion in the Work by You to the Licensor shall be under the terms and
conditions of this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify the terms of
any separate license agreement you may have executed with Licensor regarding
such Contributions.
6. Trademarks.
This License does not grant permission to use the trade names, trademarks,
service marks, or product names of the Licensor, except as required for
reasonable and customary use in describing the origin of the Work and
reproducing the content of the NOTICE file.
7. Disclaimer of Warranty.
Unless required by applicable law or agreed to in writing, Licensor provides the
Work (and each Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
including, without limitation, any warranties or conditions of TITLE,
NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are
solely responsible for determining the appropriateness of using or
redistributing the Work and assume any risks associated with Your exercise of
permissions under this License.
8. Limitation of Liability.
In no event and under no legal theory, whether in tort (including negligence),
contract, or otherwise, unless required by applicable law (such as deliberate
and grossly negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special, incidental,
or consequential damages of any character arising as a result of this License or
out of the use or inability to use the Work (including but not limited to
damages for loss of goodwill, work stoppage, computer failure or malfunction, or
any and all other commercial damages or losses), even if such Contributor has
been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability.
While redistributing the Work or Derivative Works thereof, You may choose to
offer, and charge a fee for, acceptance of support, warranty, indemnity, or
other liability obligations and/or rights consistent with this License. However,
in accepting such obligations, You may act only on Your own behalf and on Your
sole responsibility, not on behalf of any other Contributor, and only if You
agree to indemnify, defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason of your
accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work
To apply the Apache License to your work, attach the following boilerplate
notice, with the fields enclosed by brackets "{}" replaced with your own
identifying information. (Don't include the brackets!) The text should be
enclosed in the appropriate comment syntax for the file format. We also
recommend that a file or class name and description of purpose be included on
the same "printed page" as the copyright notice for easier identification within
third-party archives.
Copyright 2018 zhuangyan-stone
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
================================================
FILE: README.md
================================================
- [零、几个原则](#零几个原则)
* [0.1 自己的狗粮自己吃](#01-自己的狗粮自己吃)
* [0.2 站在巨人的肩膀上](#02-站在巨人的肩膀上)
* [0.3 易用优于性能](#03-易用优于性能)
* [0.4 简单胜过炫技](#04-简单胜过炫技)
* [0.5 紧跟国内生产环境](#05-紧跟国内生产环境)
- [一、快速了解](#一快速了解)
* [1.1 一个空转的Web Server](#11-一个空转的web-server)
* [1.2 Hello World!](#12-hello-world)
+ [1.2.1 针对指定URL的响应](#121-针对指定url的响应)
+ [1.2.2 返回HTML](#122-返回html)
* [1.3 处理请求](#13-处理请求)
* [1.4 引入Application](#14-引入application)
* [1.5 运行日志](#15-运行日志)
* [1.6 HTML模板](#16-html模板)
* [1.7 WebSocket](#17-websocket)
* [1.7.1 HTTP对比WebSocket](#171-http-对比-websocket)
* [1.7.2 大器WebSocket后台实现特性](#172-大器WebSocket后台实现特性)
* [1.7.3 使用示例](#173-使用示例)
* [1.8 更多](#18-更多)
+ [1.8.1 框架更多集成功能](#181-框架更多集成功能)
+ [1.8.2 框架外围可供集成的工具](#182-框架外围可供集成的工具)
- [二、如何构建](#二如何构建)
* [2.1 基于生产环境构建](#21-基于生产环境构建)
* [2.2 准备编译工具](#22-准备编译工具)
* [2.3 准备第三方库](#23-准备第三方库)
* [2.4 下载大器源代码](#24-下载大器源代码)
* [2.5 编译“大器”库](#25-编译大器库)
* [2.6 在你的项目中使用 da4qi4库](#26-在你的项目中使用da4qi4)
- [三、运行时外部配套系统](#三运行时外部配套系统)
* [3.1 运行时依赖说明](#31-运行时依赖说明)
* [3.2 Redis的安装](#32-redis的安装)
* [3.3 数据库](#33-数据库)
# 零、几个原则
## 0.1 自己的狗粮自己吃
官网 [第2学堂 www.d2school.com](http://www.d2school.com) 后台使用 da4qi4作为Web Server开发。(nginx + da4qi4 + redis + mysql)。
给一个在手机上运行的网站效果:

样式丑,但这只和差劲的UI师,也就是我的美感有关,和后台使用什么Web框架没有关系。
## 0.2 站在巨人的肩膀上
da4qi4 Web 框架优先使用成熟的、C/C++开源项目的搭建。它的关键组成:
- HTTP 基础协议解析:[Node.JS/llhttp](https://github.com/nodejs/llhttp)。 一直使用Node.JS底层的HTTP解析器,Node.JS v12 之前是[nodejs/http-parser](https://github.com/nodejs/http-parser);之后升级迁移到 [llhttp](https://github.com/nodejs/llhttp) 。Node.JS 官方说法解析性能提升156%;
- HTTP multi-part : multipart-parsr [multipart-parser-c](https://github.com/iafonov/multipart-parser-c) ;
- 网络异步框架: C++ boost.asio [boostorg/asio](https://github.com/boostorg/asio) (可能进入C++2x标准库)
- JSON : [nlohmann-json JSON for Modern C++](https://github.com/nlohmann/json) (github上搜索JSON结果中第一个);
- 日志: [splogs](https://github.com/gabime/spdlog) 高性能的C++日志库 (微软公司选择将它绑定到 Node.JS 作日志库);
- 模板引擎: [inja](https://github.com/pantor/inja) 模板引擎 [Jinja](https://palletsprojects.com/p/jinja/) 的 C++ 实现版本,名气不大,但能和nlohmann-json完美配合实现C++内嵌的动态数据结构,加上我为它解决过bug,比较熟悉、放心。
- TLS/SSL/数据加密: [OpenSSL](https://www.openssl.org/) (TLS);
- Redis 客户端: 基于[nekipelov/redisclient](https://github.com/nekipelov/redisclient),为以类node.js访问redis进行专门优化(实现单线程异步访问,去锁)。 da4qi4默认使用redis缓存session等信息(以优先支持负载均衡下的节点无状态横向扩展)。
- 静态文件服务: da4qi4自身支持静态文件(包括前端缓存逻辑)。实际项目部署建议与nginx配合。由nginx提供更高性能、更安全的接入及提从静态文件服务。
注:
1. 框架未绑定数据库访问方式。用户可使用 Oracle 官方 C++ Connector,或MySQL++,或 [三、运行时外部配套系统](#三运行时外部配套系统)提及的各类数据库连接器;
2. 框架自身使用 redis 作为默认的(可跨进程的)SESSION支持。上层应用可选用框架的redis接口,也可以使用自己喜欢、 顺手 的redis C++客户端。
## 0.3 易用优于性能
使用C++开发,基于异步框架,目的就是为了有一个较好的原生性能起点,开发者不要过于费心性能。当然,性能也不能差,因为性能差必将影响产品的易用性)。
暂时仅与 Tomcat 做了一个比较。由于Tomcat似乎是“Per Connection Per Thread/每连接每线程”,所以这个对比会有些胜之不武;但考虑到Tomcat曾广泛应用于实际系统,所以和它的对比数据有利于表明da4qi4在性能上的可用性。
**基准测试环境:**
- ubuntu 18.04
- 4核心8线程 、8G内存
- 测试工具: Jmeter
- 测试工具和服务端运行于同一机器(显然会影响服务端性能,不过本次测试重点是做相对性的对比)
- 后台无业务,不访问数据库,仅返回简短字符串(造成吞吐量严重不足)
- 不走nginx等Web Server的反向代理
**Tomcat 运行配置**
- JVM 1.8G 内存
- 最大线程数:10000
- 最大连接数:20000
- 最大等待队列长度 200
_对 Tomcat不算熟,因此以上配置基本照着网上的相关测试指南设置,有不合理之处,望指正。_
| - | 并发数 | 平均响应(ms) | 响应时间中位数(ms) | 99% 用户响应时间(ms) | 最小响应(ms) | 最大响应(ms) | 错误率 | 吞吐量(s) | 每秒接收字节(KB) |
| ------ | ---- | -------- | ----------- | -------------- | -------- | -------- | --- | ------ | ---------- |
| tomcat | 1000 | 350 | 337 | 872 | 1 | 879 | 0 | 886.7 | 273 |
| da4qi4 | 1000 | 1 | 1 | 20 | 0 | 24 | 0 | 1233 | 286.6 |
另,官网 www.d2school.com 一度以 1M带度、1核CPU、1G 内存的一台服务器作为运行环境(即:同时还运行MySQL、redis服务);后因线上编译太慢,做了有限的升级。
后续会给出与其他Web Server的更多对比。但总体上,da4qi4 的当前阶段开发,基本不会以极端性能提升作为目标。
## 0.4 简单胜过炫技
众所周知C++语言很难,非常适于C++程序员“炫技”;所以有一票C++开源项目虽然技术上很优秀,但却很容易吓跑普通的C++程序员。比如,超爱用“模板元”……da4qi4 的代码强烈克制了这种“炫技”冲动,尽量代码看上去毫无技巧,特别是对外接口,遵循KISS原则,不会让你产生任何“惊奇”(头回看到程序员把无技可炫写得这么清新脱俗?)。
不管怎样,在C++所大范围支持的“面向过程”、“基于对象”、“面向对象”和“泛型”等编程模式中,你只需熟悉“面向过程”,并且会一点“基于对象”,就可以放心地用这个库。
## 0.5 紧跟国内生产环境
用哪个版本的C++?用哪个版本的boost库?用哪个版本的OpenSSL?用哪个版本的CMake?
就一个标准:当前国内主要云计算提供商,已经提供哪些现成的版本,我们就用那个版本——这意味着你几乎只需编译好你写的代码可以完成在线构建、部署了。不用编译boost、不用编译OpenSSL、不用下载编译新版的CMake……
[阿里云](https://cn.aliyun.com/)、[腾讯云](https://cloud.tencent.com/)、[百度云](https://cloud.baidu.com/)、[华为云](https://www.huaweicloud.com/)、[七牛云](https://www.qiniu.com/)……无论哪家,只要你在上面申请一台Ubuntu 18.04 (或更高版本)的服务器,简单向行指令就能在线编译、部署好,让它成为一台跑着“大器 INSIDE”的WEB 服务器,为你的用户提供网站服务。对服务器配置的最低要求是:4G内存、1M带宽、1核CPU。
# 一、快速了解
## 1.1 一个空转的Web Server
我们需要一个C++文件,假设名为“main.cpp”,内容如下:
```C++
#include "daqi/da4qi4.hpp"
using namespace da4qi4;
int main()
{
auto svc = Server::Supply(4098);
svc->Run();
}
```
不到10行代码,我们创建了一个空转的,似乎不干活的Web Server。
编译、运行,然后在浏览器地址栏输入:http://127.0.0.1:4098 ,而后回车,浏览器将显示一个页面,上面写着:
```
Not Found
```
虽然说它“不干活”,但这个Web Server的运行完全合乎逻辑:我们没有为它配备任何资源或响应操作、,所以对它的任何访问,都返回404页面:“Not Found”。
## 1.2 Hello World!
接下来实现这么一个功能:当访问网站的根路径时,它能响应:“Hello World!”。
### 1.2.1 针对指定URL的响应
这需要我们大代码中指示框架遇上访问网站根路径时,做出必要的响应。响应可以是函数指针、std::function、类方法或C++11引入的lambda,我们先来使用最后者:
```C++
#include "daqi/da4qi4.hpp"
using namespace da4qi4;
int main()
{
auto svc = Server::Supply(4098);
svc->AddHandler(_GET_, "/", [](Context ctx)
{
ctx->Res().ReplyOk("Hello World!");
ctx->Pass();
});
svc->Run();
}
```
例中使用到的Server类的AddHandler()方法,并提供三个入参:
1. 指定的HTTP访问方法: \_GET\_;
2. 指定的访问URL: /,即根路径 ;
3. 匿名的lambda表达式。
三个入参以及方法名合起来表达:如果用户以GET方法访问网站的根路径,框架就调用lambda表达式以做出响应。
编译、运行。现在用浏览器访问 http://127.0.0.1:4098 ,将看到:
```
Hello World!
```
作为对比,下面给出同样功能使用自由函数的实现:
```C++
#include "daqi/da4qi4.hpp"
using namespace da4qi4;
void hello(Context ctx)
{
ctx->Res().ReplyOk("Hello World!");
ctx->Pass();
}
int main()
{
auto svc = Server::Supply(4098);
svc->AddHandler(_GET_, "/", hello);
svc->Run();
}
```
为节省代码篇幅,后续演示均使用lambda表达式来表达HTTP的响应操作。实际系统显然不可能将代码全塞在main()函数中,因此平实的自由函数会用得更多。不仅lambda不是必需,实际是连“class/类”都很少使用——这符号Web Server基本的要求:尽量不要带状态;自由函数相比类的成员函数(或称方法),更“天然的”不带状态。
### 1.2.2 返回HTML
以上代码返回给浏览器纯文本内容,接下来,应该来返回HTML格式的内容。出于演示目的,我们干了一件有“恶臭”的事:直接在代码中写HTML字符串。后面很快会演示正常的做法:使用静态文件,或者基于网页模板文件来定制网页的页面内容;但现在,让我们来修改第11行代码调用ReplyOK()函数的入参,原来是“Hello World!”,现在将它改成一串HTML:
```c++
……
ctx->Res().ReplyOk("<html><body><h1>Hello World!</h1></body></html>");
……
```
## 1.3 处理请求
接下来,我们希望请求和响应的内容都能够有点变化,并且二者的变化存在一定的匹配关系。具体是:在请求的URL中,加一个参数,假设是“name=Tom”,则我们希望后台能返回“Hello Tom!”。
这就需要用到“Request/请求”和“Response/响应”:
```C++
#include "daqi/da4qi4.hpp"
using namespace da4qi4;
int main()
{
auto svc = Server::Supply(4098);
svc->AddHandler(_GET_, "/", [](Context ctx)
{
std::string name = ctx->Req("name");
std::string html = "<html><body><h1>Hello " + name + "!</h1></body></html>";
ctx->Res().ReplyOk(html);
ctx->Pass();
});
svc->Run();
}
```
> 重要: 这里为方便演示而使用 lambda 表达式,但实际系统不可能把所有代码都放在main()函数中写。所以肯定是一个个函数。用编程语言中最最基础的函数并不丢人,因为,我们要的是实用,而不是非在代码秀一下“我会lambda哦!”。(参看:[0.4 简单胜过炫技](#04-简单胜过炫技))
编译、运行。通过浏览器访问 “http://127.0.0.1:4098/?name=Tom” ,将得到带有HTML格式控制的 “Hello Tom!”。
## 1.4 引入Application
编译、运行。通过浏览器访问 “http://127.0.0.1:4098/?name=Tom” ,将得到带有HTML格式控制的 “Hello Tom!”。
Server代表一个Web 服务端,但同一个Web Server系统很可能可分成多个不同的人群。
> 举例:比如写一个在线商城,第一类用户,也是主要的用户,当然就是来商城在线购物的买家,第二类用户则是卖家和商城的管理员。这种区别,也可以称作是:一个服务端,多个应用。在大器框架中,应用以Application表达。
就当前而言,还不到演示一个Server上挂接多个Application的复杂案例,那我们为什么要开始介绍Application呢?Application才是负责应后台行为的主要实现者。在前面的例子中,虽然没有在代码中虽然只看到Server,但背后是由Server帮我们创建一个默认的 Application 对象,然后依靠该默认对象以实现演示中的相关功能。
下面我们就通过“Server | 服务”对象,取出这个“Application | 应用”,并代替前者实现前面最后一个例子的功能。
```C++
#include "daqi/da4qi4.hpp"
using namespace da4qi4;
int main()
{
auto svc = Server::Supply(4098);
auto app = svc->DefaultApp(); //取出自动生成的默认应用对象
app->AddHandler(_GET_, "/", [](Context ctx)
{
std::string name = ctx->Req("name");
std::string html = "<html><body><h1>Hello " + name + "!</h1></body></html>";
ctx->Res().ReplyOk(html);
ctx->Pass();
});
svc->Run();
}
```
除了“AddHandler()”的实施对象以前是svc,现在是“app”以外,基本没有什么变化。代码和前面没有显式引入Application之前功能一致。但为什么我们一定要引入Application呢?除了前述的,为将来一个Server对应多个Application做准备之外,从设计及运维上讲,还有一个目的:让Server和Application各背责任。 **Application负责较为高层的逻辑,重点是具体的某类业务,而Server则负责服务器较基础的逻辑,重点是网络方面的功能** 。下一小节将要讲到日志,正好是二者分工的一个典型体现。
## 1.5 运行日志
一个Web Server在运行时,当然容易遇到或产生各种问题。这时候后台能够输出、存储运行时的各种日志是大有必要的功能。并且,最最重要的是,如果你写一个服务端程序,运行大半年没有什么屏幕输出,看起来实在是“不够专业”,很有可能会影响你的工资收入……
结合前面所说的Server与Application的分工。日志在归集上就被分成两大部分:服务日志和应用日志。
- 服务层日志:全局唯一,记录底层网络、相关的周边运行支撑环境(缓存/Redis、数据库/MySQL)等基础设施的运行状态。
- 应用层日志:每个应用都对应一个日志记录器,记录该应用的运行日志。
其中,相对底层的Server日志由框架自动创建;而应用层日志自然是每个应用对应一套日志。程序可以为服务层和应用层日志创建不同的日志策略。事实上,如果有多个应用,那自然可以为每个应用定制不同的日志策略。如果不主动为某个应用创建日志记录器,则该应用只管全速运行,不输出任何日志——听起很酷,但你不应该对自己写的代码这么有信心。
```C++
#include "daqi/da4qi4.hpp"
using namespace da4qi4;
int main()
{
//初始化服务日志,需指定日志文件要存在哪里?以及日志记录的最低级别
log::InitServerLogger("你希望/服务日志文件/要存储的/目录/"
, log::Level::debug));
auto svc = Server::Supply(4098);
log::Server()->info("服务已成功加载."); //强行输出一条服务日志
auto app = svc->DefaultApp();
//再来初始化应用日志
app->InitLogger("你希望/当前应用的/要存储的/目录/");
app->AddHandler(_GET_, "/", [](Context ctx)
{
std::string name = ctx->Req("name");
std::string html = "<html><body><h1>Hello " + name + "!</h1></body></html>";
ctx->Res().ReplyOk(html);
ctx->Pass();
});
svc->Run();
log::Server()->info("再见!"); //强行再输出一条服务日志
}
```
所有日志功能都在“log::”名字空间之下。以上日志配置不仅会将信息输出到终端(控制台),也会自动输出指定目录下的文件中,服务日志和各应用日志是独立的文件。文件带有默认的最大尺寸和最大个数限制。实际在linux服务器上运行时,程序通常在后台运行并将本次运行的屏幕输出重定向到某个文件。
日志的输出控制,支持常见的:跟踪(trace)、调试(debug)、信息(info)、警告(warn)、错误(err)、致命错误(critical)等级别。例中对“app->InitLogger()” 使用默认级别:info。
下面是运行日志截图示例。

看起来有点像个后台程序,可以申请领导过来视察你的工作成果了。
## 1.6 HTML模板
是时候解决在代码中直接写HTML的问题了。
用户最终看到的网页的内容,有一些在系统设计阶段就很清楚,有一些则必须等用户访问时才知道。比如前面的例子中,在设计时就清楚的有:页面字体格式,以及“Hello, _ _ _ _ !”;而需要在运行时用户访问后才能知道的,就是当中的下划线处所要填写的内容。
下面是适用于本例的,一个相当简单的的HTMl网页模板:
```html
<!DOCTYPE html>
<html lang="zh">
<head>
<title>首页</title>
<meta content="text/html; charset=UTF-8">
</head>
<body>
<h1>你好,{=_URL_PARAMETER_("name")=} !</h1>
<p>您正在使用的浏览器: {=_HEADER_("User-Agent")=}</p>
<p>您正在通过该网址访问本站:{=_HEADER_("Host")=}</p>
</body>
</html>
```
“你好,”后面的特定格式{=_URL_PARAMETER_("name")=} ,将会被程序的模板解析引擎识别,并填写上运行时的提供的name的值。
解释:
- \_URL_PARAMETER\_() 是网页模板脚本内置提供的一个函数,它将自动得取浏览器地址栏输入URL后,所带的参数。
- \_HEADER\_() 同样是网页模板脚本内置的一个函数,用以获得当前HTTP请求的报头数据项。在本例中无实际业务作用,常用于辅助页面调试。
假设这个文件被存放在 “你的/网页模板/目录”。下面代码中的 “app->SetTemplateRoot()”将用到这个目录的路径。
```C++
#include "daqi/da4qi4.hpp"
using namespace da4qi4;
int main()
{
log::InitServerLogger("你希望/服务日志文件/要存储的/目录/", log::Level::debug));
auto svc = Server::Supply(4098);
log::Server()->info("服务已成功加载.");
auto app = svc->DefaultApp();
//新增的两行:
app->SetTemplateRoot("你的/网页模板/目录/"); //模板文件根目录
app->InitTemplates(); //加载并将模板文件“编译成” 字节码
app->InitLogger("你希望/当前应用的/要存储的/目录/");
//下面这行让sever定时检测模板文件的变动(包括新增)
svc->EnableDetectTemplates(5); //5秒,实际项目请设置较大间隔,如10分钟
svc->Run();
log::Server()->info("再见!");
}
```
现在,使用火狐浏览器访问URL并带上“name”参数:http://127.0.0.1:4098?name=大器da4qi4 ,将得到以下HTML内容:
```html
<h1>你好,大器da4qi4 !</h1>
<p>您正在使用的浏览器:Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:71.0) Gecko/20100101 Firefox/71.0 </p>
<p>您正在通过该网址访问本站:127.0.0.1:4098</p>
```
小提示:“为什么代码更短了?” 你应该注意到,基于模板响应后,代码原有“AddHandler()” 都不见了。因为这个例子没有实质业务逻辑:用户访问一个URL地址,并且带参数,服务依据事先定义的模板样式,将这个参数原样展现出来。实际业务系统当然不可能这么简单(否则要我们后端程序员干什么?),但是,当我们在快速搭建一个系统时,在初始开发过程中,这种情况非常常见,不需要修改源代码,不需要重启服务程序,就能直接看到新增或修改的网页内容,带给我们很大的方便。
框架提供的模板引擎,不仅能替换数据,也支持基本的条件判断、循环、自定函数等功能,类似一门“脚本”。
> 重要:多数情况下我们写C++程序用以高性能地、从各种来源(数据库、缓存、文件、网络等)、以各种花样(同步、异步)获取数据、处理数据。而HTML模板引擎在C++程序中以解释的方式运行,因此正常的做法是不要让一个模板引擎干太复杂的,毕竟,在C++这种 “彪形大汉”的语言面,页面模板引擎“语言”无论在功能还是性能上,都只能算是一个小孩子。
接下来,我们应该有一个带业务逻辑的例子。这个业务逻辑非常的复杂,并且严重依赖于CPU的计算速度……我们要做一个加法器。用户在浏览器地址栏输入:
```html
http://127.0.0.1:4098/add?a=1&b=2
```
浏览器将显示a+b的结果。显然,业务逻辑就是计算两个整数相加,我们的强大的,计算力过剩的C++语言终于可以派上用场。
首先,准备一个用于显示加法结果的页面模板,文件名为 “add.daqi.HTML”:
```html
<!DOCTYPE html>
<html lang="zh">
<head>
<title>加法</title>
<meta content="text/html; charset=UTF-8">
</head>
<body>
<p>
{=c=}
</p>
</body>
</html>
```
重点在 “{=c=}”身上。 {==} 仍然用来标识一个可变内容,但其内不再是一个内置函数,而是一个普通的变量名称:c。为此我们在C++代码中要做的事变成两件:一是计算 a 加 b的和,二是将和以 c 为名字,填入模板对应位置。
然后需要一个add的自由函数:
```C++
void add(Context ctx)
{
//第一步:取得用户输入的参数 a 和 b:
std::string a = ctx->Req().GetUrlParameter("a");
std::string b = ctx->Req().GetUrlParameter("b");
//第二步:把字符串转换为整数:
int na = std::stoi(a); //stoi 是 C++11新标中的字符串转换整数的函数
int nb = std::stoi(b);
//第三步:核心核心核心业务逻辑:加法计算
int c = na + nb;
//第四步:把结果按模板指定的名字"c",设置到“Model”数据中:
ctx->ModelData()["c"] = c;
//最后一步:渲染,并把最终页面数据传回浏览器: (即:输出结果 = 模板 + 数据)
ctx->Render().Pass(); //Render 是动词:渲染
}
```
暂时为了简化,我们不写日志、不作错误处理,现在,除了add函数的内部实现外,完整的main.cpp文件内容是:
```C++
#include "daqi/da4qi4.hpp"
using namespace da4qi4;
void add(Context ctx)
{
/* 实现见上 */
}
int main()
{
auto svc = Server::Supply("127.0.0.1", 4098);
auto app = svc->DefaultApp();
app->SetTemplateRoot("你的/网页模板/目录/");
app->InitTemplates();
//AddHandler 又回来了:
app->AddHandler(_GET_, "/add", add);
svc->EnableDetectTemplates(5);
svc->Run();
}
```
如前所述通过浏览器访问 .../add?a=1&b=2 ,将看一个简单的3。
甲方说这也太不人性化了,好歹显示一个 “1 + 2 = 3” 啊! 太好了,我们正好借此演示如何不修改代码,不重启服务程序就达成目标。
需要修改的是模板文件:“add.daqi.HTML”:
```html
<!DOCTYPE html>
<html lang="zh">
<head>
<title>加法</title>
<meta content="text/html; charset=UTF-8">
</head>
<body>
<p>
<!-- 展示内容类似:1 + 2 = 3 -->
{=_URL_PARAMETER_("a")=} + {=_URL_PARAMETER_("b")=} = {=c=}
</p>
</body>
</html>
```
修改、保存,5秒过后再访问,就看到新成果了。
会有人担心C++写的程序容易出错,并且一出错就直接挂掉——上面程序,如果用户无意有意或干脆就是恶意搞破坏,输入 “.../add?a=A&b=BBBB”……会怎样呢? add 函数中的 “std::stoi()” 调用可能抛出异常?不管怎样,请放心,程序并不会挂掉,它会继续运行,只是:
- 一来、用户只会看到一个典型的HTTP 500 错误 “Internal Server Error ” (即:服务内部错误),这对用户来说,不太友好。
- 二来,后台什么日志记录也没有,对系统的维护人员来说,也不友好。
很简单,对add的业务逻辑加上异常处理,出现异常时,向客户回复一句相对友好点的内容,并且留下应用日志即可。以下是关注异常后的add函数:
```C++
#include "daqi/da4qi4.hpp"
using namespace da4qi4;
void add(Context ctx)
{
try
{
std::string a = ctx->Req().GetUrlParameter("a");
std::string b = ctx->Req().GetUrlParameter("b");
int na = std::stoi(a);
int nb = std::stoi(b);
int c = na + nb;
ctx->ModelData()["c"] = c;
}
catch(std::exception const& e)
{
ctx->Logger()->warn("hand add exception. {}. {}. {}.", a, b, e.what());
ctx->ModelData()["c"] = std::string("同学,不要乱输入加数嘛!") + e.what();
}
ctx->Render().Pass();
}
```
关键在异常处理。第一行是:
```C++
ctx->Logger()->warn("hand add exception. {}. {}. {}.", a, b, e.what());
```
三个重点:
- 一是如何通过上下文(Context)得到当前应用的日志记录器:ctx->Logger()。它实际上是 ctx->App().GetLogger() 的简写。
- 二是得益于“spdlog”的语法,记日志就这么简单:要显示三个信息:a、b和异常,就在前面的格式字符串中,写上三个 {} ,最终就可以在日志中看到一行完整的内容。
- 三是我们使用“warn()”,而不是“error()”,这体现了服务程序在此刻的淡定内心:不就是用户输入错误嘛?有什么因结什么果。用户输入错误,就返回给他一行出错信息。何事慌张?警告而已。
第二行是:
```C++
ctx->ModelData()["c"] = std::string("同学,不要乱输入加数嘛!") + e.what();
```
重点在于:赋值操作的右值,是一个字符串。“ModelData”,即“模型数据”在这里指的是即将写往页面模板的数据,和C++的强类型相比,页面上的数据不用太区分类型。所以,“c” 本是a+b之和,按理说是整数类型,但我们却可以往里写入一行字符串,这样,当用户捣乱造成 a + b 无法执行时,他就会看到一行出错信息。
> main() 函数中如何初始化日志,已经演示过,不再给出代码。
## 1.7 WebSocket
### 1.7.1 HTTP 对比 WebSocket
先简单说下在业务与技术上,传统HTTP访问和WebSocket访问的核心区别。
HTTP访问讲究“无状态”,当然,一个业务系统怎么可能无状态,只不过是将状态都放在数据中(缓存、数据库),所谓的无状态是指业务逻辑相关的“类/class”应该无状态——这正好和“class/类”或“object/对象”本质是一个“状态机”相冲突——幸好C++支持多范式开发,所以在前面的例子中,我们几乎不设计“class”,而是使用天生无状态的自由函数。“类与对象”想写成不带状态的状态,难;而自由函数想写出带“状态”来,还真不简单。
到了WebSocket,长连接,通常这时候就有状态——甚至此时底层的网络连接保持或断开本身就是一种状态。比如使用WebSocket写一个页面聊天室,有人连线,就是上线了(进聊天室);有人断线,那就是下线了(出聊天室)。再比如,假设我们的“聊天室”要限制“潜水”用户,就至少得记录每个用户这些状态:上线多久一直没有说话?反过来,如果要限制话痨用户,也至少需要记录一个用户说话记录的记数——这些都是状态。
结论:HTTP访问后端讲究无状态,所以很适合使用“面向过程”的自由函数,而WebSocket 的后端往往需要保持状态,所以这时候“面向对象”比较合适。da4qi4的WebSocket 在保持对无状态的支持下,增加并且主要使用“有状态”的类设计做支持。
### 1.7.2 大器WebSocket后台实现特性
- 支持直接接入WebSokcet支持,也支持从nginx继续反向代理。
- 支持一个端口同时响应HTTP和WebSocket请求。
- 支持ws和wss。
- 支持服务端推送(其实是WebSocket的要求)。
- 支持大报文分段传输(其实也是WebSocket的要求)。
- 支持群发。
- 保持和HTTP相对一致的概念与设计,比如上下文:Context。
- WebSocket连接时,可以方便获得连接升级(upgrade)前的Cookie、HTTP报头、URL等信息。
### 1.7.3 使用示例
一、先演示面向对象思路的写法。
1. 先写一个类,派生自 da4qi4::Websocket::EventsHandler。
```C++
using namespace da4qi4;
class MyEventsHandler : public Websocket::EventsHandler
{
public:
bool Open(Websocket::Context ctx) { return true; } //允许该ws连接
void OnText(Websocket::Context ctx, std::string&& data, bool isfinish)
{
ctx->Logger()->info("收到: {}.", data);
ctx->SendText("已阅!");
}
void OnBinary(Websocket::Context ctx, std::string&& data, bool isfinish)
{
//此时data是二进制数据,比如图片什么的,可以保存下来...
}
void OnError(Websocket::Context ctx
, Websocket::EventOn evt //在哪个环节出错,读或写?
, int code //出错编号
, std::string const& msg //出错信息
)
{
ctx->Logger()->error("出错了. {} - {}.", code, msg);
}
void OnClose(Websocket::Context ctx, Websocket::EventOn evt)
{
ctx->Logger()->info("Websocket连接已经关闭.");
}
};
```
2. 在主函数中,在某个“Application”上注册一个WebSocket的后台处理方法。这个方法用来创建(new)出刚刚定义的那个“MyEventsHandler”的对象,我们使用lambda实现:
```C++
#include "daqi/da4qi4.hpp"
#include "daqi/websocket/websocket.hpp" //引入websocket相关定义
using namespace da4qi4;
class MyEventsHandler : public Websocket::EventsHandler
{
//见上
};
int main()
{
auto svc = Server::Supply(4098);
auto app = svc->DefaultApp();
app->InitLogger("log/");
//在某个app的指定URL下,挂接一个websocket响应处理
app->RegistWebSocket("/ws", UrlFlag::url_full_path,
[](){ return new MyEventsHandler; }
);
svc->Run();
}
```
现在,让你的前端开发人员,在HTML页面里,用JS写一段代码,类似于:
```javascript
var ws = new WebSocket("ws://127.0.0.1:4098/ws");
ws.onopen = function(evt) {
this.send("Hello WebSocket.");
}
ws.onmessage = function (evt) {
console.log(evt.data);
}
……
```
前后端就可以聊起来了。
二、如果后台业务逻辑确实很简单,那写一个类,还派生什么的确实显得很笨。此时也可以使用简单的函数、labmbda来快速响应。
方法是定义一个大器预定的 “ Websocket::EventHandleFunctor” 变量:
```C++
#include "daqi/da4qi4.hpp"
#include "daqi/websocket/websocket.hpp" //引入websocket相关定义
using namespace da4qi4;
/*不需要类定义了*/
int main()
{
auto svc = Server::Supply(4098);
auto app = svc->DefaultApp();
app->InitLogger("log/");
Websocket::EventHandleFunctor functor;
functor.DoOnText = [] (Websocket::Context ctx, std::string&& data, bool isfinished)
{
ctx->Logger()->info("收到: {}.", data);
ctx->SendText("已阅!");
}
app->RegistWebSocket("/ws", UrlFlag::url_full_path, functor);
svc->Run();
}
```
## 1.8 更多
### 1.8.1 框架更多集成功能
1. cookie支持
2. 前端(浏览器)缓存支持
3. Redis 缓存支持
4. Session 支持
5. 静态文件
6. 模板文件更新检测及热加载
7. HTTP/HTTPS 客户端组件(已基于此实现微信扫码登录、阿里云短信的C++SDK,见下)
8. POST响应支持
9. 文件上传、下载
10. 访问限流
11. JSON
12. 纯数据输出的API接口,与前端AJAX配合
13. 框架全方式集成:(a) 基于源代码集成、(b) 基于动态库集成、(c) 基于静态库集成
14. 常用编码转换(UTF-8、UCS、GBK、GB18030)
15. ……
### 1.8.2 框架外围可供集成的工具
1. 数据库访问
2. 和nginx配合(实现负载均衡的快速横向扩展)
3. 阿里短信云异步客户端
4. 微信扫一扫登录异步客户端
5. 基于OpenSSL的数据加密工具
6. 常用字符串处理
7. ……
# 二、如何构建
## 2.1 基于生产环境构建
尽管使用的组件都支持跨平台,但大器当前仅支持在Linux下环境编译;大多数实际项目的服务,都运行在Linux下。
> Web 服务端部署在Linux上,这是有原因的: (1) 前述的外围组件:nginx、mysql、redis 在Linux下安装都是一行命令的事,远比Windows方便。(2) 如果你使用当前非常流行的Docker,更是如此。 (3) 事实上Web 端的开源大杀器都是先提供Linux版,然后再考虑出Windows版,甚至有官方拒绝出Windows版(比如Redis 作者就“无情”地拒绝了微软提供的,将Redis变成也可以在Windows执行的补丁包)。
大器框架同样会在后续某个时间,提供Windows版本。
当前国内各云计算提供商,均提供 Ubuntu Server 版本为 18.04 LTS 版本。如“[0.5 紧跟国内生产环境](#05-紧跟国内生产环境)” 小节所述,你有一台2019年或更新的Ubuntu云服务器,那么在其上构建大器,则所需的软件、依赖库等,暂时只有一个用于中文编码转换的 iconv 库,需要手动下载编译之外,其它的都可以从Ubuntu 软件仓库中获取。
以下内容均以 Ubuntu 18.04 为例,考虑日常开发不会直接使用Server版,因此严格讲,以下内容均假设系统环境为 Ubuntu 18.04 桌面版。
> 小提示-服务器与开发机的区别:
>
> 开发机(桌面版)为安装组件时,需临时提升用户权限,即相关指令前面多出个“sudo ”。如果是在服务版的Ubuntu操作,默认就是拥有更高管理权限的根用户,因此不需要该指令。例如:
> 开发机:sudo apt install git
> 服务器:apt install git
## 2.2 准备编译工具
1. 如果未安装或不知道有没有安装(以下简称为“准备”) GCC 编译器:
```shell
sudo apt install build-essential
```
2. 准备 CMake构建套件,请:
```shell
sudo apt install cmake
```
## 2.3 准备第三方库
1. 准备 boost 开发库:
```shell
sudo apt install libboost-dev libboost-filesystem libboost-system
```
2. 准备openssl及其开发库:
```shell
sudo apt install openssl libssl-dev
```
3. 准备 libiconv 库
我们使用汉字,而汉字有多种编码方案,因此,汉字的编码转换,是开发包括Web应用在内各种软件系统的常见需求。大器框架通过集成iconv库用以实现支持多国语言多种编码的转换功能。
先下载:https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.16.tar.gz
在Ubuntu图形界面中,双击该.gz文件,再点击其内.tar文件,解压后得到 “libiconv-1.16”文件夹。在终端进入该文件夹,依次输入以下三行,完成安装:
```shell
./configure --prefix=/usr/local
make
sudo make install
```
4. 最后,确保生效所安装的动态库在系统中能被找到:
```shell
sudo ldconfig
```
## 2.4 下载大器源代码
通常你应该安装 git 工具,如果没有或不确定,请打开终端(Ctrl + Alt + T),按如下指令安装。
```shell
sudo apt install git
```
然后在本地新建一文件夹,假设命名为 daqi,打开终端进入该目录,从github克隆代码:
```shell
git clone https://github.com/d2school/da4qi4.git
```
或者从国内的gitee克隆代码(速度比较快):
```shell
git clone https://gitee.com/zhuangyan-stone/da4qi4_public.git
```
最终,你**将在前述的“daqi”目录下,得到一个子目录“da4qi4”(也可能是别的,看git源)**。大器项目的代码位于后者内,其内你应该能看到“src”、“include”等多个子目录。
> 感谢你看到这里。如有余力,建议在以上两个网站均为本开源项目打个星 。
## 2.5 编译“大器”库
**重要:以下假设大器源代码位于“daqi/da4qi4”目录下。**
1. 准备构建目录
请在“daqi”之下(和“da4qi4”平级)的位置,新建一目录,名为“build”:
```shell
mkdir build
```
进入该当目录:
```shell
cd build
```
2. 执行CMake
> 如果你使用的是1.66或更高版本的boost库,请先打开项目下的CMakefile.txt文件,找到第13行:set(USE_LOCAL_BOOST_VERSION OFF) 将OFF改为ON: set(USE_LOCAL_BOOST_VERSION ON)
```shell
cmake -D_DAQI_TARGET_TYPE_=SHARED_LIB -DCMAKE_BUILD_TYPE=Release ../da4qi4/
```
将生成目标为“发行版(Release)”的大器“动态库(SHARED_LIB)”。
* 如果希望生成调试版本,请将“Release”替换为“Debug”;
* 如果希望生成静态库版本,请将“SHARED_LIB”替换为“STATIC_LIB”;
* 更多编译目标设置,请到本项目官网“www.d2school.com”
一切正常的看,将看到终端上输出“Generating done”等字样。其中更多内容中,包含有boost库的版本号、库所在路径,以及一行“\~BUILD DAQI AS SHARED LIB\~”字样以指示大器的编译形式(SHARED LIB)。
3. 开始编译
```shell
make
```
> 小提示:并行编译
> 如果你的电脑拥有多核CPU,并且内存足够大(至少8G),可以按如下方式并行编译(其中 -j 后面的数字,指明并行编译的核数,以下以四核数例):
> make -j4
完成make之后,以上过程将在build目录内,得到“libda4qi4.so”;如果是调试版,将得到 “libda4qi4_d.so”。 如果是静态库,则相应的扩展名为 “.a”。
以上工作都是一次性的,以后你再使用da4qi4开发新项目,都从下面的步骤开始。
## 2.6 在你的项目中使用da4qi4库
现在,你可以使用你熟悉IDE(Code::Blocks、Qt Creator、CodeLite等)中,构建你的项目,然后以类型使用其它开发库的方式,添加大器的库文件(就是前一步构建所得的.so或.a文件),及大器的头文件。
1. da4qi4库文件。 即前面编译大器库得到的库文件,如“libda4qi4.so”或“libda4qi4.a”,“libda4qi4_d.so”、“libda4qi4_d.a”等文件。
2. da4qi4库依赖的文件。 在Linux下,它们是 pthread、ssl、crypto、boost_filesystem、boost_system
3. da4qi4头文件:“大器项目目录”、“大器项目目录/include”及“大器项目目录/nlohmann_json/include/”
下面以CMake的CMakefiles.txt为例:
```cmake
cmake_minimum_required(VERSION 3.5)
project(hello_daqi LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -Wall")
# 此处设置大器项目目录
set(_DAQI_PROJECT_PATH_ "你的大器项目所在目录")
# 此处设置大器项目编译后得到的 .so 文件所在目录
set(_DAQI_LIBRARY_PATH_ "你的大器项目动态库所在目录")
include_directories(${_DAQI_PROJECT_PATH_})
include_directories(${_DAQI_PROJECT_PATH_}/include)
include_directories(${_DAQI_PROJECT_PATH_}/nlohmann_json/include/)
find_package(Boost 1.65.0 REQUIRED COMPONENTS filesystem system)
link_directories(${_DAQI_LIBRARY_PATH_})
link_libraries(da4qi4)
link_libraries(pthread)
link_libraries(ssl)
link_libraries(crypto)
link_libraries(boost_filesystem)
link_libraries(boost_system)
add_executable(hello_daqi main.cpp)
```
现在你可以从之前 [1.1 一个空转的Web Server](#11-一个空转的web-server) 重新看起。
# 三、运行时外部配套系统
## 3.1 运行时依赖说明
一个Web系统常用到缓存系统和数据库系统。大器框架对二者依赖情况如下:
* 完全不依赖数据库;
* 简单例子不依赖缓存系统,但一旦需要用到Web 系统常见的“会话/SESSION”功能,则需要依赖redis缓存库。
## 3.2 Redis的安装
显然,这已经不是本开源项目的自己的说明内容。不过,反正在Ubuntu Linux下安装Redis就一行话:
```C++
sudo apt install redis-server
```
这不仅会安装redis服务,而且会顺便在本机redis的命令行客户端 redis-cli。
* 有关如何在你写的大器Web Server中实现SESSION,请参看本项目官网www.d2school.com 相关(免费视频)课程;
* 有关Redis的学习,请关注www.d2school.com 课程。
## 3.3 数据库
* 可以使用 mysql 官方的 MySQL C++ Connector;
* 新人强烈推荐: 相对传统的C++封装 : [MySQL++](https://tangentsoft.com/mysqlpp/home) (注:欢迎关注《白话 C++》下册,有详细的 MySQL 数据库及 MySQL++使用的章节;
* 新人推荐: [CppDB](http://cppcms.com/sql/cppdb/)
* 到 [github](https://github.com)上,搜索 “MySQL C++”,你将找到大量国内或国外的MySQL C++连接库;
* 有经验的C++程序员推荐:[sqlpp11](https://github.com/rbock/sqlpp11)
更多课程(视频课程、文字课程),请到 [第2学堂](https://www.d2school.com)查看。
谢谢。
================================================
FILE: cmake_install.cmake
================================================
# Install script for directory: /home/zhuangyan/Projects/CPP/da4qi4
# Set the install prefix
if(NOT DEFINED CMAKE_INSTALL_PREFIX)
set(CMAKE_INSTALL_PREFIX "/usr/local")
endif()
string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
# Set the install configuration name.
if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)
if(BUILD_TYPE)
string(REGEX REPLACE "^[^A-Za-z0-9_]+" ""
CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}")
else()
set(CMAKE_INSTALL_CONFIG_NAME "")
endif()
message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"")
endif()
# Set the component getting installed.
if(NOT CMAKE_INSTALL_COMPONENT)
if(COMPONENT)
message(STATUS "Install component: \"${COMPONENT}\"")
set(CMAKE_INSTALL_COMPONENT "${COMPONENT}")
else()
set(CMAKE_INSTALL_COMPONENT)
endif()
endif()
# Install shared libraries without execute permission?
if(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE)
set(CMAKE_INSTALL_SO_NO_EXE "1")
endif()
# Is this installation the result of a crosscompile?
if(NOT DEFINED CMAKE_CROSSCOMPILING)
set(CMAKE_CROSSCOMPILING "FALSE")
endif()
if(NOT CMAKE_INSTALL_LOCAL_ONLY)
# Include the install script for each subdirectory.
include("/home/zhuangyan/Projects/CPP/da4qi4/nlohmann_json/cmake_install.cmake")
endif()
if(CMAKE_INSTALL_COMPONENT)
set(CMAKE_INSTALL_MANIFEST "install_manifest_${CMAKE_INSTALL_COMPONENT}.txt")
else()
set(CMAKE_INSTALL_MANIFEST "install_manifest.txt")
endif()
string(REPLACE ";" "\n" CMAKE_INSTALL_MANIFEST_CONTENT
"${CMAKE_INSTALL_MANIFEST_FILES}")
file(WRITE "/home/zhuangyan/Projects/CPP/da4qi4/${CMAKE_INSTALL_MANIFEST}"
"${CMAKE_INSTALL_MANIFEST_CONTENT}")
================================================
FILE: da4qi4.astylerc
================================================
# Allman Coding Style Options
# Based on an old AStyle release.
# braces and indent
style=allman
indent=spaces
# indentation
min-conditional-indent=0
max-continuation-indent=80
indent-switches
indent-continuation=3
indent-preproc-block
indent-preproc-define
indent-col1-comments
# padding
pad-oper
pad-header
unpad-paren
align-pointer=type
break-blocks
pad-oper
pad-header
align-pointer=type
align-reference=type
# formatting
break-one-line-headers
break-closing-braces
keep-one-line-statements
convert-tabs
add-braces
close-templates
max-code-length=120
================================================
FILE: include/daqi/application.hpp
================================================
#ifndef DAQI_APPLICATION_HPP
#define DAQI_APPLICATION_HPP
#include <set>
#include <map>
#include <memory>
#include "daqi/def/log_def.hpp"
#include "daqi/def/boost_def.hpp"
#include "daqi/utilities/string_utilities.hpp"
#include "daqi/router.hpp"
#include "daqi/templates.hpp"
#include "daqi/intercepter.hpp"
#include "daqi/websocket/handler_websocket.hpp"
#include "daqi/websocket/connection_websocket.hpp"
namespace da4qi4
{
struct UploadFileSaveOptions
{
enum Strategy
{
always_save
, alway_no_save
, size_greater_than
, size_lesser_than
, extension_is
, extension_is_not
};
bool IsNeedSave(std::string const& extension, size_t filesize_kb) const;
Strategy strategy = always_save;
size_t size_base_kb;
std::set<std::string, Utilities::IgnoreCaseCompare> extensions;
};
struct AppLocalDiskSetting
{
AppLocalDiskSetting()
: template_ext(get_daqi_HTML_template_ext())
{}
AppLocalDiskSetting(AppLocalDiskSetting const&) = default;
AppLocalDiskSetting(AppLocalDiskSetting&&) = default;
std::string log_dir;
std::string static_dir;
std::string template_dir;
std::string template_ext;
std::string temporary_dir;
std::string upload_dir;
};
struct AppLoggerSetting
{
static log::Level const default_log_level = log::Level::info;
static std::size_t const default_max_log_file_size_kb = 5 * 1024;
static std::size_t const default_max_log_file_count = 9;
AppLoggerSetting()
: level(default_log_level),
max_log_file_size_kb(default_max_log_file_size_kb),
max_log_file_count(default_max_log_file_count)
{}
log::Level level;
size_t max_log_file_size_kb;
size_t max_log_file_count;
};
class Application;
using ApplicationPtr = std::shared_ptr<Application>;
class Application
{
private:
Application();
Application(std::string const& name);
Application(std::string const& name
, std::string const& root_url
, fs::path const& root_log
, fs::path const& root_static
, fs::path const& root_template
, fs::path const& root_upload
, fs::path const& root_temporary
, std::string const& template_ext
);
public:
static ApplicationPtr Default()
{
return ApplicationPtr(new Application());
}
static ApplicationPtr Default(std::string const& name)
{
return ApplicationPtr(new Application(name));
}
static ApplicationPtr Customize(std::string const& name
, std::string const& root_url
, fs::path const& root_log
, fs::path const& root_static = ""
, fs::path const& root_template = ""
, fs::path const& root_upload = ""
, fs::path const& root_temporary = ""
, std::string const& template_ext = get_daqi_HTML_template_ext())
{
return ApplicationPtr(new Application(name,
root_url, root_log, root_static,
root_template, root_upload,
root_temporary, template_ext));
}
static ApplicationPtr Customize(std::string const& name, std::string const& url
, AppLocalDiskSetting const& ads)
{
return Customize(name,
url, ads.log_dir, ads.static_dir,
ads.template_dir, ads.upload_dir,
ads.temporary_dir, ads.template_ext);
}
static ApplicationPtr Abortive();
Application(Application const&) = delete;
Application& operator()(Application const&) = delete;
~Application();
bool Init(AppLoggerSetting const& logger_setting, std::string const& template_ext = "")
{
return Init(logger_setting.level
, logger_setting.max_log_file_size_kb, logger_setting.max_log_file_count, template_ext);
}
bool Init(log::Level level, std::string const& template_ext)
{
return Init(level
, AppLoggerSetting::default_max_log_file_size_kb, AppLoggerSetting::default_max_log_file_count
, template_ext);
}
bool Init(log::Level level = AppLoggerSetting::default_log_level,
size_t max_log_file_size_kb = AppLoggerSetting::default_max_log_file_size_kb,
size_t max_log_file_count = AppLoggerSetting::default_max_log_file_count,
std::string const& template_ext = "")
{
return InitLogger(level, max_log_file_size_kb, max_log_file_count)
&& InitPathes()
&& InitTemplates(template_ext);
}
bool Init(std::string const& log_root, log::Level level)
{
return Init(log_root, level, AppLoggerSetting::default_max_log_file_size_kb
, AppLoggerSetting::default_max_log_file_count);
}
bool Init(std::string const& log_root, log::Level level = AppLoggerSetting::default_log_level,
size_t max_log_file_size_kb = AppLoggerSetting::default_max_log_file_size_kb,
size_t max_log_file_count = AppLoggerSetting::default_max_log_file_count)
{
return InitLogger(log_root, level, max_log_file_size_kb, max_log_file_count)
&& InitPathes() && InitTemplates();
}
bool InitLogger(std::string const& log_root, AppLoggerSetting const& logger_setting)
{
return InitLogger(log_root
, logger_setting.level, logger_setting.max_log_file_size_kb
, logger_setting.max_log_file_count);
}
bool InitLogger(std::string const& log_root,
log::Level level = AppLoggerSetting::default_log_level,
size_t max_log_file_size_kb = AppLoggerSetting::default_max_log_file_size_kb,
size_t max_log_file_count = AppLoggerSetting::default_max_log_file_count);
bool InitLogger(AppLoggerSetting const& logger_setting)
{
return InitLogger(logger_setting.level, logger_setting.max_log_file_size_kb, logger_setting.max_log_file_count);
}
bool InitLogger(log::Level level = AppLoggerSetting::default_log_level,
size_t max_log_file_size_kb = AppLoggerSetting::default_max_log_file_size_kb,
size_t max_log_file_count = AppLoggerSetting::default_max_log_file_count);
bool InitPathes();
bool InitTemplates(std::string const& template_ext = "");
void UndesiredTemplates();
#ifdef NDEBUG
bool IsAbortive() const
{
return _is_abortive;
}
#endif
void Mount()
{
_mounted = true;
}
bool IsRuning() const
{
return _mounted && !_disabled;
}
Application& SetStaticRoot(std::string const& root_static)
{
_root_static = root_static;
return *this;
}
Application& SetLogRoot(std::string const& root_log)
{
if (!IsRuning() && log::IsNull(_logger))
{
_root_log = root_log;
}
return *this;
}
Application& SetTemplateRoot(std::string const& root_template)
{
if (!IsRuning())
{
_root_template = root_template;
}
return *this;
}
Application& SetTemplateExt(std::string const& template_ext)
{
if (!IsRuning() && _template_ext != template_ext)
{
_template_ext = template_ext;
}
return *this;
}
Application& SetTemporaryRoot(std::string const& root_temporary)
{
if (!IsRuning())
{
_root_temporary = root_temporary;
}
return *this;
}
Application& SetDefaultCharset(std::string const& charset)
{
if (!IsRuning())
{
_default_charset = charset;
}
return *this;
}
Application& SetUploadRoot(std::string const& root_upload)
{
if (!IsRuning())
{
_root_upload = root_upload;
}
return *this;
}
std::string const& GetName() const
{
return _name;
}
std::string const& GetDefaultCharset() const
{
return _default_charset;
}
std::string const& GetUrlRoot() const
{
return _root_url;
}
fs::path const& GetLogRoot() const
{
return _root_log;
}
fs::path const& GetStaticRootPath() const
{
return _root_static;
}
fs::path const& GetTemplateRoot() const
{
return _root_template;
}
fs::path const& GetUploadRoot() const
{
return _root_upload;
}
std::string const& GetTempateExt() const
{
return _template_ext;
}
bool IsEnable() const
{
return !_disabled;
}
void Disable();
void Enable();
void CheckUpdate();
size_t GetUpoadMaxSizeLimitKB() const
{
return _upload_max_size_limit_kb;
}
void SetUpoadMaxSizeLimitKB(size_t size_limit_kb)
{
_upload_max_size_limit_kb = size_limit_kb;
}
UploadFileSaveOptions const& GetUploadFileSaveOptions() const
{
return _upload_file_save_opt;
}
UploadFileSaveOptions& GetUploadFileSaveOptions()
{
return _upload_file_save_opt;
}
Templates const& GetTemplates() const
{
return _templates;
}
Templates& GetTemplates()
{
return _templates;
}
log::LoggerPtr GetLogger()
{
return _logger;
}
void Handle(Context ctx);
public:
bool AddHandler(HandlerMethod m, std::string const& url, Handler h, std::string const& t = "")
{
return AddHandler(m, router_equals(url), h, t);
}
bool AddHandler(HandlerMethod m, router_equals r, Handler h, std::string const& t = "");
bool AddHandler(HandlerMethod m, router_starts r, Handler h, std::string const& t = "");
bool AddHandler(HandlerMethod m, router_regex r, Handler h, std::string const& t = "");
bool AddHandler(HandlerMethods ms, std::string const& url, Handler h, std::string const& t = "")
{
return AddHandler(ms, router_equals(url), h, t);
}
bool AddHandler(HandlerMethods ms, router_equals e, Handler h, std::string const& t = "");
bool AddHandler(HandlerMethods ms, router_starts e, Handler h, std::string const& t = "");
bool AddHandler(HandlerMethods ms, router_regex e, Handler h, std::string const& t = "");
bool AddEqualsRouter(HandlerMethod m, std::vector<std::string> const& urls, Handler h
, std::string const& t = "");
bool AddStartsRouter(HandlerMethod m, std::vector<std::string> const& urls, Handler h
, std::string const& t = "");
bool AddRegexRouter(HandlerMethod m, std::vector<std::string> const& urls, Handler h
, std::string const& t = "");
public:
bool AddIntercepter(Intercepter::Handler intercepter);
std::pair<Intercepter::ChainIterator, Intercepter::ChainIterator>
GetIntercepterChainRange()
{
return { _intercepters.begin(), _intercepters.end() };
}
public:
std::vector<UniformItem> GetEqualsRouterUniformItems() const;
std::vector<UniformItem> GetStartsRouterUniformItems() const;
std::vector<UniformRegexItem> GetRegexRouterUniformItems() const;
public:
bool RegistWebSocket(std::string const& url, UrlFlag urlflag, Websocket::EventHandlersFactory factory);
bool IsWebSocketRegistered(std::string const& url, UrlFlag urlflag) const;
std::unique_ptr<Websocket::EventsHandler> CreateWebSocketHandler(std::string const& url, UrlFlag urlflag);
public:
void AddWebSocketConnection(Websocket::Connection::Ptr connection);
Websocket::Connection::Ptr WebsocketConnection(std::string const& url, UrlFlag urlflag, std::string const& id);
bool RemoveWebSocketConnection(std::string const& url, UrlFlag urlflag, std::string const& id);
bool RenameWebSocketConnectionID(std::string const& url, UrlFlag urlflag
, std::string const& old_id, std::string const& new_id);
std::list<Websocket::Connection::Ptr> AllWebSocketConnections(std::string const& url, UrlFlag urlflag);
std::list<std::string> AllWebSocketConnectionsID(std::string const& url_full, UrlFlag urlflag);
private:
void default_init();
void default_init_pathes();
void default_init_logger();
void default_init_templates();
private:
Handler* find_handler(const Context& ctx, bool& url_exists, bool& unsupport_method
, std::string const& retry_path = "");
void do_handle(Context& ctx);
private:
EqualsRoutingTable _equalRouter;
StartsWithRoutingTable _startwithsRouter;
RegexMatchRoutingTable _regexRouter;
private:
bool _disabled = false;
bool _mounted = false;
std::string _name;
std::string _default_charset = "UTF-8";
std::string _root_url;
fs::path _root_log;
fs::path _root_static;
fs::path _root_template;
fs::path _root_upload;
fs::path _root_temporary;
std::string _template_ext;
size_t _upload_max_size_limit_kb = 1 * 1024 * 1024;
Templates _templates;
UploadFileSaveOptions _upload_file_save_opt;
private:
Intercepter::Chain _intercepters;
private:
log::LoggerPtr _logger = log::Null();
#ifdef NDEBUG
bool _is_abortive = false;
#endif
private:
std::map<std::string /* url-full */, Websocket::EventHandlersFactory> _websocket_handlers_factory;
private:
std::mutex _m_4_websocket_connections;
std::map <std::string /* url-full */, Websocket::Connections> _websocket_connections;
};
using ApplicationPtr = std::shared_ptr<Application>;
using ApplicationMap = std::map<std::string /* url */
, ApplicationPtr, Utilities::IgnoreCaseCompareDESC>;
class ApplicationMgr
{
public:
ApplicationMgr() = default;
ApplicationMgr(ApplicationMgr const&) = delete;
ApplicationMgr& operator = (ApplicationMgr&) = delete;
void CreateDefault(std::string const& app_name = "");
bool MountApplication(ApplicationPtr app);
void Enable(std::string const& name);
void Disable(std::string const& name);
bool IsExists(std::string const& name) const;
bool IsEnable(std::string const& name) const;
ApplicationPtr FindByURL(std::string const& url);
ApplicationPtr FindByName(std::string const& name);
ApplicationPtr const FindByName(std::string const& name) const;
log::LoggerPtr GetApplicationLogger(std::string const& application_name);
ApplicationMap const& All() const
{
return _map;
}
void Mount();
void CheckTemplatesUpdate();
bool IsEmpty() const
{
return _map.empty();
}
size_t Count() const
{
return _map.size();
}
bool IsFailedApp(ApplicationPtr ptr)
{
#ifdef NDEBUG
return _abortive_app == ptr;
#else
return false;
#endif
}
static void InitAbortiveAppLogRoot(std::string const& log_path);
static std::string const& GetAbortiveAppLogRoot();
private:
#ifdef NDEBUG
ApplicationPtr _abortive_app = Application::Abortive();
#endif
ApplicationMap _map;
bool _mounted = false;
using ApplicationLoggerMap = std::map<std::string /* name */, log::LoggerPtr>;
ApplicationLoggerMap _app_loggers;
};
ApplicationMgr& AppMgr();
void AddDa4Qi4DefaultHandler(ApplicationPtr app);
} // namespace da4qi4
#endif // DAQI_APPLICATION_HPP
================================================
FILE: include/daqi/client/connection_client.hpp
================================================
#ifndef DAQI_CLIENT_CONNECTION_HPP
#define DAQI_CLIENT_CONNECTION_HPP
#include <memory>
#include <boost/asio/ssl/stream.hpp>
#include "llhttp/llhttp.h"
#include "daqi/def/def.hpp"
#include "daqi/net-detail/net_detail_client.hpp"
#include "daqi/utilities/http_utilities.hpp"
#include "daqi/utilities/string_utilities.hpp"
#include "daqi/utilities/html_utilities.hpp"
namespace da4qi4
{
namespace Client
{
class Connection final
{
typedef llhttp_t http_parser;
typedef llhttp_settings_t http_parser_settings;
Connection(IOC& ioc, std::string const& server);
Connection(IOC& ioc, std::string const& server, std::string const& service);
Connection(IOC& ioc, std::string const& server, unsigned short port);
Connection(IOC& ioc, boost::asio::ssl::context& ctx, std::string const& server);
Connection(IOC& ioc, boost::asio::ssl::context& ctx, std::string const& server
, std::string const& service);
Connection(IOC& ioc, boost::asio::ssl::context& ctx, std::string const& server
, unsigned short port);
public:
typedef std::unique_ptr<Connection> Ptr;
static Ptr Create(IOC& ioc, std::string const& server)
{
return Ptr(new Connection(ioc, server));
}
static Ptr Create(IOC& ioc, std::string const& server, std::string const& service)
{
return Ptr(new Connection(ioc, server, service));
}
static Ptr Create(IOC& ioc, std::string const& server, unsigned short port)
{
return Ptr(new Connection(ioc, server, port));
}
static Ptr Create(IOC& ioc, boost::asio::ssl::context& ctx, std::string const& server)
{
return Ptr(new Connection(ioc, ctx, server));
}
static Ptr Create(IOC& ioc, boost::asio::ssl::context& ctx, std::string const& server
, std::string const& service)
{
return Ptr(new Connection(ioc, ctx, server, service));
}
Ptr Create(IOC& ioc, boost::asio::ssl::context& ctx, std::string const& server
, unsigned short port)
{
return Ptr(new Connection(ioc, ctx, server, port));
}
Connection(const Connection&) = delete;
Connection& operator=(const Connection&) = delete;
~Connection();
public:
enum class Error {on_none = 0,
on_resolver,
on_connect,
on_write,
on_read,
on_close
};
public:
Connection& SetMethod(std::string const& method, std::string const& uri);
Connection& SetHTTPVersion(std::string const& version);
Connection& ResetHeaders();
Connection& AddHeader(std::string const& name, std::string const& value);
enum class BodySetAction {none, reset_content_length};
Connection& SetBody(std::string body
, BodySetAction action = BodySetAction::none);
using NotifyFunction = std::function<void (errorcode const&)>;
public:
void Connect(NotifyFunction notify);
void Write(NotifyFunction notify);
void Write(std::string const& body, NotifyFunction notify)
{
SetBody(body);
Write(notify);
}
void Read(NotifyFunction notify);
enum class ActionAfterRequest { keep_connection, close_connection };
void Request(NotifyFunction notify
, ActionAfterRequest action = ActionAfterRequest::keep_connection);
public:
bool ConnectSync();
bool WriteSync(std::size_t& bytes_transferred);
bool ReadSync(std::size_t& bytes_transferred);
bool RequestSync(std::size_t& bytes_wrote, std::size_t& bytes_read
, ActionAfterRequest action = ActionAfterRequest::keep_connection);
bool RequestSync(ActionAfterRequest action = ActionAfterRequest::keep_connection)
{
std::size_t w(0), r(0);
return RequestSync(w, r, action);
}
public:
void Reset();
void Close();
public:
IOC& GetIOC()
{
return _ioc;
}
bool IsWithSSL() const
{
return _with_ssl;
}
std::string const& GetServer() const
{
return _server;
}
Tcp::endpoint const& GetServerAddress() const
{
return _server_endpoint;
}
std::string const& GetRequestMedthod() const
{
return _method;
}
std::string const& GetRequestURI() const
{
return _uri;
}
std::string const& GetRequestHTTPVersion() const
{
return _http_version;
}
ICHeaders const& GetRequestHeaders() const
{
return _request_headers;
}
std::string const& GetRequestBody() const
{
return _request_body;
}
ICHeaders const& GetResponseHeaders() const
{
return _response_headers;
}
std::string const& GetResponseBody() const
{
return _response_body;
}
bool HasError() const
{
return _error != Error::on_none;
}
Error GetError() const
{
return this->_error;
}
std::string const& GetErrorMessage() const
{
return this->_error_msg;
}
unsigned int GetResponseStatusCode() const
{
return (_parser != nullptr) ? _parser->status_code : 0;
}
std::string const& GetResponseStatus() const
{
return _status_buffer;
}
private:
std::string make_request_buffer();
void do_resolver(NotifyFunction notify);
void do_connect(NotifyFunction notify);
void do_write(NotifyFunction notify);
void do_read(NotifyFunction notify);
errorcode do_resolver();
errorcode do_connect();
errorcode do_write(std::size_t& bytes_transferred);
errorcode do_read(std::size_t& bytes_transferred);
void do_close();
private:
void init();
void init_parser();
void init_parser_setting();
static int on_header_field(http_parser* parser, char const* at, size_t length);
static int on_header_value(http_parser* parser, char const* at, size_t length);
static int on_headers_complete(http_parser* parser);
void try_commit_reading_response_header();
static int on_message_begin(http_parser* parser);
static int on_message_complete(http_parser* parser);
static int on_status(http_parser* parser, char const* at, size_t length);
static int on_body(http_parser* parser, char const* at, size_t length);
private:
void reset();
private:
bool _with_ssl;
IOC& _ioc;
Tcp::resolver _resolver;
net_detail::SocketBase* _socket_ptr;
size_t _ioc_index;
net_detail::ReadBuffer _read_buffer;
bool _is_connected = false;
private:
http_parser* _parser;
http_parser_settings _parser_setting;
enum ReadingHeaderPart {header_none_part, header_field_part, header_value_part};
ReadingHeaderPart _reading_header_part = header_none_part;
std::string _reading_header_field;
std::string _reading_header_value;
enum ReadCompletePart {read_none_complete,
read_header_complete,
read_message_complete
};
ReadCompletePart _read_complete = read_none_complete;
private:
std::string _server;
std::string _service;
Tcp::endpoint _server_endpoint;
std::string _method;
std::string _uri;
std::string _http_version;
ICHeaders _request_headers;
std::string _request_body;
std::string _url_buffer;
std::string _status_buffer;
ICHeaders _response_headers;
std::string _response_body;
private:
Error _error;
std::string _error_msg;
NotifyFunction _notify;
};
} // namespace Client
} // namespace da4qi4
#endif // DAQI_CLIENT_CONNECTION_HPP
================================================
FILE: include/daqi/connection.hpp
================================================
#ifndef DAQI_CONNECTION_HPP
#define DAQI_CONNECTION_HPP
#include <memory>
#include <string>
#include "llhttp/llhttp.h"
#include "multipart-parser/multipart_parser.h"
#include "daqi/request.hpp"
#include "daqi/response.hpp"
#include "daqi/handler.hpp"
#include "daqi/net-detail/net_detail_server.hpp"
namespace da4qi4
{
class Application;
class Connection
: public std::enable_shared_from_this<Connection>
{
typedef llhttp_t http_parser;
typedef llhttp_settings_t http_parser_settings;
explicit Connection(IOC& ioc, size_t ioc_index);
explicit Connection(IOC& ioc, size_t ioc_index, boost::asio::ssl::context& ssl_ctx);
public:
static ConnectionPtr Create(IOC& ioc, size_t ioc_index)
{
return ConnectionPtr(new Connection(ioc, ioc_index));
}
static ConnectionPtr Create(IOC& ioc, size_t ioc_index, boost::asio::ssl::context& ssl_ctx)
{
return ConnectionPtr(new Connection(ioc, ioc_index, ssl_ctx));
}
Connection(const Connection&) = delete;
Connection& operator=(const Connection&) = delete;
public:
void Start();
void StartRead();
void StartWrite();
void Stop();
public:
Request const& GetRequest() const
{
return _request;
}
Request& GetRequest()
{
return _request;
}
Response& GetResponse()
{
return _response;
}
Response const& GetResponse() const
{
return _response;
}
bool HasApplication() const
{
return _app != nullptr;
}
std::shared_ptr<Application> GetApplication();
size_t GetIOContextIndex() const
{
return _ioc_index;
}
public:
Tcp::socket& GetSocket()
{
return _socket_ptr->get_socket();
}
bool IsWithSSL() const
{
return _with_ssl;
}
private:
void do_handshake();
void do_read();
void do_write();
void do_close();
void do_write_header_for_chunked();
void do_write_next_chunked_body(clock_t start_wait_clock = 0);
void do_write_chunked_body_finished(errorcode const& ec, size_t bytes_transferred);
void do_upgrade();
private:
void init_parser();
void init_parser_setting();
static int on_header_field(http_parser* parser, char const* at, size_t length);
static int on_header_value(http_parser* parser, char const* at, size_t length);
static int on_headers_complete(http_parser* parser);
static int on_message_begin(http_parser* parser);
static int on_message_complete(http_parser* parser);
static int on_url(http_parser* parser, char const* at, size_t length);
static int on_body(http_parser* parser, char const* at, size_t length);
private:
static int on_multipart_header_field(multipart_parser* parser, char const* at, size_t length);
static int on_multipart_header_value(multipart_parser* parser, char const* at, size_t length);
static int on_multipart_headers_complete(multipart_parser* parser);
static int on_multipart_data_begin(multipart_parser* parser);
static int on_multipart_data(multipart_parser* parser, char const* at, size_t length);
static int on_multipart_data_end(multipart_parser* parser);
static int on_multipart_body_end(multipart_parser* parser);
private:
void update_request_after_header_parsed();
void update_request_url_after_app_resolve();
void try_commit_reading_request_header();
void process_100_continue_request();
void process_app_no_found();
void process_too_large_size_upload();
void try_fix_multipart_bad_request_without_boundary();
void try_init_multipart_parser();
enum MultpartParseStatus { mp_cannot_init = -1, mp_parsing = 0, mp_parse_fail = 1};
MultpartParseStatus do_multipart_parse();
bool try_route_application();
private:
void prepare_response_headers_about_connection();
void prepare_response_headers_for_chunked_write();
void reset();
private:
bool _with_ssl;
std::unique_ptr<net_detail::SocketInterface> _socket_ptr;
size_t _ioc_index;
private:
std::unique_ptr<http_parser> _parser;
http_parser_settings _parser_setting;
std::string _url_buffer;
enum ReadingHeaderPart {header_none_part, header_field_part, header_value_part};
ReadingHeaderPart _reading_header_part = header_none_part;
std::string _reading_header_field;
std::string _reading_header_value;
std::string _body_buffer;
enum ReadCompletePart {read_none_complete,
read_header_complete,
read_message_complete
};
ReadCompletePart _read_complete = read_none_complete;
private:
enum MultipartParsePart {mp_parse_none,
mp_parse_header_field, mp_parse_header_value, mp_parse_headers_complete,
mp_parse_data_begin, mp_parse_data, mp_parse_data_end, mp_parse_body_end
};
void init_multipart_parser(std::string const& boundary);
enum mp_free_flag {will_free_mp_setting = 1, will_free_mp_parser = 2, will_free_mp_both = 3 };
void free_multipart_parser(mp_free_flag flag = will_free_mp_both);
std::unique_ptr<multipart_parser_settings> _mp_parser_setting;
typedef void (* multipart_parser_deleter_t)(multipart_parser*);
std::unique_ptr<multipart_parser, multipart_parser_deleter_t> _mp_parser;
MultiPart _reading_part;
std::string _reading_part_buffer;
MultipartParsePart _multipart_parse_part = mp_parse_none;
net_detail::ReadBuffer _buffer;
net_detail::WriteBuffer _write_buffer;
net_detail::ChunkedBuffer _current_chunked_body_buffer;
private:
Request _request;
Response _response;
std::shared_ptr<Application> _app;
};
} //namespace da4qi4
#endif // DAQI_CONNECTION_HPP
================================================
FILE: include/daqi/context.hpp
================================================
#ifndef DAQI_CONTEXT_HPP
#define DAQI_CONTEXT_HPP
#include <memory>
#include <functional>
#include <list>
#include "daqi/def/def.hpp"
#include "daqi/def/asio_def.hpp"
#include "daqi/def/json_def.hpp"
#include "daqi/request.hpp"
#include "daqi/response.hpp"
#include "daqi/templates.hpp"
#include "daqi/intercepter.hpp"
#include "daqi/rediscli_pool.hpp"
namespace da4qi4
{
class Connection;
using ConnectionPtr = std::shared_ptr<Connection>;
class ContextIMP;
using Context = std::shared_ptr<ContextIMP>;
class Application;
class ContextIMP
: public std::enable_shared_from_this<ContextIMP>
{
ContextIMP(ConnectionPtr cnt);
public:
static Context Make(ConnectionPtr cnt);
~ContextIMP();
ContextIMP(ContextIMP const&) = delete;
ContextIMP& operator = (ContextIMP const&) = delete;
Request const& Req() const;
Response& Res();
std::string const& Req(std::string const& name) const
{
return Req().GetParameter(name);
}
Application& App();
Application const& App() const;
Json const& Data(std::string const& name) const
{
Json::const_iterator it = _data.find(name);
if (it == _data.cend())
{
return theNullJson;
}
return *it;
}
Json& Data(std::string const& name)
{
auto it = _data.find(name);
if (it != _data.end())
{
return *it;
}
_data[name] = Json();
return _data[name];
}
Json const& LoadData(std::string const& name) const
{
return Data(name);
}
void SaveData(std::string const& name, Json const& data)
{
_data[name] = data;
}
void RemoveData(std::string const& name)
{
auto it = _data.find(name);
if (it != _data.end())
{
_data.erase(it);
}
}
Json& ModelData()
{
return Data(model_data_name);
}
Json const& ModelData() const
{
return Data(model_data_name);
}
Json const& LoadModelData() const
{
return LoadData(model_data_name);
}
void SaveModelData(Json const& data)
{
SaveData(model_data_name, data);
}
Json& SessionData()
{
return Data(session_data_name);
}
Json const& SessionData() const
{
return Data(session_data_name);
}
Json LoadSessionData() const
{
return LoadData(session_data_name);
}
void SaveSessionData(Json const& data)
{
SaveData(session_data_name, data);
}
void ClearSessionData();
std::string GetSessionID() const;
Cookie GetSessionCookie() const;
static std::string const& ModelDataName()
{
return model_data_name;
}
static std::string const& SessionDataName()
{
return session_data_name;
}
IOC& IOContext();
size_t IOContextIndex() const;
log::LoggerPtr Logger()
{
return logger();
}
public:
std::string const& GetTemplateName() const
{
return _template_name;
}
void SetTemplateName(std::string const& template_name)
{
_template_name = template_name;
}
void ClearTemplateName()
{
_template_name.clear();
}
public:
void InitRequestPathParameters(std::vector<std::string> const& names
, std::vector<std::string> const& values);
void InitRequestPathParameter(std::string const& value);
public:
ContextIMP& Render();
ContextIMP& Render(Json const& data);
ContextIMP& Render(char const* template_name, Json const& data = theNullJson)
{
return (template_name && *template_name) ? Render(std::string(template_name), data) : Render(data);
}
ContextIMP& Render(std::string const& template_name, Json const& data = theNullJson);
ContextIMP& Render(http_status status, Json const& data);
ContextIMP& Render(std::string const& template_name, http_status status, Json const& data = theNullJson);
ContextIMP& RenderWithoutData(http_status status)
{
return render_with_data(status, theNullJson);
}
ContextIMP& RenderWithoutData(std::string const& template_name)
{
return render_with_data(template_name, theNullJson);
}
ContextIMP& RenderWithoutData(std::string const& template_name, http_status status)
{
return render_with_data(template_name, status, theNullJson);
}
ContextIMP& RenderWithoutData()
{
return render_with_data(theNullJson);
}
public:
ContextIMP& RenderNofound(Json const& data = theNullJson)
{
return render_with_data(HTTP_STATUS_NOT_FOUND, data);
}
ContextIMP& RenderNofound(std::string const& template_name, Json const& data = theNullJson)
{
return render_with_data(template_name, HTTP_STATUS_NOT_FOUND, data);
}
ContextIMP& RenderNofound(char const* const template_name, Json const& data = theNullJson)
{
return render_with_data(std::string(template_name), HTTP_STATUS_NOT_FOUND, data);
}
ContextIMP& RenderBadRequest(Json const& data = theNullJson)
{
return render_with_data(HTTP_STATUS_BAD_REQUEST, data);
}
ContextIMP& RenderBadRequest(std::string const& template_name, Json const& data = theNullJson)
{
return render_with_data(template_name, HTTP_STATUS_BAD_REQUEST, data);
}
ContextIMP& RenderBadRequest(char const* const template_name, Json const& data = theNullJson)
{
return render_with_data(std::string(template_name), HTTP_STATUS_BAD_REQUEST, data);
}
ContextIMP& RenderUnauthorized(Json const& data = theNullJson)
{
return render_with_data(HTTP_STATUS_UNAUTHORIZED, data);
}
ContextIMP& RenderUnauthorized(std::string const& template_name, Json const& data = theNullJson)
{
return render_with_data(template_name, HTTP_STATUS_UNAUTHORIZED, data);
}
ContextIMP& RenderUnauthorized(char const* const template_name, Json const& data = theNullJson)
{
return render_with_data(std::string(template_name), HTTP_STATUS_UNAUTHORIZED, data);
}
ContextIMP& RenderForbidden(Json const& data = theNullJson)
{
return render_with_data(HTTP_STATUS_FORBIDDEN, data);
}
ContextIMP& RenderForbidden(std::string const& template_name, Json const& data = theNullJson)
{
return render_with_data(template_name, HTTP_STATUS_FORBIDDEN, data);
}
ContextIMP& RenderForbidden(char const* const template_name, Json const& data = theNullJson)
{
return render_with_data(std::string(template_name), HTTP_STATUS_FORBIDDEN, data);
}
ContextIMP& RenderNotImplemented(Json const& data = theNullJson)
{
return render_with_data(HTTP_STATUS_NOT_IMPLEMENTED, data);
}
ContextIMP& RenderNotImplemented(std::string const& template_name, Json const& data = theNullJson)
{
return render_with_data(template_name, HTTP_STATUS_NOT_IMPLEMENTED, data);
}
ContextIMP& RenderNotImplemented(char const* const template_name, Json const& data = theNullJson)
{
return render_with_data(std::string(template_name), HTTP_STATUS_NOT_IMPLEMENTED, data);
}
ContextIMP& RenderServiceUnavailable(Json const& data = theNullJson)
{
return render_with_data(HTTP_STATUS_SERVICE_UNAVAILABLE, data);
}
ContextIMP& RenderServiceUnavailable(std::string const& template_name, Json const& data = theNullJson)
{
return render_with_data(template_name, HTTP_STATUS_SERVICE_UNAVAILABLE, data);
}
ContextIMP& RenderServiceUnavailable(char const* const template_name, Json const& data = theNullJson)
{
return render_with_data(std::string(template_name), HTTP_STATUS_SERVICE_UNAVAILABLE, data);
}
ContextIMP& RenderInternalServerError(Json const& data = theNullJson)
{
return render_with_data(HTTP_STATUS_INTERNAL_SERVER_ERROR, data);
}
ContextIMP& RenderInternalServerError(std::string const& template_name, Json const& data = theNullJson)
{
return render_with_data(template_name, HTTP_STATUS_INTERNAL_SERVER_ERROR, data);
}
ContextIMP& RenderInternalServerError(char const* const template_name, Json const& data = theNullJson)
{
return render_with_data(std::string(template_name), HTTP_STATUS_INTERNAL_SERVER_ERROR, data);
}
public:
ContextIMP& Redirect(std::string const& dst_location)
{
this->Res().ReplyRedirect(dst_location);
return *this;
}
public:
bool HasRedis() const
{
return _redis != nullptr;
}
RedisClientPtr Redis()
{
return _redis;
}
public:
void Start();
void Pass();
void Stop();
public:
void StartChunkedResponse();
void NextChunkedResponse(std::string const& body);
void StopChunkedResponse();
private:
ContextIMP& render_with_data(std::string const& template_name, http_status status, Json const& data);
ContextIMP& render_with_data(http_status status, Json const& data);
ContextIMP& render_with_data(std::string const& template_name, Json const& data);
ContextIMP& render_with_data(Json const& data);
private:
void do_intercepter_on_req_dir();
void do_intercepter_on_res_dir();
void next(Intercepter::Result result);
void next_intercepter_on_req_dir(Intercepter::Result result);
void start_intercepter_on_res_dir(Intercepter::Result result);
void next_intercepter_on_res_dir(Intercepter::Result result);
private:
void end();
private:
log::LoggerPtr logger();
private:
using Self = ContextIMP;
typedef std::string const& (Self::*PSSFun)(std::string const&) const;
void regist_string_function_with_one_string_parameter(char const* function_name,
PSSFun func,
std::string defaultValue = Utilities::theEmptyString);
typedef bool (Self::*PBSFun)(std::string const&) const;
void regist_bool_function_with_one_string_parameter(char const* function_name,
PBSFun func, bool defaultValue = false);
private:
void render_on_template(std::string const& templ_name, Template const& templ, Json const& data, http_status status);
std::string render_on_template(std::string const& templ_name, Template const& templ, Json const& data
, bool& server_render_error
, std::string& error_what);
void regist_template_enginer_common_functions();
std::string const& parameter(std::string const& name) const
{
return this->Req().GetParameter(name);
}
bool is_exists_parameter(std::string const& name) const
{
return this->Req().IsExistsParameter(name);
}
std::string const& header(std::string const& field) const
{
return this->Req().GetHeader(field);
}
bool is_exists_header(std::string const& field) const
{
return this->Req().IsExistsHeader(field);
}
std::string const& url_parameter(std::string const& name) const
{
return this->Req().GetUrlParameter(name);
}
bool is_exists_url_parameter(std::string const& name) const
{
return this->Req().IsExistsUrlParameter(name);
}
std::string const& path_parameter(std::string const& name) const
{
return this->Req().GetPathParameter(name);
}
bool is_exists_path_parameter(std::string const& name) const
{
return this->Req().IsExistsPathParameter(name);
}
std::string const& form_data(std::string const& name) const
{
return this->Req().GetFormData(name);
}
bool is_exists_form_data(std::string const& name) const
{
return this->Req().IsExistsFormData(name);
}
std::string const& cookie(std::string const& name) const
{
return this->Req().GetCookie(name);
}
bool is_exists_cookie(std::string const& name) const
{
return this->Req().IsExistsCookie(name);
}
void prepair_template_env();
std::string auto_match_template();
private:
ConnectionPtr _cnt;
Json _data;
TemplatesEnv _env; //every context has it's templats env;
Intercepter::On _intercepter_on;
Intercepter::ChainIterator _intercepter_iter;
Intercepter::ChainIterator _intercepter_beg, _intercepter_end;
RedisClientPtr _redis;
std::string _template_name;
private:
static std::string session_data_name;
static std::string model_data_name;
};
} //namespace da4qi4
#endif // DAQI_CONTEXT_HPP
================================================
FILE: include/daqi/cookie.hpp
================================================
#ifndef DAQI_COOKIE_HPP
#define DAQI_COOKIE_HPP
#include <ctime>
#include <iostream>
#include <string>
#include <limits>
#include "daqi/def/json_def.hpp"
namespace da4qi4
{
struct Cookie
{
enum class HttpOnly {for_http_and_js = 0, for_http_only = 1};
enum class Secure {for_http_and_https = 0, for_https_only = 1};
enum class SameSite {none = 0, lax, strict};
Cookie() = default;
Cookie(Cookie const&) = default;
Cookie(Cookie&& o)
{
_old_version = o._old_version;
_name = std::move(o._name);
_value = std::move(o._value);
_domain = std::move(o._domain);
_path = std::move(o._path);
_max_age = o.expires_after_brower_close;
_http_only = o._http_only;
_secure = o._secure;
_samesite = o._samesite;
}
Cookie& operator = (Cookie const& o) = default;
Cookie& operator = (Cookie&& o) = default;
Cookie(std::string const& name, std::string const& value)
: _name(name), _value(value)
{}
Cookie(std::string const& name, std::string const& value, std::string const& domain)
: _name(name), _value(value), _domain(domain)
{}
Cookie(std::string const& name, std::string const& value
, std::string const& domain, std::string const& path)
: _name(name), _value(value), _domain(domain), _path(path)
{}
std::string const& GetName() const
{
return _name;
}
std::string const& GetDomain() const
{
return _domain;
}
std::string const& GetPath() const
{
return _path;
}
std::string const& GetValue() const
{
return _value;
}
Cookie& SetName(std::string const& name)
{
_name = name;
return *this;
}
Cookie& SetValue(std::string const& value)
{
_name = value;
return *this;
}
Cookie& SetDomain(std::string const& domain)
{
_domain = domain;
return *this;
}
Cookie& SetPath(std::string const& path)
{
_path = path;
return *this;
}
Cookie& ApplyHttpVersion(unsigned short http_version_major, unsigned short http_version_minor)
{
_old_version = ((http_version_major < 1)
|| (http_version_major == 1 && http_version_minor == 0));
return *this;
}
Cookie& SetHttpOnly(HttpOnly only)
{
_http_only = only == HttpOnly::for_http_only;
return *this;
}
bool IsHttpOnly() const
{
return _http_only;
}
Cookie& SetMaxAge(int seconds)
{
_max_age = (seconds >= 0) ? seconds : 0;
return *this;
}
int GetMaxAge() const
{
return _max_age;
}
Cookie& SetExpires(std::time_t a_time_point);
Cookie& SetExpiredAfterBrowerClose()
{
_max_age = expires_after_brower_close;
return *this;
}
bool IsExpiredAfterBrowerClose() const
{
return _max_age == expires_after_brower_close;
}
Cookie& SetExpiredImmediately()
{
_max_age = expires_immediately;
return *this;
}
bool IsExpiredImmediately() const
{
return _max_age == expires_immediately;
}
bool IsOldVersion() const
{
return _old_version;
}
bool IsSecure() const
{
return _secure;
}
Cookie& SetSecure(Secure secure)
{
_secure = (secure == Secure::for_https_only);
return *this;
}
SameSite GetSameSite() const
{
return _samesite;
}
Cookie& SetSameSite(SameSite ss)
{
_samesite = ss;
return *this;
}
void ClearValue()
{
_value.clear();
}
bool IsEmpty() const
{
return _name.empty() && _value.empty();
}
private:
enum
{
expires_after_brower_close = std::numeric_limits<int>::min()
, expires_immediately
};
bool _old_version = false;
std::string _name;
std::string _value;
std::string _domain;
std::string _path;
int _max_age = expires_after_brower_close;
bool _http_only = false;
bool _secure = false;
SameSite _samesite = SameSite::none;
friend std::ostream& operator << (std::ostream&, Cookie const&);
friend void to_json(Json&, Cookie const&);
friend void from_json(Json const&, Cookie&);
};
std::ostream& operator << (std::ostream& os, Cookie const& c);
void to_json(Json& j, Cookie const& c);
void from_json(Json const& j, Cookie& c);
} //namespace da4qi4
#endif // DAQI_COOKIE_HPP
================================================
FILE: include/daqi/da4qi4.hpp
================================================
#ifndef DAQI_DA4QI4_HPP
#define DAQI_DA4QI4_HPP
#include "daqi/def/log_def.hpp"
#include "daqi/server.hpp"
#include "daqi/router.hpp"
#include "daqi/application.hpp"
#endif // DAQI_DA4QI4_HPP
================================================
FILE: include/daqi/def/asio_def.hpp
================================================
#ifndef DAQI_ASIO_DEF_HPP
#define DAQI_ASIO_DEF_HPP
#include <boost/asio.hpp>
#include <boost/asio/ssl.hpp>
namespace da4qi4
{
#ifdef _USE_BOOST_VERSION_GE_1_66_
#define HAS_IO_CONTEXT
#define HAS_RESOLVER_RESULT
#endif
#ifdef HAS_IO_CONTEXT
using IOC = boost::asio::io_context;
#else
using IOC = boost::asio::io_service;
#endif
using Tcp = boost::asio::ip::tcp;
#ifdef HAS_RESOLVER_TYPE_RESULT
typedef Tcp::resolver::results_type ResolverResultT;
#else
typedef Tcp::resolver::iterator ResolverResultT;
#endif
typedef boost::asio::ssl::context_base SSLContextBase;
}
#endif // DAQI_ASIO_DEF_HPP
================================================
FILE: include/daqi/def/boost_def.hpp
================================================
#ifndef DAQI_BOOST_DEF_HPP
#define DAQI_BOOST_DEF_HPP
#include <string>
#include <boost/optional.hpp>
#include <boost/filesystem.hpp>
#include <boost/uuid/uuid.hpp>
#include <boost/uuid/uuid_io.hpp>
#include <boost/asio/placeholders.hpp>
namespace da4qi4
{
extern boost::none_t NoneObject;
using errorcode = boost::system::error_code;
namespace fs = boost::filesystem;
using OptionalString = boost::optional<std::string>;
using OptionalStringRef = boost::optional<std::string&>;
using OptionalStringRefConst = boost::optional<std::string const&>;
namespace asio_placeholders = boost::asio::placeholders;
} //namesapce da4qi4
#endif // DAQI_BOOST_DEF_HPP
================================================
FILE: include/daqi/def/debug_def.hpp
================================================
#ifndef DAQI_DEBUG_DEF_HPP
#define DAQI_DEBUG_DEF_HPP
#include <iostream>
#endif // DAQI_DEBUG_DEF_HPP
================================================
FILE: include/daqi/def/def.hpp
================================================
#ifndef DAQI_DEF_HPP
#define DAQI_DEF_HPP
#include <string>
#include <map>
#include <functional>
#include <memory>
#include <list>
#include <vector>
#include <set>
#include "daqi/utilities/string_utilities.hpp"
namespace da4qi4
{
extern char const* const the_daqi_name;
extern char const* const the_daqi_version;
enum class CacheControl {Public, Private};
enum PathResolve {is_relative, is_absolute}; //for url and dist-directory
using Headers = std::map<std::string, std::string>;
using ICHeaders = std::map<std::string, std::string, Utilities::IgnoreCaseCompare>;
using ICCookies = ICHeaders;
using UrlParameters = std::map<std::string, std::string>;
} //namespace da4qi4
#endif // DAQI_DEF_HPP
================================================
FILE: include/daqi/def/inja_def.hpp
================================================
#ifndef DAQI_INJA_DEF_HPP
#define DAQI_INJA_DEF_HPP
#include <memory>
#include "inja/inja.hpp"
namespace da4qi4
{
using Template = inja::Template;
using TemplatePtr = std::shared_ptr<Template>;
}
#endif // INJA_DEF_HPP
================================================
FILE: include/daqi/def/json_def.hpp
================================================
#ifndef DAQI_JSON_DEF_HPP
#define DAQI_JSON_DEF_HPP
#include "nlohmann/json.hpp"
#include <ctime>
namespace da4qi4
{
using Json = nlohmann::json;
extern Json const theNullJson;
namespace Valuetool
{
extern double const zero_compare_value;
bool is_exists(Json const& j, std::string const& item_name);
bool is_exists(Json const& j, std::vector<std::string>const& name_pathes);
bool boolean_value(Json const& j, bool default_value = false);
bool boolean_value(Json const& j, std::string const& item_name, bool default_value = false);
bool boolean_value(Json const& j, std::vector<std::string>const& name_pathes, bool default_value = false);
int integer_value(Json const& j, int default_value = 0);
int integer_value(Json const& j, std::string const& item_name, int default_value = 0);
int integer_value(Json const& j, std::vector<std::string>const& name_pathes, int default_value = 0);
std::size_t size_value(Json const& j, std::size_t default_value = 0);
std::size_t size_value(Json const& j, std::string const& item_name, std::size_t default_value = 0);
std::size_t size_value(Json const& j, std::vector<std::string>const& name_pathes, std::size_t default_value = 0);
std::time_t time_value(Json const& j, std::time_t default_value = 0);
std::time_t time_value(Json const& j, std::string const& item_name, std::time_t default_value = 0);
std::time_t time_value(Json const& j, std::vector<std::string>const& name_pathes, std::time_t default_value = 0);
double double_value(Json const& j, double default_value = 0.0);
double double_value(Json const& j, std::string const& item_name, double default_value = 0.0);
double double_value(Json const& j, std::vector<std::string>const& name_pathes, double default_value = 0.0);
std::string string_value(Json const& j);
std::string string_value(Json const& j, std::string const& item_name
, std::string const& default_value = "");
std::string string_value(Json const& j, std::vector<std::string>const& name_pathes,
std::string const& default_value = "");
} // namespace Valuetool
} //namespace da4qi4
#endif // DAQI_JSON_DEF_HPP
================================================
FILE: include/daqi/def/log_def.hpp
================================================
#ifndef DAQI_LOG_DEF_HPP
#define DAQI_LOG_DEF_HPP
#include <memory>
#include "spdlog/spdlog.h"
#include "spdlog/sinks/stdout_sinks.h"
#include "spdlog/sinks/file_sinks.h"
namespace da4qi4
{
namespace log
{
using Level = spdlog::level::level_enum;
using LoggerPtr = std::shared_ptr<spdlog::logger>;
bool InitLogger(std::string const& name
, std::string const& server_name
, std::string& error
, std::string const& log_dir, Level level = Level::info
, size_t max_file_size_kb = 5 * 1024
, size_t max_file_count = 9);
bool InitServerLogger(std::string const& log_dir, Level level = Level::info,
size_t max_file_size_kb = 5 * 1024,
size_t max_file_count = 9);
LoggerPtr CreateAppLogger(std::string const& application_name,
std::string const& application_root_log,
Level level,
size_t max_file_size_kb,
size_t max_file_count);
LoggerPtr Null();
LoggerPtr Server();
LoggerPtr App(std::string const& application_name);
bool IsNull(LoggerPtr logger);
void SetLogLevel(Level level);
void SetServerLogLevel(Level level);
void SetAppLogLevel(std::string const& application_name, Level level);
} // namespace log
}
#endif // DAQI_LOG_DEF_HPP
================================================
FILE: include/daqi/def/redis_def.hpp
================================================
#ifndef DAQI_REDIS_DEF_HPP
#define DAQI_REDIS_DEF_HPP
namespace da4qi4
{
extern unsigned short int const redis_server_default_port;
extern char const* const redis_server_default_host;
} //namespace da4qi4
#endif // DAQI_REDIS_DEF_HPP
================================================
FILE: include/daqi/handler.hpp
================================================
#ifndef DAQI_HANDLER_HPP
#define DAQI_HANDLER_HPP
#include "llhttp/llhttp.h"
#include "daqi/context.hpp"
#include <bitset>
#include <initializer_list>
namespace da4qi4
{
enum class HandlerMethod
{
UNSUPPORT = -1,
DELETE = 0,
GET,
HEAD,
POST,
PUT,
ANY = 999
};
extern HandlerMethod _DELETE_, _GET_, _HEAD_, _POST_, _PUT_;
char const* HandlerMethodName(HandlerMethod hm);
HandlerMethod from_http_method(llhttp_method_t m);
using HandlerMethodMark = std::bitset<5>;
struct HandlerMethods
{
HandlerMethods() = default;
HandlerMethods(HandlerMethod m);
HandlerMethods(HandlerMethodMark mark)
: mark(mark)
{
}
HandlerMethods(std::initializer_list<HandlerMethod> lst);
operator HandlerMethodMark() const
{
return mark;
}
void Set(HandlerMethod m);
bool IsSet(HandlerMethod m) const;
HandlerMethodMark mark;
};
using Handler = std::function<void (Context)>;
extern Handler theEmptyHandler;
template<typename C>
Handler member_handler(C* o, void (C::*f)(Context))
{
return std::bind(f, o, std::placeholders::_1);
}
} //namespace da4qi4
#endif // DAQI_HANDLER_HPP
================================================
FILE: include/daqi/intercepter.hpp
================================================
#ifndef INTERCEPTER_HPP
#define INTERCEPTER_HPP
#include <functional>
#include "daqi/def/def.hpp"
#include "daqi/def/json_def.hpp"
namespace da4qi4
{
class ContextIMP;
using Context = std::shared_ptr<ContextIMP>;
namespace Intercepter
{
enum class Result { Pass, Stop };
enum class On {Request, Handle, Response};
using Handler = std::function<void (Context ctx, On on)>;
using Chain = std::list<Handler>;
using ChainIterator = Chain::iterator;
using ChainReverseIterator = std::reverse_iterator<Chain::iterator>;
} //namespace Intercepter
} //namespace da4qi4
#endif // INTERCEPTER_HPP
================================================
FILE: include/daqi/intercepters/session_redis.hpp
================================================
#ifndef DAQI_INTERCEPTER_SESSION_REDIS_HPP
#define DAQI_INTERCEPTER_SESSION_REDIS_HPP
#include <string>
#include "daqi/def/json_def.hpp"
#include "daqi/intercepter.hpp"
#include "daqi/session.hpp"
#include "daqi/rediscli_pool.hpp"
namespace da4qi4
{
namespace Intercepter
{
struct SessionOnRedis
{
SessionOnRedis() = default;
SessionOnRedis(std::string const& name,
std::string const& prefix,
int session_max_age_seconds)
{
_options.name = name;
_options.prefix = prefix;
_options.max_age = session_max_age_seconds;
}
SessionOnRedis(int session_max_age_seconds)
{
_options.max_age = session_max_age_seconds;
}
SessionOnRedis(SessionOptions const& options)
: _options(options)
{
}
SessionOnRedis(SessionOnRedis const&) = default;
SessionOnRedis& operator = (SessionOnRedis const&) = default;
SessionOnRedis& SetName(std::string const& name)
{
_options.name = name;
return *this;
}
SessionOnRedis& SetPrefix(std::string const& prefix)
{
_options.prefix = prefix;
return *this;
}
SessionOnRedis& SetMaxAge(int max_age)
{
_options.max_age = max_age;
return *this;
}
SessionOnRedis& SetDomain(std::string const& domain)
{
_options.domain = domain;
return *this;
}
SessionOnRedis& SetPath(std::string const& path)
{
_options.path = path;
return *this;
}
SessionOnRedis& SetHttpOnly(Cookie::HttpOnly http_only)
{
_options.http_only = http_only;
return *this;
}
SessionOnRedis& SetSecure(Cookie::Secure secure)
{
_options.secure = secure;
return *this;
}
SessionOnRedis& SetSameSite(Cookie::SameSite samesite)
{
_options.samesite = samesite;
return *this;
}
SessionOptions const& GetOptions() const
{
return _options;
}
public:
void operator()(Context ctx, On on) const;
private:
void on_request(Context& ctx) const;
void on_response(Context& ctx) const;
Json create_new_session() const;
private:
SessionOptions _options;
};
} //namespace Intercepter
} //namespace da4qi4
#endif // DAQI_INTERCEPTER_SESSION_REDIS_HPP
================================================
FILE: include/daqi/intercepters/static_file.hpp
================================================
#ifndef DAQI_INTERCEPTER_STATIC_FILE_HPP
#define DAQI_INTERCEPTER_STATIC_FILE_HPP
#include <functional>
#include <vector>
#include <string>
#include <map>
#include "daqi/def/boost_def.hpp"
#include "daqi/intercepter.hpp"
namespace da4qi4
{
namespace Intercepter
{
struct StaticFile
{
static std::string const data_name;
StaticFile()
: _cache_max_age(300)
, _url_resolve_type(PathResolve::is_relative)
, _dir_resolve_type(PathResolve::is_relative)
{
}
StaticFile(int cache_max_age
, PathResolve url_resolve_type = PathResolve::is_relative
, PathResolve dir_resolve_type = PathResolve::is_relative)
: _cache_max_age(cache_max_age)
, _url_resolve_type(url_resolve_type)
, _dir_resolve_type(dir_resolve_type)
{
}
StaticFile(StaticFile const&) = default;
StaticFile& operator = (StaticFile const&) = default;
int GetCacheMaxAge() const
{
return _cache_max_age;
}
StaticFile& SetCacheMaxAge(int seconds)
{
_cache_max_age = seconds;
return *this;
}
PathResolve GetUrlResolveType() const
{
return _url_resolve_type;
}
StaticFile& SetUrlResolveType(PathResolve type)
{
_url_resolve_type = type;
return *this;
}
PathResolve GetDirResolveType() const
{
return _dir_resolve_type;
}
StaticFile& SetDirResolveType(PathResolve type)
{
_dir_resolve_type = type;
return *this;
}
StaticFile& AddEntry(std::string const& url_root, std::string const& dir_root = "");
StaticFile& AddDefaultFileName(std::string const& index_filename);
StaticFile& AddDefaultFileNames(std::vector<std::string> const& index_filenames);
std::vector<std::string> const& GetDefaultFileNames() const
{
return _default_filenames;
}
void operator()(Context ctx, On on) const;
private:
void on_request(Context& ctx) const;
void on_response(Context& ctx) const;
private:
int _cache_max_age;
PathResolve _url_resolve_type, _dir_resolve_type;
std::map<std::string, std::string, Utilities::CompareDESC> _root_entries;
std::vector<std::string> _default_filenames;
};
} //namespace Intercepter
} //namespace da4qi4
#endif // DAQI_INTERCEPTER_STATIC_FILE_HPP
================================================
FILE: include/daqi/net-detail/net_detail_client.hpp
================================================
#ifndef NET_DETAIL_CLIENT_HPP
#define NET_DETAIL_CLIENT_HPP
#include "daqi/def/boost_def.hpp"
#include "daqi/def/asio_def.hpp"
namespace da4qi4
{
namespace Client
{
namespace net_detail
{
using ReadBuffer = std::array<char, 1024 * 2>;
using SocketConnectionCompletionCallback = std::function<void (errorcode const&)>;
using SocketCompletionCallback = std::function<void (errorcode const&, std::size_t)>;
struct SocketBase
{
virtual ~SocketBase();
virtual void async_connect(Tcp::endpoint const&, SocketConnectionCompletionCallback) = 0;
virtual void async_read_some(ReadBuffer&, SocketCompletionCallback) = 0;
virtual void async_write(char const*, std::size_t, SocketCompletionCallback) = 0;
virtual errorcode sync_connect(Tcp::endpoint const&) = 0;
virtual errorcode sync_read_some(ReadBuffer&, std::size_t& bytes_transferred) = 0;
virtual errorcode sync_write(char const* write_buffer
, std::size_t write_buffer_size
, std::size_t& bytes_transferred) = 0;
virtual void close(errorcode& ec) = 0;
virtual Tcp::socket& get_socket() = 0;
};
struct Socket : SocketBase
{
Socket(IOC& ioc)
: _socket(ioc)
{
}
~Socket() override;
Tcp::socket& get_socket() override;
void async_connect(Tcp::endpoint const& ep,
SocketConnectionCompletionCallback on_connect) override;
void async_read_some(ReadBuffer& read_buffer, SocketCompletionCallback on_read) override;
void async_write(char const* write_buffer, std::size_t size, SocketCompletionCallback on_wrote) override;
errorcode sync_connect(Tcp::endpoint const& ep) override;
errorcode sync_read_some(ReadBuffer& read_buffer, std::size_t& bytes_transferred) override;
errorcode sync_write(char const* write_buffer, std::size_t write_buffer_size
, std::size_t& bytes_transferred) override;
void close(errorcode& ec) override;
private:
Tcp::socket _socket;
};
struct SocketWithSSL : SocketBase
{
SocketWithSSL(IOC& ioc, boost::asio::ssl::context& ssl_ctx)
: _stream(ioc, ssl_ctx)
{
}
~SocketWithSSL() override;
Tcp::socket& get_socket() override;
void async_connect(Tcp::endpoint const& ep,
SocketConnectionCompletionCallback on_connect) override;
void async_read_some(ReadBuffer& read_buffer, SocketCompletionCallback on_read) override;
void async_write(char const* write_buffer, std::size_t size, SocketCompletionCallback on_wrote) override;
errorcode sync_connect(Tcp::endpoint const& ep) override;
errorcode sync_read_some(ReadBuffer& read_buffer, std::size_t& bytes_transferred) override;
errorcode sync_write(char const* write_buffer, std::size_t write_buffer_size
, std::size_t& bytes_transferred) override;
void close(errorcode& ec) override;
private:
boost::asio::ssl::stream<Tcp::socket> _stream;
};
} // namespace net_detail
} // namespace Client
} // namespace da4qi4
#endif // NET_DETAIL_CLIENT_HPP
================================================
FILE: include/daqi/net-detail/net_detail_server.hpp
================================================
#ifndef DAQI_NET_DETAIL_SERVER_HPP
#define DAQI_NET_DETAIL_SERVER_HPP
#include <boost/asio/ssl/stream.hpp>
#include "daqi/def/asio_def.hpp"
#include "daqi/def/boost_def.hpp"
namespace da4qi4
{
namespace net_detail
{
using ReadBuffer = std::array<char, 1024 * 4>;
using WriteBuffer = boost::asio::streambuf;
using ChunkedBuffer = std::string;
using SocketCompletionCallback = std::function<void (errorcode const&, std::size_t)>;
struct SocketInterface
{
virtual ~SocketInterface();
virtual void close(errorcode& ec) = 0;
virtual IOC& get_ioc() = 0;
virtual Tcp::socket& get_socket() = 0;
virtual void async_read_some(ReadBuffer&, SocketCompletionCallback) = 0;
virtual void async_write(WriteBuffer&, SocketCompletionCallback) = 0;
virtual void async_write(ChunkedBuffer const&, SocketCompletionCallback) = 0;
virtual bool IsWithSSL() const = 0;
};
struct Socket : SocketInterface
{
Socket(IOC& ioc)
: _socket(ioc)
{
}
~Socket() override;
void close(errorcode& ec) override
{
_socket.shutdown(boost::asio::socket_base::shutdown_both, ec);
_socket.close(ec);
}
bool IsWithSSL() const override
{
return false;
}
IOC& get_ioc() override;
Tcp::socket& get_socket() override
{
return _socket;
}
void async_read_some(ReadBuffer& read_buffer, SocketCompletionCallback on_read) override
{
_socket.async_read_some(boost::asio::buffer(read_buffer), on_read);
}
void async_write(WriteBuffer& write_buffer, SocketCompletionCallback on_wrote) override
{
boost::asio::async_write(_socket, write_buffer, on_wrote);
}
void async_write(ChunkedBuffer const& chunked_buffer, SocketCompletionCallback on_wrote) override
{
boost::asio::async_write(_socket, boost::asio::buffer(chunked_buffer), on_wrote);
}
private:
Tcp::socket _socket;
};
struct SocketWithSSL : SocketInterface
{
SocketWithSSL(IOC& ioc, boost::asio::ssl::context& ssl_ctx)
: _stream(ioc, ssl_ctx)
{
}
~SocketWithSSL() override;
void close(errorcode& ec) override
{
_stream.lowest_layer().cancel();
_stream.shutdown(ec);
_stream.next_layer().close(ec);
}
bool IsWithSSL() const override
{
return true;
}
IOC& get_ioc() override;
Tcp::socket& get_socket() override
{
return _stream.next_layer();
}
void async_read_some(ReadBuffer& read_buffer, SocketCompletionCallback on_read) override
{
_stream.async_read_some(boost::asio::buffer(read_buffer), on_read);
}
void async_write(WriteBuffer& write_buffer, SocketCompletionCallback on_wrote) override
{
boost::asio::async_write(_stream, write_buffer, on_wrote);
}
void async_write(ChunkedBuffer const& chunked_buffer, SocketCompletionCallback on_wrote) override
{
boost::asio::async_write(_stream, boost::asio::buffer(chunked_buffer), on_wrote);
}
public:
boost::asio::ssl::stream<Tcp::socket>& get_stream()
{
return _stream;
}
private:
boost::asio::ssl::stream<Tcp::socket> _stream;
};
} //namespace net_detail
} // namespace da4qi4
#endif // DAQI_NET_DETAIL_SERVER_HPP
================================================
FILE: include/daqi/redis-client/redis_buffer.hpp
================================================
#ifndef DAQI_REDIS_BUFFER_H
#define DAQI_REDIS_BUFFER_H
#include <string>
#include <vector>
namespace da4qi4
{
struct RedisBuffer
{
RedisBuffer() = default;
RedisBuffer(const char* ptr, size_t dataSize);
RedisBuffer(const char* s);
RedisBuffer(std::string s);
RedisBuffer(std::vector<char> buf);
template<typename SrcT>
RedisBuffer(SrcT const& value)
: data(std::move(std::to_string(value)))
{}
size_t size() const;
std::string data;
};
} // namespace da4qi4
#endif // DAQI_REDIS_BUFFER_H
================================================
FILE: include/daqi/redis-client/redis_client.hpp
================================================
#ifndef DAQI_REDIS_CLIENT_HPP
#define DAQI_FREDIS_CLIENT_HPP
#include <string>
#include <queue>
#include <deque>
#include <boost/noncopyable.hpp>
#include "daqi/def/asio_def.hpp"
#include "daqi/redis-client/redis_buffer.hpp"
#include "daqi/redis-client/redis_value.hpp"
namespace da4qi4
{
enum class RedisClientErrorHandlePolicy {do_nothing, auto_reconnect};
class RedisParser;
/*!!! THE REDISCLIENT IS DESIGNED FOR SINGLE-THREAD (BUT ASYNC-CALL SUPPORTED) !!!*/
class RedisClient
: public boost::noncopyable
{
public:
RedisClient(IOC& ioc,
RedisClientErrorHandlePolicy policy = RedisClientErrorHandlePolicy::do_nothing)
: _socket(ioc), _reconnect_timer(ioc), _error_handle_policy(policy)
{
}
~RedisClient();
void Connect(std::function<void (boost::system::error_code const& ec)> on = nullptr,
std::string const& host = "127.0.0.1", unsigned short port = 6379);
void Reconnect(std::function<void (boost::system::error_code const& ec)> on = nullptr);
void Disconnect();
#ifdef _DEBUG_REDIS_NEED_SYNC_OPERATOR_
bool ConnectSync(std::string const& host = "127.0.0.1", unsigned short port = 6379);
bool ReconnectSync()
{
if (IsConnected())
{
do_disconnect();
return do_sync_connect();
}
return true;
}
RedisValue CommandSync(std::string cmd, std::deque<RedisBuffer> args);
#endif //_DEBUG_REDIS_NEED_SYNC_OPERATOR_
public:
void Command(std::string cmd, std::deque<RedisBuffer> args,
std::function<void(RedisValue value)> on = nullptr);
bool IsConnected() const
{
return _connect_status == is_connected;
}
bool IsConnectting() const
{
return _connect_status == is_connectting;
}
private:
void do_disconnect();
#ifdef _DEBUG_REDIS_NEED_SYNC_OPERATOR_
bool do_sync_connect();
#endif //_DEBUG_REDIS_NEED_SYNC_OPERATOR_
void do_async_connect(std::function<void (boost::system::error_code const& ec)> on);
void on_connect_finished(std::function<void (boost::system::error_code const& ec)> on
, boost::system::error_code const& ec);
bool start_reconnect_timer(std::function<void (boost::system::error_code const& ec)> on);
void start_aysnc_read_and_parse(std::function<void(RedisValue value)> on);
void do_async_read_and_parse(std::shared_ptr<RedisParser> parser, std::function<void(RedisValue value)> on);
private:
void start_async_write();
private:
boost::asio::ip::tcp::socket _socket;
boost::asio::deadline_timer _reconnect_timer;
RedisClientErrorHandlePolicy _error_handle_policy;
std::string _host;
unsigned short _port = 0;
unsigned int _reconnect_count = 0;
private:
using CommandNode = std::pair<std::vector<char>, std::function<void(RedisValue value)>>;
std::queue<CommandNode> _command_queue;
private:
std::string _reply_buf;
std::size_t _reply_parse_beg;
static size_t const _read_buffer_size_ = (1024);
char _tmp_read_buf[_read_buffer_size_];
private:
enum ConnectStatus {not_connect, is_connectting, is_connected};
ConnectStatus _connect_status = not_connect;
};
using RedisClientPtr = std::shared_ptr<RedisClient>;
} // namespace da4qi4
#endif // DAQI_REDIS_CLIENT_HPP
================================================
FILE: include/daqi/redis-client/redis_command.hpp
================================================
#ifndef DAQI_REDIS_COMMAND_HPP
#define DAQI_REDIS_COMMAND_HPP
#include <vector>
#include <deque>
#include "daqi/redis-client/redis_buffer.hpp"
namespace da4qi4
{
std::vector<char> MakeCommand(std::deque<RedisBuffer> const& items);
} // namespace da4qi4
#endif // DAQI_REDIS_COMMAND_HPP
================================================
FILE: include/daqi/redis-client/redis_parser.hpp
================================================
#ifndef DAQI_REDIS_PARSER_HPP
#define DAQI_REDIS_PARSER_HPP
#include <vector>
#include <stack>
#include <boost/variant.hpp>
#include "daqi/redis-client/redis_value.hpp"
namespace da4qi4
{
class RedisParser
{
public:
RedisParser();
enum ParseResult
{
Completed,
Incompleted,
Error,
};
std::pair<size_t, ParseResult> Parse(const char* ptr, size_t size);
RedisValue Result();
protected:
std::pair<size_t, ParseResult> parse_chunk(const char* ptr, size_t size);
inline bool is_char(int c)
{
return c >= 0 && c <= 127;
}
inline bool is_control(int c)
{
return (c >= 0 && c <= 31) || (c == 127);
}
long int buf_to_long(const char* str, size_t size);
private:
enum State
{
Start = 0,
StartArray = 1,
String = 2,
StringLF = 3,
ErrorString = 4,
ErrorLF = 5,
Integer = 6,
IntegerLF = 7,
BulkSize = 8,
BulkSizeLF = 9,
Bulk = 10,
BulkCR = 11,
BulkLF = 12,
ArraySize = 13,
ArraySizeLF = 14,
};
std::stack<State> states;
long int bulkSize;
std::vector<char> buf;
RedisValue redisValue;
// temporary variables
std::stack<long int> arraySizes;
std::stack<RedisValue> arrayValues;
static const char stringReply = '+';
static const char errorReply = '-';
static const char integerReply = ':';
static const char bulkReply = '$';
static const char arrayReply = '*';
};
} //namesapce da4qi4
#endif // DAQI_REDIS_PARSER_HPP
================================================
FILE: include/daqi/redis-client/redis_value.hpp
================================================
#ifndef DAQI_REDIS_VALUE_HPP
#define DAQI_REDIS_VALUE_HPP
#include <string>
#include <stack>
#include <vector>
#include <utility>
#include <boost/variant.hpp>
namespace da4qi4
{
class RedisValue
{
public:
struct ErrorTag {};
RedisValue();
RedisValue(RedisValue&& other);
RedisValue(int64_t i);
RedisValue(const char* s);
RedisValue(const std::string& s);
RedisValue(std::vector<char> buf);
RedisValue(std::vector<char> buf, struct ErrorTag);
RedisValue(std::string const& custom_error, struct ErrorTag);
RedisValue(std::vector<RedisValue> array);
RedisValue(const RedisValue&) = default;
RedisValue& operator = (const RedisValue&) = default;
RedisValue& operator = (RedisValue&&) = default;
// Return the value as a std::string if
// type is a byte string; otherwise returns an empty std::string.
std::string ToString() const;
// Return the value as a std::vector<char> if
// type is a byte string; otherwise returns an empty std::vector<char>.
std::vector<char> ToByteArray() const;
// Return the value as a std::vector<RedisValue> if
// type is an int; otherwise returns 0.
int64_t ToInt() const;
int ToInt32() const
{
return static_cast<int>(ToInt());
}
// Return the value as an array if type is an array;
// otherwise returns an empty array.
std::vector<RedisValue> ToArray() const;
// Return the string representation of the value. Use
// for dump content of the value.
std::string Inspect() const;
// Return true if value not a error
bool IsOk() const;
// Return true if value is a error
bool IsError() const;
// Return true if this is a null.
bool IsNull() const;
// Return true if type is an int
bool IsInt() const;
// Return true if type is an array
bool IsArray() const;
// Return true if type is a string/byte array. Alias for IsString();
bool IsByteArray() const;
// Return true if type is a string/byte array. Alias for IsByteArray().
bool IsString() const;
// Methods for increasing perfomance
// Throws: boost::bad_get if the type does not match
std::vector<char>& GetByteArray();
const std::vector<char>& GetByteArray() const;
std::vector<RedisValue>& GetArray();
const std::vector<RedisValue>& GetArray() const;
bool operator == (const RedisValue& rhs) const;
bool operator != (const RedisValue& rhs) const;
protected:
template<typename T>
T cast_to() const;
template<typename T>
bool type_eq() const;
private:
struct NullTag
{
inline bool operator == (const NullTag&) const
{
return true;
}
};
boost::variant<NullTag, int64_t, std::vector<char>, std::vector<RedisValue>> _value;
bool _error;
};
template<typename T>
T RedisValue::cast_to() const
{
return (_value.type() == typeid(T)) ? boost::get<T>(_value) : T();
}
template<typename T>
bool RedisValue::type_eq() const
{
return (_value.type() == typeid(T));
}
} // namespace da4qi4
#endif // DAQI_REDIS_VALUE_HPP
================================================
FILE: include/daqi/rediscli_pool.hpp
================================================
#ifndef DAQI_REDIS_CLI_POOL_HPP
#define DAQI_REDIS_CLI_POOL_HPP
#include <map>
#include <queue>
#include <mutex>
#include <vector>
#include <memory>
#include <functional>
#include <boost/asio/deadline_timer.hpp>
#include "daqi/def/redis_def.hpp"
#include "daqi/redis-client/redis_client.hpp"
#include "daqi/session.hpp"
namespace da4qi4
{
class IOContextPool;
class RedisClientPool
{
RedisClientPool() = default;
public:
void CreateClients(IOContextPool* ioc_pool
, std::string const& host = redis_server_default_host
, unsigned short port = redis_server_default_port);
void Stop();
~RedisClientPool()
{
clear();
}
RedisClientPtr Get(size_t index)
{
return (index >= 0 && index < _clients.size()) ? _clients[index] : nullptr;
}
private:
void clear();
void on_connect_finished(std::size_t index, boost::system::error_code const& ec);
private:
std::vector<RedisClientPtr> _clients;
friend RedisClientPool& RedisPool();
};
RedisClientPool& RedisPool();
} //nampespace da4qi4
#endif // DAQI_REDIS_CLI_POOL_HPP
================================================
FILE: include/daqi/request.hpp
================================================
#ifndef DAQI_REQUEST_HPP
#define DAQI_REQUEST_HPP
#include <string>
#include <map>
#include <bitset>
#include <vector>
#include "llhttp/llhttp.h"
#include "daqi/def/boost_def.hpp"
#include "daqi/utilities/container_utilities.hpp"
#include "daqi/url.hpp"
namespace da4qi4
{
struct RoutingPathParameters
{
RoutingPathParameters() = default;
RoutingPathParameters(RoutingPathParameters const&) = default;
RoutingPathParameters(RoutingPathParameters&& o)
: _parameters(std::move(o._parameters))
{
}
size_t GetCount() const
{
return _parameters.size();
}
void Clear()
{
_parameters.clear();
}
std::map<std::string, std::string> const& Items() const
{
return _parameters;
}
bool IsExists(std::string const& name) const;
std::string const& Get(std::string const& name) const;
OptionalStringRefConst TryGet(std::string const& name) const;
void InitParameters(std::vector<std::string> const& names
, std::vector<std::string> const& values);
private:
std::map<std::string, std::string> _parameters;
};
struct MultiPart
{
struct SubHeaders
{
std::string value;
ICHeaders headers;
bool IsEmpty() const
{
return value.empty();
}
};
MultiPart() = default;
~MultiPart() = default;
MultiPart(MultiPart const& o);
MultiPart(MultiPart&& o);
size_t HeaderCount() const
{
return _headers.size();
}
size_t DataSize() const
{
return _data.size();
}
bool IsExistsHeader(std::string const& field) const;
std::string const& GetHeader(std::string const& field) const;
OptionalStringRefConst TryGetHeader(std::string const& field) const;
void AppendHeader(std::string&& field, std::string&& value);
ICHeaders& GetHeaders()
{
return _headers;
}
ICHeaders const& GetHeaders() const
{
return _headers;
}
std::string const& GetData() const
{
return _data;
}
std::string&& GetData()
{
return std::move(_data);
}
void SetData(std::string&& data)
{
_data = std::move(data);
}
SubHeaders GetSubHeaders(std::string const& field);
void ClearData()
{
_data.clear();
_data.shrink_to_fit();
}
void Clear()
{
_headers.clear();
_data.clear();
}
enum TransferResult
{
transfer_none, tranfer_formdata,
transfer_file_memory, transfer_file_saved
};
TransferResult GetTransferResult() const
{
return _transfer_result;
}
void SetTransferResult(TransferResult transfer_result)
{
_transfer_result = transfer_result;
}
private:
ICHeaders _headers;
std::string _data;
TransferResult _transfer_result = transfer_none;
};
struct FormDataItem
{
FormDataItem() = default;
FormDataItem(std::string const& name, std::string&& data)
: name(name), data(std::move(data))
{}
std::string name;
enum DataFlag {is_data, is_file_data, is_file_temporary_name};
DataFlag data_flag = is_data;
std::string filename;
std::string content_type;
std::string data;
bool IsData() const
{
return data_flag == is_data || data_flag == is_file_data;
}
bool IsFile() const
{
return data_flag == is_file_data || data_flag == is_file_temporary_name;
}
bool IsSavedFile() const
{
return data_flag == is_file_temporary_name;
}
std::string const& GetSavedFileTemporaryName() const
{
return (!IsSavedFile() ? Utilities::theEmptyString : data);
}
void Reset()
{
name.clear();
data_flag = is_data;
filename.clear();
content_type.clear();
data.clear();
}
};
class Application;
struct UploadFileSaveOptions;
struct UploadFile
{
UploadFile() = default;
UploadFile(UploadFile const&) = default;
UploadFile(UploadFile&& o)
: _field_name(std::move(o._field_name))
, _status(o._status), _stream(std::move(o._stream)), _memory(std::move(o._memory))
, _src_filename(std::move(o._src_filename)), _saved_filename(std::move(o._saved_filename))
, _content_type(std::move(o._content_type))
{
}
bool FromFormDataItem(FormDataItem const& item);
~UploadFile()
{
if (_stream)
{
_stream.close();
}
}
operator bool () const
{
return (_status != no_found) && !((_status == in_stream) && !_stream)
&& !((_status == in_memory) && _memory.empty());
}
bool InMemory() const
{
return _status == in_memory;
}
bool InStream() const
{
return _status == in_stream;
}
bool IsNoFound() const
{
return _status == no_found;
}
std::string const& GetSavedFileName() const
{
return _saved_filename;
}
std::string const& GetSourceFileName() const
{
return _src_filename;
}
std::string const& GetFieldName() const
{
return _field_name;
}
std::string const& GetContentType() const
{
return _content_type;
}
std::string const& Memory() const
{
return _memory;
}
std::ifstream& Stream()
{
return _stream;
}
bool ToMemory();
bool ToStream(Application const& app, std::string const& ext);
bool ToStream(std::string const& temp_filename);
bool SaveTo(std::string const& dst_filename);
private:
enum Status {no_found, in_stream, in_memory};
std::string _field_name;
Status _status = no_found;
std::ifstream _stream;
std::string _memory;
std::string _src_filename;
std::string _saved_filename;
std::string _content_type;
};
class Request
{
public:
enum ParameterSrc
{
fromUnknown = 0, fromUrl, fromPath, fromForm, fromHeader, fromCookie
};
bool IsExistsHeader(std::string const& field) const;
std::string const& GetHeader(std::string const& field) const;
OptionalStringRefConst TryGetHeader(std::string const& field) const;
bool IsExistsUrlParameter(std::string const& name) const;
std::string const& GetUrlParameter(std::string const& name) const;
OptionalStringRefConst TryGetUrlParameter(std::string const& name) const;
void InitPathParameters(std::vector<std::string> const& names
, std::vector<std::string> const& values)
{
_path_parameters.InitParameters(names, values);
}
bool IsExistsPathParameter(std::string const& name) const
{
return _path_parameters.IsExists(name);
}
std::string const& GetPathParameter(std::string const& name) const
{
return _path_parameters.Get(name);
}
OptionalStringRefConst TryGetPathParameter(std::string const& name) const
{
return _path_parameters.TryGet(name);
}
bool IsExistsFormData(std::string const& name) const;
std::string const& GetFormData(std::string const& name) const;
OptionalStringRefConst TryGetFormData(std::string const& name) const;
bool IsExistsCookie(std::string const& name) const;
std::string const& GetCookie(std::string const& name) const;
OptionalStringRefConst TryGetCookie(std::string const& name) const;
ParameterSrc IsExistsParameter(std::string const& name) const
{
//find order : url -> path -> formdata -> header -> cookie
return IsExistsUrlParameter(name) ? fromUrl
: (IsExistsPathParameter(name) ? fromPath
: (IsExistsFormData(name) ? fromForm
: (IsExistsHeader(name) ? fromHeader
: (IsExistsCookie(name) ? fromCookie
: fromUnknown))));
}
bool IsExistsFile(std::string const& field_name) const;
UploadFile GetFile(std::string const& field_name) const;
std::string const& GetParameter(std::string const& name) const;
OptionalStringRefConst TryGetParameter(std::string const& name) const;
std::string const& operator[](std::string const& name) const
{
return GetParameter(name);
}
UrlUnderApp const& GetUrl() const
{
return _url;
}
UrlUnderApp& GetUrl()
{
return _url;
}
llhttp_method_t GetMethod() const
{
return static_cast<llhttp_method_t>(_method);
}
std::string GetHost() const
{
ICHeaders::const_iterator it = _headers.find("Host");
return (it == _headers.cend() ? "" : it->second);
}
std::string GetMethodName() const
{
return llhttp_method_name(GetMethod());
}
ICHeaders const& GetHeader() const
{
return _headers;
}
ICHeaders& GetHeader()
{
return _headers;
}
ICCookies const& GetCookies() const
{
return _cookies;
}
ICCookies& GetCookies()
{
return _cookies;
}
RoutingPathParameters const& GetPathParameters() const
{
return _path_parameters;
}
std::string const& GetMultiPartBoundary() const
{
return _boundary;
}
std::vector<MultiPart>& GetMultiParts()
{
return _multiparts;
}
std::vector<MultiPart> const& GetMultiParts() const
{
return _multiparts;
}
void GetVersion(unsigned short& major, unsigned short& minor) const
{
major = _version_major;
minor = _version_minor;
}
std::pair<unsigned short, unsigned short> GetVersion()
{
return {_version_major, _version_minor};
}
bool IsContentLengthProvided() const
{
return (_flags & F_CONTENT_LENGTH) != 0;
}
uint64_t GetContentLength() const
{
return _content_length;
}
bool IsChunked() const
{
return (_flags & F_CHUNKED) != 0;
}
bool IsUpgrade() const
{
return _addition_flags[upgrade_bit];
}
bool IsFormData() const
{
return _addition_flags[formdata_bit];
}
bool IsFormUrlEncoded() const
{
return _addition_flags[formurlencoded_bit];
}
bool IsOctetStream() const
{
return _addition_flags[octetstream_bit];
}
bool IsMultiPart() const
{
return _addition_flags[multipart_bit];
}
bool IsKeepAlive() const
{
return _addition_flags[keepalive_bit];
}
bool IsBodySkipped() const
{
return (_flags & F_SKIPBODY) != 0;
}
bool HasBody() const
{
return !_body.empty();
}
std::string const& Body() const
{
return _body;
}
public:
bool ParseUrl(std::string&& url);
void ParseContentType();
void ApplyApplication(std::string const& app_url_root);
void AppendHeader(std::string&& field, std::string&& value);
void MarkUpgrade(bool upgrade)
{
_addition_flags.set(upgrade_bit, upgrade);
}
void MarkKeepAlive(bool keep)
{
_addition_flags.set(keepalive_bit, keep);
}
void MarkMultiPart(bool multipart)
{
_addition_flags.set(multipart_bit, multipart);
}
void MarkFormUrlEncoded(bool formurlencoded)
{
_addition_flags.set(formurlencoded_bit, formurlencoded);
}
void MarkOctetStream(bool octetstream)
{
_addition_flags.set(octetstream_bit, octetstream);
}
void MarkFormData(bool formdata)
{
_addition_flags.set(formdata_bit, formdata);
}
void SetMethod(unsigned int method)
{
_method = method;
}
void SetVersion(unsigned short major, unsigned short minor)
{
_version_major = major;
_version_minor = minor;
}
void SetContentLength(uint64_t content_length)
{
_content_length = content_length;
}
void SetFlags(unsigned int flags)
{
_flags = flags;
}
void SetBody(std::string&& body)
{
_body.swap(body);
}
void SetMultiPartBoundary(char const* at, size_t length);
void AddMultiPart(MultiPart&& part)
{
_multiparts.push_back(std::move(part));
}
void TransferHeadersToCookies();
void TransferMultiPartsToFormData(UploadFileSaveOptions const& options
, std::string const& dir);
void ParseFormUrlEncodedData();
void Reset();
std::string Dump() const;
private:
static int const upgrade_bit = 0;
static int const keepalive_bit = 1;
static int const multipart_bit = 2;
static int const formurlencoded_bit = 3;
static int const formdata_bit = 4;
static int const octetstream_bit = 5;
std::bitset<6> _addition_flags;
UrlUnderApp _url;
unsigned int _method = HTTP_GET;
ICHeaders _headers;
unsigned short _version_major = 0;
unsigned short _version_minor = 0;
uint64_t _content_length = 0L;
unsigned int _flags = 0;
std::string _body;
std::string _boundary;
std::vector<MultiPart> _multiparts;
ICCookies _cookies;
std::vector<FormDataItem> _formdata;
RoutingPathParameters _path_parameters;
};
} //namespace da4qi4
#endif // DAQI_REQUEST_HPP
================================================
FILE: include/daqi/response.hpp
================================================
#ifndef DAQI_RESPONSE_HPP
#define DAQI_RESPONSE_HPP
#include <iostream>
#include <functional>
#include <vector>
#include <mutex>
#include "llhttp/llhttp.h"
#include "llhttp/helper/http_status_def.h"
#include "daqi/def/def.hpp"
#include "daqi/def/boost_def.hpp"
#include "daqi/def/json_def.hpp"
#include "daqi/cookie.hpp"
namespace da4qi4
{
std::string const& EmptyBody();
struct ChunkedBodies
{
void PushBack(std::string const& body, bool is_last);
std::string PopFront(bool& is_last);
void Clear();
private:
std::list<std::pair<std::string, bool>> _chunked_bodies;
std::mutex _m;
};
class Response
{
public:
Response();
Response(http_status code)
: _status_code(code)
{}
int GetStatusCode() const
{
return _status_code ;
}
void GetVersion(unsigned short& major, unsigned short& minor) const
{
major = _version_major;
minor = _version_minor;
}
std::pair<unsigned short, unsigned short> GetVersion() const
{
return {_version_major, _version_minor};
}
std::string const& GetCharset() const
{
return _charset;
}
enum ContentTypePart {without_chartset = 0, with_chartset = 1};
std::string GetContentType(ContentTypePart part = with_chartset) const;
std::string const& GetContentEncoding() const
{
return GetHeader("Content-Encoding");
}
ICHeaders const& GetHeaders() const
{
return _headers;
}
std::string const& GetBody() const
{
return _body;
}
std::string PopChunkedBody(bool& is_last)
{
return _chunked_bodies.PopFront(is_last);
}
void PushChunkedBody(std::string const& body, bool is_last)
{
_chunked_bodies.PushBack(body, is_last);
}
bool IsExistsHeader(std::string const& field) const;
std::string const& GetHeader(std::string const& field) const;
OptionalStringRefConst TryGetHeader(std::string const& field) const;
void SetStatusCode(http_status code)
{
_status_code = code;
}
void SetVersion(unsigned short major, unsigned short minor)
{
_version_major = major;
_version_minor = minor;
}
void SetBody(std::string&& body)
{
_body = std::move(body);
}
void SetBody(std::string const& body)
{
_body = body;
}
void SetCharset(std::string const& charset);
void SetContentType(std::string const& content_type);
void SetContentType(std::string const& content_type
, std::string const& content_charset);
void SetContentEncoding(std::string const& encoding)
{
AppendHeader("Content-Encoding", encoding);
}
void AppendHeader(std::string const& field, std::string const& value);
bool IsRedirected() const
{
return IsExistsHeader("Location");
}
void SetLocation(std::string const& dst_location)
{
AppendHeader("Location", dst_location);
}
void SetExpires(std::time_t time_point)
{
AppendHeader("Expires", Utilities::GMTFormatTime(time_point));
}
void CacheControlMaxAge(int max_age_seconds = 0, CacheControl cc = CacheControl::Public)
{
std::string s = (cc == CacheControl::Public) ? "public" : "private";
AppendHeader("Cache-Control", s + ", max-age=" + std::to_string(max_age_seconds));
}
void NoCache()
{
AppendHeader("Cache-Control", "no-cache");
}
void TurnOffCache()
{
AppendHeader("Cache-Control", "no-cache, no-store, must-revalidate");
}
void MarkKeepAlive();
void MarkClose();
bool IsKeepAlive() const;
bool IsClose() const;
void RemoveLocation()
{
_headers.erase("Location");
}
bool IsChunked() const;
void MarkChunked()
{
AppendHeader("Transfer-Encoding", "chunked");
if (_version_major < 1 || _version_minor < 1)
{
_version_major = 1;
_version_minor = 1;
}
}
void SetCookie(std::string const& name, std::string const& value)
{
Cookie cookie(name, value);
cookie.ApplyHttpVersion(_version_major, _version_minor);
SetCookie(cookie);
}
void SetSecureCookie(std::string const& name, std::string const& value)
{
Cookie cookie(name, value);
cookie.SetSecure(Cookie::Secure::for_https_only);
cookie.ApplyHttpVersion(_version_major, _version_minor);
SetCookie(cookie);
}
void SetCookie(std::string const& name, std::string const& value, Cookie::HttpOnly http_only)
{
Cookie cookie(name, value);
cookie.SetHttpOnly(http_only);
cookie.ApplyHttpVersion(_version_major, _version_minor);
SetCookie(cookie);
}
void SetSecureCookie(std::string const& name, std::string const& value, Cookie::HttpOnly http_only)
{
Cookie cookie(name, value);
cookie.SetSecure(Cookie::Secure::for_https_only);
cookie.SetHttpOnly(http_only);
cookie.ApplyHttpVersion(_version_major, _version_minor);
SetCookie(cookie);
}
void SetCookie(std::string const& name, std::string const& value
, std::size_t max_age, Cookie::HttpOnly http_only = Cookie::HttpOnly::for_http_and_js)
{
Cookie cookie(name, value);
cookie.SetMaxAge(static_cast<int>(max_age));
cookie.SetHttpOnly(http_only);
cookie.ApplyHttpVersion(_version_major, _version_minor);
SetCookie(cookie);
}
void SetSecureCookie(std::string const& name, std::string const& value
, std::size_t max_age, Cookie::HttpOnly http_only = Cookie::HttpOnly::for_http_and_js)
{
Cookie cookie(name, value);
cookie.SetSecure(Cookie::Secure::for_https_only);
cookie.SetMaxAge(static_cast<int>(max_age));
cookie.SetHttpOnly(http_only);
cookie.ApplyHttpVersion(_version_major, _version_minor);
SetCookie(cookie);
}
void SetCookie(std::string const& name, std::string const& value
, std::string const& domain, std::string const& path
, std::size_t max_age, Cookie::HttpOnly http_only = Cookie::HttpOnly::for_http_and_js)
{
Cookie cookie(name, value, domain, path);
cookie.SetHttpOnly(http_only);
cookie.SetMaxAge(static_cast<int>(max_age));
cookie.ApplyHttpVersion(_version_major, _version_minor);
SetCookie(cookie);
}
void SetSecureCookie(std::string const& name, std::string const& value
, std::string const& domain, std::string const& path
, std::size_t max_age, Cookie::HttpOnly http_only = Cookie::HttpOnly::for_http_and_js)
{
Cookie cookie(name, value, domain, path);
cookie.SetSecure(Cookie::Secure::for_https_only);
cookie.SetHttpOnly(http_only);
cookie.SetMaxAge(static_cast<int>(max_age));
cookie.ApplyHttpVersion(_version_major, _version_minor);
SetCookie(cookie);
}
void SetCookie(Cookie const& cookie);
void SetCookieExpiredImmediately(std::string const& name
, std::string const& domain = ""
, std::string const& path = "");
std::vector<Cookie> const& GetCookies() const
{
return _cookies;
}
std::vector<Cookie>& GetCookies()
{
return _cookies;
}
void Reset();
public:
void ReplyStatus(int code, std::string body = EmptyBody());
void ReplyOk();
void ReplyOk(const char* body);
void ReplyOk(std::string body);
void ReplyOk(Json const& result);
void ReplyOkJSON(std::string json_string,
std::string const& content_type = "application/json",
std::string const& content_encoding = "utf-8")
{
this->SetContentEncoding(content_encoding);
this->SetContentType(content_type);
ReplyOk(json_string);
}
void ReplyContinue()
{
_status_code = HTTP_STATUS_CONTINUE;
}
void ReplyNofound(std::string body = EmptyBody());
void ReplyGone(std::string body = EmptyBody());
void ReplyUnauthorized(std::string body = EmptyBody());
void ReplyNoAuthoritativeInfo(std::string body = EmptyBody());
void ReplyBadRequest(std::string body = EmptyBody());
void ReplyRangeNotSatisfiable(std::string body = EmptyBody());
void ReplyForbidden(std::string body = EmptyBody());
void ReplyMethodNotAllowed(std::string body = EmptyBody());
void ReplyHttpVersionNotSupported(std::string body = EmptyBody());
void ReplyPayloadTooLarge(std::string body = EmptyBody());
void ReplyUriTooLong(std::string body = EmptyBody());
void ReplyTooManyRequests(std::string body = EmptyBody());
void ReplyLengthRequired()
{
_status_code = HTTP_STATUS_LENGTH_REQUIRED;
}
void ReplyNotImplemented(std::string body = EmptyBody());
void ReplyUnsupportedMediaType(std::string body = EmptyBody());
void ReplyServiceUnavailable(std::string body = EmptyBody());
void ReplyInternalServerError(std::string body = EmptyBody());
void ReplyMovedPermanently(std::string const& dst_location, std::string body = EmptyBody());
enum class RedirectType {temporary, permanent};
void ReplyRedirect(std::string const& dst_location
, RedirectType type = RedirectType::temporary
, std::string body = EmptyBody());
private:
void set_or_default_body(std::string body, bool provide_default_if_body_is_empty = true);
void add_server_header();
private:
int _status_code = HTTP_STATUS_OK;
ICHeaders _headers;
std::string _body;
std::string _charset = "UTF-8";
unsigned short _version_major = 1;
unsigned short _version_minor = 1;
std::vector<Cookie> _cookies;
private:
ChunkedBodies _chunked_bodies;
};
std::ostream& operator << (std::ostream& os, Response const& res);
} //namespace da4qi4
#endif // DAQI_RESPONSE_HPP
================================================
FILE: include/daqi/router.hpp
================================================
#ifndef DAQI_ROUTER_HPP
#define DAQI_ROUTER_HPP
#include <map>
#include <list>
#include <regex>
#include "daqi/utilities/string_utilities.hpp"
#include "daqi/handler.hpp"
namespace da4qi4
{
struct UniformItem
{
UniformItem() = default;
UniformItem(std::string const& url_matcher)
: url_matcher(url_matcher)
{}
std::string method;
std::string url_matcher;
std::string template_name;
};
struct RouterItem
{
std::map<HandlerMethod, Handler> handlers;
std::string template_name;
};
struct RouterResult
{
RouterResult() = default;
RouterResult(RouterItem* item, HandlerMethod method)
{
if (item)
{
template_name = item->template_name;
auto it = item->handlers.find(method);
if (it != item->handlers.end())
{
handler = &(it->second);
}
}
}
Handler* handler = nullptr;
std::string template_name;
std::string error;
};
struct router_equals
{
explicit router_equals(std::string const& s)
: s(s)
{}
operator std::string& ()
{
return s;
}
std::string s;
};
struct router_starts
{
explicit router_starts(std::string const& s)
: s(s)
{}
operator std::string& ()
{
return s;
}
std::string s;
};
struct router_regex
{
explicit router_regex(std::string const& s)
: s(s)
{}
operator std::string& ()
{
return s;
}
std::string s;
};
router_equals operator "" _router_equals(char const* str, std::size_t n);
router_starts operator "" _router_starts(char const* str, std::size_t n);
router_regex operator "" _router_regex(char const* str, std::size_t n);
template<typename IMP, typename Result, bool try_auto_make_template_name>
class RoutingTable
{
private:
IMP* imp()
{
return static_cast<IMP*>(this);
}
public:
bool Add(std::string const& url_matcher, HandlerMethod method, Handler handler,
std::string const& template_name, std::string& error)
{
assert(!url_matcher.empty());
typename IMP::Item* item = imp()->Exists(url_matcher);
if (!item)
{
typename IMP::Item ri;
ri.template_name = template_name;
if (ri.template_name.empty() && try_auto_make_template_name)
{
ri.template_name = url_matcher;
}
if (!ri.template_name.empty() && *(--ri.template_name.end()) == '/')
{
ri.template_name += "index";
}
ri.handlers[method] = handler;
return imp()->Insert(url_matcher, ri, error);
}
else
{
item->handlers[method] = handler;
return true;
}
}
bool Add(std::string const& url_matcher, HandlerMethods methods, Handler handler,
std::string const& template_name, std::string& error)
{
for (size_t i = 0; i < methods.mark.size(); ++i)
{
if (methods.mark[i])
{
HandlerMethod method = static_cast<HandlerMethod>(i);
std::string const* p_template_name = (template_name.empty() ?
&url_matcher : &template_name);
if (!this->Add(url_matcher, method, handler, *p_template_name, error))
{
return false;
}
}
}
return true;
}
Result Search(std::string const& url, HandlerMethod method, bool& url_exists)
{
return imp()->Match(url, method, url_exists);
}
};
class EqualsRoutingTable : public RoutingTable<EqualsRoutingTable, RouterResult, true>
{
using Map = std::map<std::string, RouterItem, Utilities::IgnoreCaseCompare>;
public:
using Item = RouterItem;
using Result = RouterResult;
bool Insert(std::string const& url_matcher, RouterItem const& item, std::string& error)
{
error.clear();
_map.insert(std::make_pair(url_matcher, item));
return true;
}
Item* Exists(std::string const& url_matcher)
{
auto it = _map.find(url_matcher);
return (it == _map.end() ? nullptr : & (it->second));
}
Result Match(std::string const& url, HandlerMethod method, bool& url_exists)
{
auto item = this->Exists(url);
url_exists = (item != nullptr);
return Result(item, method);
}
std::vector<UniformItem> Uniforms() const;
private:
Map _map;
};
struct StartsRouterResult : public RouterResult
{
StartsRouterResult() = default;
StartsRouterResult(RouterItem* item, HandlerMethod method, std::string const& key)
: RouterResult(item, method), key(key)
{}
std::string key;
};
class StartsWithRoutingTable
: public RoutingTable<StartsWithRoutingTable, StartsRouterResult, false>
{
using Map = std::map<std::string, RouterItem, Utilities::IgnoreCaseCompareDESC>;
public:
using Item = RouterItem;
using Result = StartsRouterResult;
bool Insert(std::string const& url_matcher, RouterItem const& item, std::string& error)
{
error.clear();
_map.insert(std::make_pair(url_matcher, item));
return true;
}
Item* Exists(std::string const& url_matcher)
{
auto it = _map.find(url_matcher);
return (it == _map.end() ? nullptr : & (it->second));
}
Result Match(std::string const& url, HandlerMethod method, bool& url_exists);
std::vector<UniformItem> Uniforms() const;
private:
Map _map;
};
struct UniformRegexItem : public UniformItem
{
using UniformItem::UniformItem;
std::string regex_matcher;
};
struct RegexRouterItem : public RouterItem
{
std::string url_matcher;
std::string regex_matcher;
std::regex regex_pattern;
RegexRouterItem() = default;
explicit RegexRouterItem(RouterItem const& base)
: RouterItem(base)
{
}
std::vector<std::string> parameters;
};
struct RegexRouterResult : public RouterResult
{
RegexRouterResult() = default;
RegexRouterResult(RegexRouterItem* item, HandlerMethod method)
: RouterResult(static_cast<RouterItem*>(item), method)
{}
std::vector<std::string> parameters;
std::vector<std::string> values;
};
class RegexMatchRoutingTable :
public RoutingTable<RegexMatchRoutingTable, RegexRouterResult, false>
{
private:
using List = std::list <RegexRouterItem>;
public:
using Item = RegexRouterItem;
using Result = RegexRouterResult;
bool Insert(std::string const& url_matcher, RouterItem const& item, std::string& error);
Item* Exists(std::string const& url_matcher);
Result Match(std::string const& url, HandlerMethod method, bool& url_exists);
std::vector<UniformRegexItem> Uniforms() const;
private:
List _lst;
};
} //namespace da4qi4
da4qi4::router_equals operator "" _da4qi4_router_equals(char const* str, std::size_t n);
da4qi4::router_starts operator "" _da4qi4_router_starts(char const* str, std::size_t n);
da4qi4::router_regex operator "" _da4qi4_router_regex(char const* str, std::size_t n);
#endif // DAQI_ROUTER_HPP
================================================
FILE: include/daqi/server.hpp
================================================
#ifndef DAQI_SERVER_HPP
#define DAQI_SERVER_HPP
#include <atomic>
#include <list>
#include <string>
#include <functional>
#include <boost/asio/deadline_timer.hpp>
#include "daqi/def/asio_def.hpp"
#include "daqi/server_engine.hpp"
#include "daqi/application.hpp"
#include "daqi/handler.hpp"
namespace da4qi4
{
extern int const _detect_templates_interval_seconds_;
class Server
{
public:
enum class WithSSL {no, yes};
using OnNeedSSLPassword = std::function <std::string(std::size_t max_length
, SSLContextBase::password_purpose purpose)>;
struct SSLOptions
{
enum class PrivateKeyType {normal, RSA};
explicit SSLOptions()
: options(boost::asio::ssl::context::default_workarounds
| boost::asio::ssl::context::no_sslv2
| boost::asio::ssl::context::no_sslv3
| boost::asio::ssl::context::no_tlsv1)
, private_key_type(PrivateKeyType::normal), private_key_file_format(SSLContextBase::pem)
, will_verify_client(false), on_need_password(nullptr)
{
}
explicit SSLOptions(OnNeedSSLPassword&& password_callback)
: options(boost::asio::ssl::context::default_workarounds
| boost::asio::ssl::context::no_sslv2
| boost::asio::ssl::context::no_sslv3
| boost::asio::ssl::context::no_tlsv1)
, private_key_type(PrivateKeyType::normal), private_key_file_format(SSLContextBase::pem)
, will_verify_client(false)
, on_need_password(std::forward<OnNeedSSLPassword>(password_callback))
{
}
SSLOptions(SSLContextBase::options options)
: options(options)
, private_key_file_format(SSLContextBase::pem)
{
}
SSLOptions(SSLContextBase::options options, OnNeedSSLPassword&& password_callback)
: options(options)
, private_key_type(PrivateKeyType::normal)
, private_key_file_format(SSLContextBase::pem)
, on_need_password(std::forward<OnNeedSSLPassword>(password_callback))
{
}
void EnableSSLV3()
{
options &= ~boost::asio::ssl::context::no_sslv3;
}
void EnableTLSV1()
{
options &= ~boost::asio::ssl::context::no_tlsv1;
}
void EnableVerifyClient()
{
will_verify_client = true;
}
void DisableVerifyClient()
{
will_verify_client = false;
}
void InitFiles(std::string certificate_chain_file
, std::string private_key_file
, PrivateKeyType private_key_type = PrivateKeyType::normal
, std::string tmp_DiffieHellman_file = ""
, SSLContextBase::file_format private_key_file_format = SSLContextBase::pem)
{
this->certificate_chain_file = std::move(certificate_chain_file); //.pem
this->private_key_file = std::move(private_key_file); //.key
this->private_key_type = private_key_type; //is RSA private key?
this->private_key_file_format = private_key_file_format;
if (!tmp_DiffieHellman_file.empty())
{
this->tmp_DiffieHellman_file = std::move(tmp_DiffieHellman_file);
options |= SSLContextBase::single_dh_use;
}
}
SSLContextBase::options options;
std::string certificate_chain_file;
std::string private_key_file;
PrivateKeyType private_key_type;
SSLContextBase::file_format private_key_file_format;
std::string tmp_DiffieHellman_file;
bool will_verify_client;
OnNeedSSLPassword on_need_password;
};
private:
Server(Tcp::endpoint endpoint, size_t thread_count, SSLOptions const* ssl_opts = nullptr);
public:
using IdleFunction = std::function<void (void)>;
using Ptr = std::unique_ptr<Server>;
static Ptr Supply(unsigned short port, size_t thread_count);
static Ptr Supply(std::string const& host, unsigned short port, size_t thread_count);
static Ptr Supply(std::string const& host, unsigned short port);
static Ptr Supply(unsigned short port = 80);
static Ptr SupplyWithSSL(SSLOptions const& ssl_opt, unsigned short port, size_t thread_count);
static Ptr SupplyWithSSL(SSLOptions const& ssl_opt
, std::string const& host, unsigned short port, size_t thread_count);
static Ptr SupplyWithSSL(SSLOptions const& ssl_opt, std::string const& host, unsigned short port);
static Ptr SupplyWithSSL(SSLOptions const& ssl_opt, unsigned short port = 443);
~Server();
IOContextPool* GetIOContextPool()
{
return &_ioc_pool;
}
public:
bool IsWithSSL() const
{
return _withssl == WithSSL::yes;
}
public:
void Run();
void Stop();
public:
void PauseIdleTimer();
void ResumeIdleTimer();
bool IsIdleTimerRunning() const
{
return _idle_running;
}
void EnableDetectTemplates(int interval_seconds = _detect_templates_interval_seconds_)
{
assert(interval_seconds > 0);
_detect_templates_status.interval_seconds = interval_seconds;
_detect_templates_status.next_timepoint = std::time(nullptr) + interval_seconds;
_detect_templates = true;
if (_running && !_idle_running)
{
ResumeIdleTimer();
}
}
void DisableDetectTemplates()
{
_detect_templates = false;
}
bool IsEnabledDetetTemplates() const
{
return _detect_templates;
}
void AppendIdleFunction(int interval_seconds, IdleFunction func);
public:
ApplicationPtr DefaultApp(std::string const& name = "");
bool Mount(ApplicationPtr app);
public:
ApplicationPtr AddHandler(HandlerMethod m, std::string const& url, Handler h)
{
return AddHandler(m, router_equals(url), h);
}
ApplicationPtr AddHandler(HandlerMethod m, router_equals r, Handler h);
ApplicationPtr AddHandler(HandlerMethod m, router_starts r, Handler h);
ApplicationPtr AddHandler(HandlerMethod m, router_regex r, Handler h);
ApplicationPtr AddHandler(HandlerMethods ms, std::string const& url, Handler h)
{
return AddHandler(ms, router_equals(url), h);
}
ApplicationPtr AddHandler(HandlerMethods ms, router_equals r, Handler h);
ApplicationPtr AddHandler(HandlerMethods ms, router_starts r, Handler h);
ApplicationPtr AddHandler(HandlerMethods ms, router_regex r, Handler h);
bool AddEqualsRouter(HandlerMethod m, std::vector<std::string> const& urls, Handler h);
bool AddStartsRouter(HandlerMethod m, std::vector<std::string> const& urls, Handler h);
bool AddRegexRouter(HandlerMethod m, std::vector<std::string> const& urls, Handler h);
public:
ApplicationPtr PrepareApp(std::string const& url);
private:
void start_accept();
void do_accept();
void do_stop();
private:
void make_default_app_if_empty();
void make_default_app(std::string const& name);
void start_idle_timer();
void on_idle_timer(errorcode const& ec);
void stop_idle_timer();
private:
WithSSL _withssl;
int _idle_interval_seconds;
private:
std::atomic_bool _running;
std::atomic_bool _stopping;
IOContextPool _ioc_pool;
Tcp::acceptor _acceptor;
boost::asio::signal_set _signals;
std::unique_ptr<boost::asio::ssl::context> _ssl_ctx;
std::atomic_bool _idle_running;
std::atomic_bool _detect_templates;
boost::asio::deadline_timer _idle_timer;
struct IdleFunctionStatus
{
IdleFunctionStatus()
: interval_seconds(0), next_timepoint(static_cast<std::time_t>(0))
{}
IdleFunctionStatus(IdleFunctionStatus const&) = default;
IdleFunctionStatus(int interval_seconds, IdleFunction func)
: interval_seconds(interval_seconds),
next_timepoint(std::time(nullptr) + interval_seconds), func(func)
{}
int interval_seconds;
std::time_t next_timepoint;
IdleFunction func;
};
IdleFunctionStatus _detect_templates_status;
std::list<IdleFunctionStatus> _idle_functions;
private:
static int call_idle_function_if_timeout(std::time_t now, IdleFunctionStatus& status);
};
}
#endif // DAQI_SERVER_HPP
================================================
FILE: include/daqi/server_engine.hpp
================================================
#ifndef DAQI_SERVER_ENGINE_HPP
#define DAQI_SERVER_ENGINE_HPP
#include <memory>
#include <thread>
#include <list>
#include <vector>
#include <atomic>
#include <boost/asio.hpp>
#include <boost/noncopyable.hpp>
#include "def/asio_def.hpp"
namespace da4qi4
{
class IOContextPool
: private boost::noncopyable
{
public:
explicit IOContextPool(std::size_t pool_size = 0);
void Run();
void Stop();
size_t Size() const
{
return _io_contexts.size();
}
IOC& GetIOContext();
std::pair<IOC&, size_t> GetIOContextAndIndex();
IOC& GetIOContextByIndex(size_t index);
private:
using IOContextPtr = std::shared_ptr<IOC>;
#ifdef HAS_IO_CONTEXT
using IOContextWork = boost::asio::executor_work_guard<IOC::executor_type>;
#else
using IOContextWork = std::unique_ptr<IOC::work>;
#endif
std::atomic_bool _stopping;
std::vector<IOContextPtr> _io_contexts;
std::list<IOContextWork> _work;
std::size_t _next_index;
std::vector<std::shared_ptr<std::thread>> _threads;
};
} //namespace da4qi4
#endif // DAQI_SERVER_ENGINE_HPP
================================================
FILE: include/daqi/session.hpp
================================================
#ifndef DAQI_SESSION_HPP
#define DAQI_SESSION_HPP
#include <string>
#include "daqi/def/json_def.hpp"
#include "daqi/cookie.hpp"
namespace da4qi4
{
Json MakeNewSession(Cookie const& cookie);
Cookie GetSessionCookie(Json const& session);
extern std::string const session_cookie_name;
struct SessionOptions
{
std::string name = "session_id";
std::string prefix = "sid:";
bool prefix_with_time = true;
std::string domain;
std::string path = "/";
int max_age = 1800;
Cookie::HttpOnly http_only = Cookie::HttpOnly::for_http_only;
Cookie::Secure secure = Cookie::Secure::for_http_and_https;
Cookie::SameSite samesite = Cookie::SameSite::none;
};
} //namespace da4qi4
#endif // DAQI_SESSION_HPP
================================================
FILE: include/daqi/templates.hpp
================================================
#ifndef DAQI_TEMPLATES_HPP
#define DAQI_TEMPLATES_HPP
#include <string>
#include <mutex>
#include <vector>
#include <unordered_map>
#include "daqi/def/inja_def.hpp"
#include "daqi/def/log_def.hpp"
namespace da4qi4
{
void init_template_env(inja::Environment& env);
std::string const& get_daqi_HTML_template_ext();
std::string const& get_daqi_JSON_template_ext();
std::string const& get_daqi_XML_template_ext();
std::string make_daqi_template_ext(std::string const& ext);
using TemplatesEnv = inja::Environment;
class Templates
{
public:
Templates()
: _disabled(false)
{}
Templates(Templates const&) = default;
Templates(std::string const& template_root, std::string const& app_url_root, std::string const& template_ext)
: _root(template_root), _app_prefix(app_url_root), _template_ext(template_ext), _disabled(false)
{}
void InitPathes(std::string const& template_root, std::string const& app_url_root, std::string const& template_ext)
{
auto len = template_root.size();
_root = (len && template_root[len - 1] == '/')
? (template_root.substr(0, template_root.size() - 1))
: template_root;
_app_prefix = app_url_root;
_template_ext = template_ext;
}
bool Preload(log::LoggerPtr app_logger);
TemplatePtr const Get(std::string const& name);
void CopyIncludeTemplateTo(TemplatesEnv& env);
bool ReloadIfFindUpdate();
bool ReloadIfFindNew();
std::string const& GetRoot() const
{
return _root;
}
void Enable()
{
_disabled = false;
}
void Disable()
{
_disabled = true;
}
bool IsDisabled() const
{
return _disabled;
}
private:
bool reload();
private:
enum class TemplateFlag {for_normal, for_include};
std::pair<size_t, size_t>
load_templates(std::string const& template_ext, std::string const& key_ext);
std::pair<size_t, size_t>
load_templates(TemplatesEnv& env
, std::string const& template_ext
, std::string const& key_ext
, TemplateFlag flag);
bool try_load_template(TemplatesEnv& env
, std::string const& key
, std::string const& template_filename
, std::string const& full_template_filename
, bool is_include_dir) noexcept;
enum class TemplateUpdateAction
{
none, appended, modified, removed
};
TemplateUpdateAction check_exists_template();
TemplateUpdateAction check_new_template(std::string const& template_ext
, std::string const& key_ext);
void hint_template_updated_found(TemplateUpdateAction action);
void hint_template_reload_fail();
struct Item
{
TemplatePtr templ;
std::string filename;
};
TemplateUpdateAction check_exists_template(std::unordered_map<std::string, Item> const& templates);
private:
std::mutex _m; // for _templates reload and get
log::LoggerPtr _app_logger;
std::time_t _loaded_time;
std::unordered_map<std::string, Item> _templates;
std::unordered_map<std::string, Item> _includes_templates;
std::string _root, _app_prefix, _template_ext;
bool _disabled;
};
} //namesapce da4qi4
#endif // DAQI_TEMPLATE_LIBRARY_HPP
================================================
FILE: include/daqi/url.hpp
================================================
#ifndef DAQI_URL_HPP
#define DAQI_URL_HPP
#include <string>
#include "daqi/def/def.hpp"
namespace da4qi4
{
struct UrlBase
{
std::string full;
std::string schema;
std::string host;
unsigned short port;
std::string path;
std::string query;
std::string fragment;
std::string userinfo;
UrlParameters parameters;
bool Parse(std::string&& url_value);
void Clear()
{
full.clear();
schema.clear();
host.clear();
port = 0;
path.clear();
query.clear();
fragment.clear();
userinfo.clear();
parameters.clear();
}
};
struct UrlUnderApp : public UrlBase
{
std::string full_under_app;
std::string path_under_app;
void UnderApplication(std::string const& app_url_root);
};
UrlBase FromUrlUnderApp(UrlUnderApp&& src);
typedef UrlUnderApp Url;
enum class UrlFlag
{
url_full_path, url_without_app_root
};
std::string JoinUrlPath(std::string const& app_root, std::string const& path);
std::string MakesureFullUrlPath(std::string const& path, UrlFlag flag, std::string const& app_root);
} //namespace da4qi4
#endif // DAQI_URL_HPP
================================================
FILE: include/daqi/utilities/asio_utilities.hpp
================================================
#ifndef DAQI_ASIO_UTILITIES_HPP
#define DAQI_ASIO_UTILITIES_HPP
#include <string>
#include <vector>
#include <functional>
#include "daqi/def/asio_def.hpp"
#include "daqi/def/boost_def.hpp"
namespace da4qi4
{
namespace Utilities
{
Tcp::endpoint make_endpoint(char const* host, unsigned short port);
Tcp::endpoint make_endpoint(std::string const& host, unsigned short port);
std::vector<Tcp::endpoint> from_http_host_sync(std::string const& host, IOC& ioc
, std::string const& service //http ? https?
, std::string& exception);
using HostResolveHandler = std::function<void (errorcode const& ec, ResolverResultT)>;
void from_host(std::string const& host
, std::string const& service //http ? https? or port numbers
, Tcp::resolver& resolver, HostResolveHandler handler);
ResolverResultT from_host(std::string const& host
, std::string const& service //http ? https? or port numbers
, Tcp::resolver& resolver
, errorcode& ec);
} //namespace Utilities
} //namespace da4qi4
#endif // DAQI_ASIO_UTILITIES_HPP
================================================
FILE: include/daqi/utilities/base64_utilities.hpp
================================================
#ifndef DAQI_BASE64_HPP
#define DAQI_BASE64_HPP
#include <cstdint>
#include <string>
namespace da4qi4
{
namespace Utilities
{
std::string Base64Encode(std::uint8_t const* value, std::size_t len);
std::string Base64Encode(std::string const& value);
std::string Base64Decode(std::string const& base64);
} // namespace Utilities
} // namespace da4qi4
#endif // DAQI_BASE64_HPP
================================================
FILE: include/daqi/utilities/container_utilities.hpp
================================================
#ifndef DAQI_CONTAINER_UTILITIES_HPP
#define DAQI_CONTAINER_UTILITIES_HPP
#include <string>
#include "daqi/def/def.hpp"
#include "daqi/def/boost_def.hpp"
#include "daqi/utilities/string_utilities.hpp"
namespace da4qi4
{
namespace Utilities
{
template<typename HeadersT>
bool IsExistsHeader(HeadersT const& headers, std::string const& field)
{
auto const it = headers.find(field);
return it != headers.cend();
}
template<typename HeadersT>
std::string const& GetHeader(HeadersT const& headers, std::string const& field)
{
auto const it = headers.find(field);
return (it != headers.cend() ? it->second : Utilities::theEmptyString);
}
template<typename HeadersT>
OptionalStringRefConst TryGetHeader(HeadersT const& headers, std::string const& field)
{
auto const it = headers.find(field);
return (it == headers.cend() ? OptionalStringRefConst(NoneObject)
: OptionalStringRefConst(it->second));
}
} //namespace Utilities
} //namespace da4qi4
#endif // DAQI_CONTAINER_UTILITIES_HPP
================================================
FILE: include/daqi/utilities/des3_utilities.hpp
================================================
#ifndef DAQI_DES3_UTILITIES_HPP
#define DAQI_DES3_UTILITIES_HPP
#include <string>
namespace da4qi4
{
namespace Utilities
{
std::string DESEncrypt(std::string const& clearText, std::string const& key);
std::string DESDecrypt(std::string const& cipherText, std::string const& key);
} // namespace Utilities
} // namespace da4qi4
#endif // DES3_UTILITIES_HPP
================================================
FILE: include/daqi/utilities/encoding_utilities.hpp
================================================
#ifndef ENCODING_UTILITIES_HPP
#define ENCODING_UTILITIES_HPP
#include <iconv.h>
#include <string>
namespace da4qi4
{
namespace Utilities
{
namespace iconvpp
{
class Converter
{
public:
Converter(char const* in_encode, char const* out_encode,
bool _ignore_error = false, std::size_t const& buf_size = 1024);
~Converter();
std::string const& Error() const
{
return _err;
};
operator bool () const noexcept
{
return _err.empty() && _iconv && (_iconv != reinterpret_cast<iconv_t>(-1));
}
bool operator !() const noexcept
{
return !_err.empty() || !_iconv || (_iconv == reinterpret_cast<iconv_t>(-1));
}
std::size_t IgnoreCount() const noexcept
{
return _ignore_count;
}
bool Convert(std::string const& input, std::string& output);
private:
iconv_t _iconv;
bool _ignore_error;
const size_t _buf_size;
std::string _err;
std::size_t _ignore_count;
};
} //namespace iconvpp
std::wstring FromUTF8(std::string const& utf8str, std::string& err);
std::string ToUTF8(std::wstring const& wstr, std::string& err);
std::wstring FromUTF8(std::string const& utf8str);
std::string ToUTF8(std::wstring const& wstr);
std::string ToGBK(std::string const& utf8str, std::string& err);
std::string ToGBK(std::string const& utf8str);
std::string FromGBK(std::string const& gbkstr, std::string& err);
std::string FromGBK(std::string const& gbkstr);
} //namespace Utilities
} //namespace da4qi4
#endif // ENCODING_UTILITIES_HPP
================================================
FILE: include/daqi/utilities/file_utilities.hpp
================================================
#ifndef DAQI_FILE_UTILITIES_HPP
#define DAQI_FILE_UTILITIES_HPP
#include <string>
#include "daqi/def/boost_def.hpp"
namespace da4qi4
{
namespace Utilities
{
bool SaveDataToFile(std::string const& data, std::string const& filename_with_path, std::string& err);
bool SaveDataToFile(std::string const& data, fs::path const& filename_with_path, std::string& err);
bool IsFileExists(fs::path const& fullpath);
bool IsFileExists(std::string const& fullpath);
enum class FileOverwriteOptions
{
ignore_success,
ignore_fail,
overwrite
};
std::pair<bool, std::string /*msg*/>
CopyFile(fs::path const& src, fs::path const& dst, FileOverwriteOptions overwrite);
std::pair<bool, std::string /*msg*/>
MoveFile(fs::path const& src, fs::path const& dst, FileOverwriteOptions overwrite);
} //namesapce Utilities
} //namespace da4qi4
#endif // DAQI_FILE_UTILITIES_HPP
================================================
FILE: include/daqi/utilities/hmac_sha1_utilities.hpp
================================================
#ifndef DAQI_HMAC_SHA1_UTILITIES_HPP
#define DAQI_HMAC_SHA1_UTILITIES_HPP
#include <cstdint>
#include <vector>
#include <string>
namespace da4qi4
{
namespace Utilities
{
std::vector<std::uint8_t> HMA_SHA1(std::string const& key, std::string const& src);
std::vector<std::uint8_t> HMA_SHA1(char const* key, int key_size, std::string const& src);
std::vector<std::uint8_t> HMA_SHA1(char const* key, int key_size, char const* src, std::size_t src_size);
std::vector<std::uint8_t> SHA1(std::string const& src);
std::vector<std::uint8_t> SHA1(unsigned char const*& src, std::size_t src_size);
std::vector<std::uint8_t> SHA1(std::vector<unsigned char> const& src);
} // namespace Utilities
} // namespace da4qi4
#endif // DAQI_HMAC_SHA1_UTILITIES_HPP
================================================
FILE: include/daqi/utilities/html_utilities.hpp
================================================
#ifndef DAQI_HTML_UTILITIES_HPP
#define DAQI_HTML_UTILITIES_HPP
#include <string>
#include <map>
#include <unordered_map>
namespace da4qi4
{
namespace Utilities
{
std::string const& GetMIMEType(std::string const& extension);
std::string HTMLEscape(std::string const& s);
} //Utilities
} //da4qi4
#endif // DAQI_HTML_UTILITIES_HPP
================================================
FILE: include/daqi/utilities/http_utilities.hpp
================================================
#ifndef DAQI_HTTP_UTILITIES_HPP
#define DAQI_HTTP_UTILITIES_HPP
#include <string>
#include <map>
namespace da4qi4
{
namespace Utilities
{
bool IsUrlEncoded(const std::string& value);
std::string UrlEncode(const std::string& value);
std::string UrlDecode(const std::string& value);
std::string UrlDecodeIfEncoded(std::string const& value);
std::map<std::string, std::string> ParseQueryParameters(std::string const& query);
std::map<std::string, std::string> ParsePlainTextFormData(std::string const& body);
} //Utilities
} //da4qi4
#endif // DAQI_HTTP_UTILITIES_HPP
================================================
FILE: include/daqi/utilities/md5_utilities.hpp
================================================
#ifndef DAQI_MD5_UTILITIES_HPP
#define DAQI_MD5_UTILITIES_HPP
#include <string>
namespace da4qi4
{
namespace Utilities
{
enum class MD5ResultEncoding
{
raw, hex
};
std::string MD5(const std::string& src, MD5ResultEncoding encoding = MD5ResultEncoding::hex);
} //namespace Utilities
} //namespace da4qi4
#endif // DAQI_MD5_UTILITIES_HPP
================================================
FILE: include/daqi/utilities/string_utilities.hpp
================================================
#ifndef DAQI_STRING_UTILITIES_HPP
#define DAQI_STRING_UTILITIES_HPP
#include <ctime>
#include <string>
#include <vector>
#include <map>
namespace da4qi4
{
namespace Utilities
{
extern std::string const theEmptyString;
extern char const* dt_fmt_gmt;
extern char const* dt_fmt_yyyy_mm_dd_hh_mm_ss;
extern char const* dt_fmt_yyyy_mm_dd;
extern char const* dt_fmt_yyyy_mm_dd_hh_mm_ss_CN;
extern char const* dt_fmt_yyyy_mm_dd_CN;
std::string GMTFormatTime(std::time_t t);
std::string FormatDateTime(std::time_t t, char const* fmt = dt_fmt_yyyy_mm_dd_hh_mm_ss);
struct IgnoreCaseCompare
{
bool operator()(std::string const& l, std::string const& r) const;
};
struct IgnoreCaseCompareDESC
{
bool operator()(std::string const& l, std::string const& r) const
{
IgnoreCaseCompare compare;
return compare(r, l); /* DESC : swap l, r */
}
};
struct CompareDESC
{
bool operator()(std::string const& l, std::string const& r) const
{
return r < l; /* DESC : swap l, r */
}
};
bool iStartsWith(std::string const& m, std::string const& s);
bool iEquals(std::string const& l, std::string const& r);
bool iLess(std::string const& l, std::string const& r);
bool iEndsWith(std::string const& m, std::string const& s);
bool StartsWith(std::string const& m, std::string const& s);
bool EndsWith(std::string const& m, std::string const& s);
std::string ReplaceAll(std::string const& m, std::string const& bef, std::string const& aft);
enum class TrimOptions {keep_space, trim_all, trim_left, trim_right};
std::vector<std::string> Split(std::string const& m, char c, TrimOptions opt = TrimOptions::keep_space);
std::vector<std::string> SplitByLine(std::string const& m, TrimOptions opt = TrimOptions::keep_space);
void Trim(std::string& m);
std::string TrimCopy(std::string const& m);
void TrimLeft(std::string& m);
std::string TrimLeftCopy(std::string const& m);
void TrimRight(std::string& m);
std::string TrimRightCopy(std::string const& m);
void TrimOnOptions(std::string& m, TrimOptions opt);
std::string TrimOnOptionsCopy(std::string const& m, TrimOptions opt);
std::string GetUUID(std::string const& prefix = theEmptyString);
std::string DecIntToHexStr(std::size_t num);
} //namespace Utilities
} //namespace da4qi4
#endif // DAQI_STRING_UTILITIES_HPP
================================================
FILE: include/daqi/websocket/connection_websocket.hpp
================================================
#ifndef DAQI_CONNECTION_WEBSOCKET_HPP
#define DAQI_CONNECTION_WEBSOCKET_HPP
#include <memory>
#include <string>
#include <mutex>
#include <list>
#include "daqi/url.hpp"
#include "daqi/net-detail/net_detail_server.hpp"
#include "daqi/websocket/frame_websocket.hpp"
#include "daqi/websocket/handler_websocket.hpp"
namespace da4qi4
{
namespace Websocket
{
enum class WriteDataType {continuation = 0, text = 1, binary = 2};
class Connection final : public std::enable_shared_from_this<Connection>
{
Connection(size_t _ioc_index, net_detail::SocketInterface* socket
, UrlUnderApp&& url, ICHeaders&& headers, ICCookies&& cookies
, EventsHandler* handler);
public:
using Ptr = std::shared_ptr<Connection>;
static Ptr Create(size_t ioc_index, net_detail::SocketInterface* socket
, UrlUnderApp&& url, ICHeaders&& headers, ICCookies&& cookies
, EventsHandler* handler);
Connection(const Connection&) = delete;
Connection& operator=(const Connection&) = delete;
public:
bool IsWithSSL() const
{
return (_socket_ptr ? _socket_ptr->IsWithSSL() : false);
}
size_t GetIOContextIndex() const
{
return _ioc_index;
}
Tcp::socket& GetSocket()
{
return _socket_ptr->get_socket();
}
public:
std::string GetURLPath() const;
std::string const& GetID() const
{
return _id;
}
void SetID(std::string const& id)
{
_id = id;
}
Url const* GetURLDataPtr() const
{
return _url.get();
}
void ClearURLData()
{
if (_url)
{
makesure_url_path_storaged();
_url->Clear();
}
}
void ReleaseURLData()
{
if (_url)
{
makesure_url_path_storaged();
_url.reset();
}
}
ICHeaders const& GetHeaders() const
{
return _headers;
}
ICHeaders& GetHeaders()
{
return _headers;
}
void ClearHeaders()
{
_headers.clear();
}
ICCookies const& GetCookies() const
{
return _cookies;
}
ICCookies& GetCookies()
{
return _cookies;
}
void ClearCookies()
{
_cookies.clear();
}
void RemoveHttpInfo()
{
ReleaseURLData();
ClearHeaders();
ClearCookies();
}
EventsHandler* GetEventHandler()
{
return _evt_handler.get();
}
EventsHandler const* GetEventHandler() const
{
return _evt_handler.get();
}
public:
void Start(Context ctx, std::string const& key);
void Write(Context ctx, std::string const& data, WriteDataType type, bool finished);
void Stop(Context ctx);
private:
void start_handshake(Context ctx, std::string const& key);
void start_write(Context ctx);
void start_read(Context ctx);
private:
void append_write_data(Context ctx, std::string data);
private:
void on_read_frame(std::string&& data, FrameType ft, bool is_finished_frame);
private:
void pong(Context ctx);
private:
void makesure_url_path_storaged()
{
if (_full_url_path.empty() && _url)
{
_full_url_path = _url->full;
}
}
private:
std::string _id;
std::string _full_url_path;
std::unique_ptr<net_detail::SocketInterface> _socket_ptr;
std::unique_ptr<Url> _url;
ICHeaders _headers;
ICCookies _cookies;
private:
std::mutex _m_4_write;
std::list<std::string> _data_4_write;
private:
net_detail::ReadBuffer _buffer_4_read;
private:
FrameParser _parser;
Context _ctx_4_parser_callback;
private:
std::unique_ptr<EventsHandler> _evt_handler;
private:
std::uint8_t _last_data_type;
std::uint8_t _error_on_parse;
std::uint8_t _stop_by_self;
private:
size_t _ioc_index;
};
class Connections
{
public:
Connections()
: _m_ptr(new std::mutex)
{
}
Connections(Connections const&) = delete;
Connections& operator = (Connections const&) = delete;
Connections(Connections&& o) = default;
Connections(Connection::Ptr cnt)
: _m_ptr(new std::mutex)
{
assert(!cnt->GetID().empty());
_storage.insert(std::make_pair(cnt->GetID(), cnt));
}
void Add(Connection::Ptr cnt);
bool Remove(std::string const& id);
bool RenameID(std::string const& old_id, std::string const& new_id);
std::shared_ptr<Connection> Get(std::string const& id);
std::shared_ptr<Connection> RandOne();
std::list<Connection::Ptr> All();
std::list<std::string> AllID();
private:
std::unique_ptr<std::mutex> _m_ptr;
std::map<std::string /*id*/, std::weak_ptr<Connection>> _storage;
};
} // namespace Websocket
} // namespace da4qi4
#endif // DAQI_CONNECTION_WEBSOCKET_HPP
================================================
FILE: include/daqi/websocket/context_websocket.hpp
================================================
#ifndef CONTEXT_WEBSOCKET_HPP
#define CONTEXT_WEBSOCKET_HPP
#include <functional>
#include "daqi/def/log_def.hpp"
#include "daqi/websocket/connection_websocket.hpp"
namespace da4qi4
{
class Application;
using ApplicationPtr = std::shared_ptr<Application>;
namespace Websocket
{
class ContextIMP final : public std::enable_shared_from_this<ContextIMP>
{
private:
ContextIMP(bool hold_connection_life, Connection::Ptr cnt, ApplicationPtr app);
public:
static Context Create(Connection::Ptr cnt, ApplicationPtr app);
static Context CreateUnholdConnectionLife(Connection::Ptr cnt, ApplicationPtr app);
~ContextIMP();
IOC& IOContext();
size_t IOContextIndex() const;
public:
Application& App();
Application const& App() const;
ApplicationPtr AppPtr()
{
return _app;
}
log::LoggerPtr Logger();
public:
void SendText(std::string const& str);
void SendText(char const* str, std::size_t len = static_cast<std::size_t>(-1));
void SendFirstText(std::string const& str);
void SendNextText(std::string const& str);
void SendLastText(std::string const& str);
void SendFirstText(char const* str, std::size_t len = static_cast<std::size_t>(-1));
void SendNextText(char const* str, std::size_t len = static_cast<std::size_t>(-1));
void SendLastText(char const* str, std::size_t len = static_cast<std::size_t>(-1));
void SendBinary(std::vector<std::int8_t> const& data);
void SendBinary(char const* data, std::size_t size);
void SendBinary(std::string const& data)
{
SendBinary(data.c_str(), data.size());
}
void SendFirstBinary(std::vector<std::int8_t> const& data);
void SendNextBinary(std::vector<std::int8_t> const& data);
void SendLastBinary(std::vector<std::int8_t> const& data);
void SendFirstBinary(char const* data, std::size_t size);
void SendNextBinary(char const* data, std::size_t size);
void SendLastBinary(char const* data, std::size_t size);
public:
std::string URLPath() const
{
return _cnt->GetURLPath();
}
std::string const& ID() const
{
return _cnt->GetID();
}
bool RenameID(std::string const& new_id);
Url GetURL() const
{
auto p = _cnt->GetURLDataPtr();
return (p) ? *p : Url();
}
ICHeaders const& Headers() const
{
return _cnt->GetHeaders();
}
ICCookies const& Cookies() const
{
return _cnt->GetCookies();
}
void RemoveHTTPInfo()
{
_cnt->RemoveHttpInfo();
}
public:
bool IsHoldConnectionLife() const
{
return _hold_connection_life;
}
public:
Context OtherOne(std::string const& id);
Context OtherOne(std::string const& url, UrlFlag url_flag, std::string const& id);
Context OtherOne(ApplicationPtr other_app, std::string const& url, UrlFlag url_flag, std::string const& id);
private:
bool _hold_connection_life;
Connection::Ptr _cnt;
ApplicationPtr _app;
friend bool operator == (ContextIMP const& o1, ContextIMP const& o2);
};
bool operator == (ContextIMP const& o1, ContextIMP const& o2);
bool operator != (ContextIMP const& o1, ContextIMP const& o2);
class ContextList
{
public:
struct iterator
{
iterator(std::list<Connection::Ptr>::iterator lst_it, std::weak_ptr<Application> app)
: _lst_iterator(lst_it), _app(app)
{}
iterator& operator = (iterator const& o)
{
_lst_iterator = o._lst_iterator;
return *this;
}
bool operator != (iterator const& o)
{
return _lst_iterator != o._lst_iterator;
}
iterator& operator ++()
{
++_lst_iterator;
return *this;
}
iterator operator ++(int)
{
auto tmp = _lst_iterator;
_lst_iterator++;
return iterator(tmp, _app);
}
Context operator * ()
{
return (!_app.lock()) ? nullptr : ContextIMP::CreateUnholdConnectionLife(*_lst_iterator, _app.lock());
}
private:
std::list<Connection::Ptr>::iterator _lst_iterator;
std::weak_ptr<Application> _app;
};
struct const_iterator
{
const_iterator(std::list<Connection::Ptr>::const_iterator lst_it, std::weak_ptr<Application> app)
: _lst_iterator(lst_it), _app(app)
{}
const_iterator& operator = (const_iterator const& o)
{
_lst_iterator = o._lst_iterator;
return *this;
}
bool operator != (const_iterator const& o)
{
return _lst_iterator != o._lst_iterator;
}
const_iterator& operator ++()
{
++_lst_iterator;
return *this;
}
const_iterator operator ++(int)
{
auto tmp = _lst_iterator;
_lst_iterator++;
return const_iterator(tmp, _app);
}
const Context operator * ()
{
return (!_app.lock()) ? nullptr : ContextIMP::CreateUnholdConnectionLife(*_lst_iterator, _app.lock());
}
private:
std::list<Connection::Ptr>::const_iterator _lst_iterator;
std::weak_ptr<Application> _app;
};
public:
ContextList(ApplicationPtr app, std::string const& url, UrlFlag flag);
ContextList(Context src_ctx, std::string const& url, UrlFlag flag);
ContextList(Context src_ctx);
iterator begin();
iterator end();
const_iterator cbegin() const;
const_iterator cend() const;
private:
ApplicationPtr _app;
std::list<Connection::Ptr> _cnt_list;
};
} // namespace Websocket
} // namespace da4qi4
#endif // CONTEXT_WEBSOCKET_HPP
================================================
FILE: include/daqi/websocket/frame_websocket.hpp
================================================
//MIT
//copyright: https://github.com/akzi/xwebsocket
//author: https://github.com/akzi (fuwq, 82018309@qq.com, beijing, China)
#ifndef DAQI_WEBSOCKET_FRAME_HPP
#define DAQI_WEBSOCKET_FRAME_HPP
#include <cassert>
#include <cstdint>
#include <cstring>
#include <string>
#include <functional>
namespace da4qi4
{
namespace Websocket
{
enum FrameType
{
e_continuation = 0x00,
e_text = 0x01,
e_binary = 0x02,
e_connection_close = 0x08,
e_ping = 0x09,
e_pong = 0xa
};
struct FrameHeader
{
uint8_t FIN = 0; //是否是消息的结束帧(分片) 1位
uint8_t RSV1 = 0;
uint8_t RSV2 = 0;
uint8_t RSV3 = 0;
// %x0 表示连续消息分片
// %x1 表示文本消息分片
// %x2 表未二进制消息分片
// %x3-7 为将来的非控制消息片断保留的操作码
// %x8 表示连接关闭
// %x9 表示心跳检查的ping
// %xA 表示心跳检查的pong
// %xB-F 为将来的控制消息片断的保留操作码
FrameType OPCODE = e_continuation;
uint8_t MASK = 0;
uint8_t PAYLOAD_LEN = 0;
uint16_t EXT_PAYLOAD_LEN_16 = 0; //extended payload length 16
uint64_t EXT_PAYLOAD_LEN_64 = 0; //extended payload length 64
uint64_t PAYLOAD_REALY_LEN = 0;
uint32_t MASKING_KEY = 0;
};
class FrameBuilder
{
public:
FrameBuilder() = default;
FrameBuilder& ResetMaskingKey()
{
_frame_header.MASK = 0x00;
return *this;
}
FrameBuilder& SetMaskingKey(uint32_t masking_key)
{
_frame_header.MASK = 0x80;
_frame_header.MASKING_KEY = masking_key;
return *this;
}
FrameBuilder& SetFIN(bool val)
{
_frame_header.FIN = val ? 0x80 : 0;
return *this;
}
FrameBuilder& SetFrameType(FrameType type)
{
_frame_header.OPCODE = type;
return *this;
}
std::string Build(std::string const& data)
{
return Build(data.c_str(), data.length());
}
std::string Build(const char* data, size_t len);
std::string Build(const char* data)
{
size_t len = (data) ? std::strlen(data) : 0;
return Build(data, len);
}
std::string Build()
{
return Build(nullptr, 0);
}
private:
FrameHeader _frame_header;
};
/*
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-------+-+-------------+-------------------------------+
|F|R|R|R| opcode|M| Payload len | Extended payload length |
|I|S|S|S| (4) |A| (7) | (16/64) |
|N|V|V|V| |S| | (if payload len==126/127) |
| |1|2|3| |K| | |
+-+-+-+-+-------+-+-------------+ - - - - - - - - - - - - - - - +
| Extended payload length continued, if payload len == 127 |
+ - - - - - - - - - - - - - - - +-------------------------------+
| |Masking-key, if MASK set to 1 |
+-------------------------------+-------------------------------+
| Masking-key (continued) | Payload Data |
+-------------------------------- - - - - - - - - - - - - - - - +
: Payload Data continued ... :
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
| Payload Data continued ... |
+---------------------------------------------------------------+
*/
class FrameParser
{
public:
using MsgCallback = std::function < void (std::string &&, FrameType, bool) >;
FrameParser()
{
reset();
}
~FrameParser() = default;
FrameParser(FrameParser&& parser)
{
move_reset(std::move(parser));
}
FrameParser& operator= (FrameParser&& parser)
{
move_reset(std::move(parser));
return *this;
}
FrameParser& RegistMsgCallback(MsgCallback const& handle)
{
_msb_cb = handle;
return *this;
}
std::pair<bool, std::string> Parse(void const* data, uint32_t len);
void Reset()
{
reset();
}
private:
void reset();
void move_reset(FrameParser&& parser);
uint32_t parse_fixed_header(const char* data);
uint32_t parse_payload_len(const char* data);
uint32_t parse_extened_payload_len(const char* data, uint32_t len);
void decode_extened_payload_len();
uint32_t parse_masking_key(const char* data, uint32_t len);
uint32_t parse_payload(const char* data, uint32_t len);
private:
enum parser_step
{
e_fixed_header,
e_payload_len,
e_extened_payload_len,
e_masking_key,
e_payload_data,
};
parser_step _parser_step;
//extended payload length write pos
uint32_t _payload_len_offset;
//masking key buffer pos
uint32_t _masking_key_pos;
std::string _payload;
FrameHeader _frame_header;
MsgCallback _msb_cb;
};
} // namespace Websocket
} // namespace da4qi4
#endif // DAQI_WEBSOCKET_FRAME_HPP
================================================
FILE: include/daqi/websocket/handler_websocket.hpp
================================================
#ifndef HANDLER_WEBSOCKET_HPP
#define HANDLER_WEBSOCKET_HPP
#include <functional>
#include <memory>
namespace da4qi4
{
namespace Websocket
{
class ContextIMP;
typedef std::shared_ptr<ContextIMP> Context;
enum class EventOn
{
read_event, write_event,
};
class EventsHandler
{
public:
virtual ~EventsHandler() = default;
virtual bool OnOpen(Context ctx) = 0;
virtual void OnText(Context ctx, std::string&& data, bool finished) = 0;
virtual void OnBinary(Context ctx, std::string&& data, bool finished) = 0;
virtual void OnError(Context ctx, EventOn evt, int code, std::string const& error) = 0;
virtual void OnClose(Context ctx, EventOn evt) = 0;
};
using EventHandlersFactory = std::function<EventsHandler * (void)>;
class EmptyEventsHandler : public EventsHandler
{
public:
EmptyEventsHandler() = default;
~EmptyEventsHandler() override = default;
bool OnOpen(Context) override
{
return true;
}
void OnText(Context, std::string&&, bool) override {}
void OnBinary(Context, std::string&&, bool) override {}
void OnError(Context, EventOn, int, std::string const&) override {}
void OnClose(Context, EventOn) override {}
};
struct EventHandleFunctor : public EventsHandler
{
std::function < bool (Context) > DoOnOpen;
std::function < void (Context, std::string&&, bool) > DoOnText;
std::function < void (Context, std::string&&, bool) > DoOnBinary;
std::function < void (Context, EventOn, int, std::string const&) > DoOnError;
std::function < void (Context, EventOn) > DoOnClose;
bool OnOpen(Context ctx) override;
void OnText(Context ctx, std::string&& data, bool is_finished) override;
void OnBinary(Context ctx, std::string&& data, bool is_finished) override;
void OnError(Context ctx, EventOn evt, int code, std::string const& msg) override;
void OnClose(Context ctx, EventOn evt) override;
EventsHandler* operator()(void);
};
} //namespace Websocket
} //namespace da4qi4
#endif // HANDLER_WEBSOCKET_HPP
================================================
FILE: include/daqi/websocket/websocket.hpp
================================================
#ifndef WEBSOCKET_HPP
#define WEBSOCKET_HPP
#include "daqi/websocket/handler_websocket.hpp"
#include "daqi/websocket/context_websocket.hpp"
#endif // WEBSOCKET_HPP
================================================
FILE: inja/bytecode.hpp
================================================
// Copyright (c) 2019 Pantor. All rights reserved.
#ifndef INCLUDE_INJA_BYTECODE_HPP_
#define INCLUDE_INJA_BYTECODE_HPP_
#include <string>
#include <utility>
#include <nlohmann/json.hpp>
#include "string_view.hpp"
namespace inja {
using json = nlohmann::json;
struct Bytecode {
enum class Op : uint8_t {
Nop,
// print StringRef (always immediate)
PrintText,
// print value
PrintValue,
// push value onto stack (always immediate)
Push,
// builtin functions
// result is pushed to stack
// args specify number of arguments
// all functions can take their "last" argument either immediate
// or popped off stack (e.g. if immediate, it's like the immediate was
// just pushed to the stack)
Not,
And,
Or,
In,
Equal,
Greater,
GreaterEqual,
Less,
LessEqual,
At,
Different,
DivisibleBy,
Even,
First,
Float,
Int,
Last,
Length,
Lower,
Max,
Min,
Odd,
Range,
Result,
Round,
Sort,
Upper,
Exists,
ExistsInObject,
IsBoolean,
IsNumber,
IsInteger,
IsFloat,
IsObject,
IsArray,
IsString,
Default,
// include another template
// value is the template name
Include,
// callback function
// str is the function name (this means it cannot be a lookup)
// args specify number of arguments
// as with builtin functions, "last" argument can be immediate
Callback,
// unconditional jump
// args is the index of the bytecode to jump to.
Jump,
// conditional jump
// value popped off stack is checked for truthyness
// if false, args is the index of the bytecode to jump to.
// if true, no action is taken (falls through)
ConditionalJump,
// start loop
// value popped off stack is what is iterated over
// args is index of bytecode after end loop (jumped to if iterable is
// empty)
// immediate value is key name (for maps)
// str is value name
StartLoop,
// end a loop
// args is index of the first bytecode in the loop body
EndLoop,
};
enum Flag {
// location of value for value-taking ops (mask)
ValueMask = 0x03,
// pop value off stack
ValuePop = 0x00,
// value is immediate rather than on stack
ValueImmediate = 0x01,
// lookup immediate str (dot notation)
ValueLookupDot = 0x02,
// lookup immediate str (json pointer notation)
ValueLookupPointer = 0x03,
};
Op op {Op::Nop};
uint32_t args: 30;
uint32_t flags: 2;
json value;
std::string str;
Bytecode(): args(0), flags(0) {}
explicit Bytecode(Op op, unsigned int args = 0): op(op), args(args), flags(0) {}
explicit Bytecode(Op op, nonstd::string_view str, unsigned int flags): op(op), args(0), flags(flags), str(str) {}
explicit Bytecode(Op op, json&& value, unsigned int flags): op(op), args(0), flags(flags), value(std::move(value)) {}
};
} // namespace inja
#endif // INCLUDE_INJA_BYTECODE_HPP_
================================================
FILE: inja/config.hpp
================================================
// Copyri
gitextract_s01djq4q/
├── .gitignore
├── CMakeLists.txt
├── LICENSE
├── README.md
├── cmake_install.cmake
├── da4qi4.astylerc
├── include/
│ └── daqi/
│ ├── application.hpp
│ ├── client/
│ │ └── connection_client.hpp
│ ├── connection.hpp
│ ├── context.hpp
│ ├── cookie.hpp
│ ├── da4qi4.hpp
│ ├── def/
│ │ ├── asio_def.hpp
│ │ ├── boost_def.hpp
│ │ ├── debug_def.hpp
│ │ ├── def.hpp
│ │ ├── inja_def.hpp
│ │ ├── json_def.hpp
│ │ ├── log_def.hpp
│ │ └── redis_def.hpp
│ ├── handler.hpp
│ ├── intercepter.hpp
│ ├── intercepters/
│ │ ├── session_redis.hpp
│ │ └── static_file.hpp
│ ├── net-detail/
│ │ ├── net_detail_client.hpp
│ │ └── net_detail_server.hpp
│ ├── redis-client/
│ │ ├── redis_buffer.hpp
│ │ ├── redis_client.hpp
│ │ ├── redis_command.hpp
│ │ ├── redis_parser.hpp
│ │ └── redis_value.hpp
│ ├── rediscli_pool.hpp
│ ├── request.hpp
│ ├── response.hpp
│ ├── router.hpp
│ ├── server.hpp
│ ├── server_engine.hpp
│ ├── session.hpp
│ ├── templates.hpp
│ ├── url.hpp
│ ├── utilities/
│ │ ├── asio_utilities.hpp
│ │ ├── base64_utilities.hpp
│ │ ├── container_utilities.hpp
│ │ ├── des3_utilities.hpp
│ │ ├── encoding_utilities.hpp
│ │ ├── file_utilities.hpp
│ │ ├── hmac_sha1_utilities.hpp
│ │ ├── html_utilities.hpp
│ │ ├── http_utilities.hpp
│ │ ├── md5_utilities.hpp
│ │ └── string_utilities.hpp
│ └── websocket/
│ ├── connection_websocket.hpp
│ ├── context_websocket.hpp
│ ├── frame_websocket.hpp
│ ├── handler_websocket.hpp
│ └── websocket.hpp
├── inja/
│ ├── bytecode.hpp
│ ├── config.hpp
│ ├── environment.hpp
│ ├── function_storage.hpp
│ ├── inja.hpp
│ ├── lexer.hpp
│ ├── parser.hpp
│ ├── polyfill.hpp
│ ├── renderer.hpp
│ ├── string_view.hpp
│ ├── template.hpp
│ ├── token.hpp
│ └── utils.hpp
├── llhttp/
│ ├── CMakeLists.txt
│ ├── LICENSE-MIT
│ ├── README.md
│ ├── api.c
│ ├── helper/
│ │ ├── http_status_def.h
│ │ ├── http_url_def.c
│ │ └── http_url_def.h
│ ├── http.c
│ ├── llhttp.c
│ └── llhttp.h
├── multipart-parser/
│ ├── .gitignore
│ ├── CMakeLists.txt
│ ├── README.md
│ ├── multipart_parser.c
│ └── multipart_parser.h
├── nlohmann_json/
│ ├── .github/
│ │ ├── CONTRIBUTING.md
│ │ ├── ISSUE_TEMPLATE/
│ │ │ ├── Bug_report.md
│ │ │ └── Feature_request.md
│ │ ├── PULL_REQUEST_TEMPLATE.md
│ │ ├── config.yml
│ │ └── stale.yml
│ ├── .travis.yml
│ ├── CMakeLists.txt
│ ├── CODE_OF_CONDUCT.md
│ ├── ChangeLog.md
│ ├── LICENSE.MIT
│ ├── Makefile
│ ├── README.md
│ ├── appveyor.yml
│ ├── cmake/
│ │ └── config.cmake.in
│ ├── include/
│ │ └── nlohmann/
│ │ ├── adl_serializer.hpp
│ │ ├── detail/
│ │ │ ├── conversions/
│ │ │ │ ├── from_json.hpp
│ │ │ │ ├── to_chars.hpp
│ │ │ │ └── to_json.hpp
│ │ │ ├── exceptions.hpp
│ │ │ ├── input/
│ │ │ │ ├── binary_reader.hpp
│ │ │ │ ├── input_adapters.hpp
│ │ │ │ ├── json_sax.hpp
│ │ │ │ ├── lexer.hpp
│ │ │ │ ├── parser.hpp
│ │ │ │ └── position_t.hpp
│ │ │ ├── iterators/
│ │ │ │ ├── internal_iterator.hpp
│ │ │ │ ├── iter_impl.hpp
│ │ │ │ ├── iteration_proxy.hpp
│ │ │ │ ├── iterator_traits.hpp
│ │ │ │ ├── json_reverse_iterator.hpp
│ │ │ │ └── primitive_iterator.hpp
│ │ │ ├── json_pointer.hpp
│ │ │ ├── json_ref.hpp
│ │ │ ├── macro_scope.hpp
│ │ │ ├── macro_unscope.hpp
│ │ │ ├── meta/
│ │ │ │ ├── cpp_future.hpp
│ │ │ │ ├── detected.hpp
│ │ │ │ ├── is_sax.hpp
│ │ │ │ ├── type_traits.hpp
│ │ │ │ └── void_t.hpp
│ │ │ ├── output/
│ │ │ │ ├── binary_writer.hpp
│ │ │ │ ├── output_adapters.hpp
│ │ │ │ └── serializer.hpp
│ │ │ └── value_t.hpp
│ │ ├── json.hpp
│ │ └── json_fwd.hpp
│ ├── meson.build
│ ├── nlohmann_json.natvis
│ └── single_include/
│ └── nlohmann/
│ └── json.hpp
├── spdlog/
│ ├── async_logger.h
│ ├── common.h
│ ├── contrib/
│ │ ├── README.md
│ │ └── sinks/
│ │ ├── .gitignore
│ │ └── step_file_sink.h
│ ├── details/
│ │ ├── async_log_helper.h
│ │ ├── async_logger_impl.h
│ │ ├── file_helper.h
│ │ ├── log_msg.h
│ │ ├── logger_impl.h
│ │ ├── mpmc_blocking_q.h
│ │ ├── null_mutex.h
│ │ ├── os.h
│ │ ├── pattern_formatter_impl.h
│ │ ├── registry.h
│ │ └── spdlog_impl.h
│ ├── fmt/
│ │ ├── bundled/
│ │ │ ├── LICENSE.rst
│ │ │ ├── format.cc
│ │ │ ├── format.h
│ │ │ ├── ostream.cc
│ │ │ ├── ostream.h
│ │ │ ├── posix.cc
│ │ │ ├── posix.h
│ │ │ ├── printf.cc
│ │ │ ├── printf.h
│ │ │ └── time.h
│ │ ├── fmt.h
│ │ └── ostr.h
│ ├── formatter.h
│ ├── logger.h
│ ├── sinks/
│ │ ├── android_sink.h
│ │ ├── ansicolor_sink.h
│ │ ├── base_sink.h
│ │ ├── dist_sink.h
│ │ ├── file_sinks.h
│ │ ├── msvc_sink.h
│ │ ├── null_sink.h
│ │ ├── ostream_sink.h
│ │ ├── sink.h
│ │ ├── stdout_sinks.h
│ │ ├── syslog_sink.h
│ │ ├── wincolor_sink.h
│ │ └── windebug_sink.h
│ ├── spdlog.h
│ └── tweakme.h
└── src/
├── application.cpp
├── client/
│ └── connection_client.cpp
├── connection.cpp
├── context.cpp
├── cookie.cpp
├── def/
│ ├── boost_def.cpp
│ ├── def.cpp
│ ├── json_def.cpp
│ ├── log_def.cpp
│ └── redis_def.cpp
├── handler.cpp
├── intercepter.cpp
├── intercepters/
│ ├── session_redis.cpp
│ └── static_file.cpp
├── main_demo.cpp
├── net-detail/
│ ├── net_detail_client.cpp
│ └── net_detail_server.cpp
├── redis-client/
│ ├── redis_buffer.cpp
│ ├── redis_client.cpp
│ ├── redis_command.cpp
│ ├── redis_parser.cpp
│ └── redis_value.cpp
├── rediscli_pool.cpp
├── request.cpp
├── response.cpp
├── router.cpp
├── server.cpp
├── server_engine.cpp
├── session.cpp
├── templates.cpp
├── url.cpp
├── utilities/
│ ├── asio_utilities.cpp
│ ├── base64_utilities.cpp
│ ├── des3_utilities.cpp
│ ├── encoding_utilities.cpp
│ ├── file_utilities.cpp
│ ├── hmac_sha1_utilities.cpp
│ ├── html_utilities.cpp
│ ├── http_utilities.cpp
│ ├── md5_utilities.cpp
│ └── string_utilities.cpp
└── websocket/
├── connection_websocket.cpp
├── context_websocket.cpp
├── frame_websocket.cpp
└── handler_websocket.cpp
Copy disabled (too large)
Download .txt
Showing preview only (35,379K chars total). Download the full file to get everything.
SYMBOL INDEX (2932 symbols across 182 files)
FILE: include/daqi/application.hpp
type da4qi4 (line 19) | namespace da4qi4
type UploadFileSaveOptions (line 22) | struct UploadFileSaveOptions
type Strategy (line 24) | enum Strategy
type AppLocalDiskSetting (line 41) | struct AppLocalDiskSetting
method AppLocalDiskSetting (line 43) | AppLocalDiskSetting()
method AppLocalDiskSetting (line 47) | AppLocalDiskSetting(AppLocalDiskSetting const&) = default;
method AppLocalDiskSetting (line 48) | AppLocalDiskSetting(AppLocalDiskSetting&&) = default;
type AppLoggerSetting (line 60) | struct AppLoggerSetting
method AppLoggerSetting (line 66) | AppLoggerSetting()
class Application (line 78) | class Application
method ApplicationPtr (line 97) | static ApplicationPtr Default()
method ApplicationPtr (line 102) | static ApplicationPtr Default(std::string const& name)
method ApplicationPtr (line 107) | static ApplicationPtr Customize(std::string const& name
method ApplicationPtr (line 122) | static ApplicationPtr Customize(std::string const& name, std::string...
method Application (line 133) | Application(Application const&) = delete;
method Application (line 134) | Application& operator()(Application const&) = delete;
method Init (line 138) | bool Init(AppLoggerSetting const& logger_setting, std::string const&...
method Init (line 144) | bool Init(log::Level level, std::string const& template_ext)
method Init (line 151) | bool Init(log::Level level = AppLoggerSetting::default_log_level,
method Init (line 161) | bool Init(std::string const& log_root, log::Level level)
method Init (line 167) | bool Init(std::string const& log_root, log::Level level = AppLoggerS...
method InitLogger (line 175) | bool InitLogger(std::string const& log_root, AppLoggerSetting const&...
method InitLogger (line 187) | bool InitLogger(AppLoggerSetting const& logger_setting)
method IsAbortive (line 201) | bool IsAbortive() const
method Mount (line 207) | void Mount()
method IsRuning (line 212) | bool IsRuning() const
method Application (line 217) | Application& SetStaticRoot(std::string const& root_static)
method Application (line 223) | Application& SetLogRoot(std::string const& root_log)
method Application (line 233) | Application& SetTemplateRoot(std::string const& root_template)
method Application (line 243) | Application& SetTemplateExt(std::string const& template_ext)
method Application (line 253) | Application& SetTemporaryRoot(std::string const& root_temporary)
method Application (line 263) | Application& SetDefaultCharset(std::string const& charset)
method Application (line 273) | Application& SetUploadRoot(std::string const& root_upload)
method IsEnable (line 323) | bool IsEnable() const
method GetUpoadMaxSizeLimitKB (line 333) | size_t GetUpoadMaxSizeLimitKB() const
method SetUpoadMaxSizeLimitKB (line 338) | void SetUpoadMaxSizeLimitKB(size_t size_limit_kb)
method UploadFileSaveOptions (line 343) | UploadFileSaveOptions const& GetUploadFileSaveOptions() const
method UploadFileSaveOptions (line 348) | UploadFileSaveOptions& GetUploadFileSaveOptions()
method Templates (line 353) | Templates const& GetTemplates() const
method Templates (line 358) | Templates& GetTemplates()
method GetLogger (line 363) | log::LoggerPtr GetLogger()
method AddHandler (line 371) | bool AddHandler(HandlerMethod m, std::string const& url, Handler h, ...
method AddHandler (line 380) | bool AddHandler(HandlerMethods ms, std::string const& url, Handler h...
method GetIntercepterChainRange (line 398) | std::pair<Intercepter::ChainIterator, Intercepter::ChainIterator>
class Application (line 81) | class Application
method ApplicationPtr (line 97) | static ApplicationPtr Default()
method ApplicationPtr (line 102) | static ApplicationPtr Default(std::string const& name)
method ApplicationPtr (line 107) | static ApplicationPtr Customize(std::string const& name
method ApplicationPtr (line 122) | static ApplicationPtr Customize(std::string const& name, std::string...
method Application (line 133) | Application(Application const&) = delete;
method Application (line 134) | Application& operator()(Application const&) = delete;
method Init (line 138) | bool Init(AppLoggerSetting const& logger_setting, std::string const&...
method Init (line 144) | bool Init(log::Level level, std::string const& template_ext)
method Init (line 151) | bool Init(log::Level level = AppLoggerSetting::default_log_level,
method Init (line 161) | bool Init(std::string const& log_root, log::Level level)
method Init (line 167) | bool Init(std::string const& log_root, log::Level level = AppLoggerS...
method InitLogger (line 175) | bool InitLogger(std::string const& log_root, AppLoggerSetting const&...
method InitLogger (line 187) | bool InitLogger(AppLoggerSetting const& logger_setting)
method IsAbortive (line 201) | bool IsAbortive() const
method Mount (line 207) | void Mount()
method IsRuning (line 212) | bool IsRuning() const
method Application (line 217) | Application& SetStaticRoot(std::string const& root_static)
method Application (line 223) | Application& SetLogRoot(std::string const& root_log)
method Application (line 233) | Application& SetTemplateRoot(std::string const& root_template)
method Application (line 243) | Application& SetTemplateExt(std::string const& template_ext)
method Application (line 253) | Application& SetTemporaryRoot(std::string const& root_temporary)
method Application (line 263) | Application& SetDefaultCharset(std::string const& charset)
method Application (line 273) | Application& SetUploadRoot(std::string const& root_upload)
method IsEnable (line 323) | bool IsEnable() const
method GetUpoadMaxSizeLimitKB (line 333) | size_t GetUpoadMaxSizeLimitKB() const
method SetUpoadMaxSizeLimitKB (line 338) | void SetUpoadMaxSizeLimitKB(size_t size_limit_kb)
method UploadFileSaveOptions (line 343) | UploadFileSaveOptions const& GetUploadFileSaveOptions() const
method UploadFileSaveOptions (line 348) | UploadFileSaveOptions& GetUploadFileSaveOptions()
method Templates (line 353) | Templates const& GetTemplates() const
method Templates (line 358) | Templates& GetTemplates()
method GetLogger (line 363) | log::LoggerPtr GetLogger()
method AddHandler (line 371) | bool AddHandler(HandlerMethod m, std::string const& url, Handler h, ...
method AddHandler (line 380) | bool AddHandler(HandlerMethods ms, std::string const& url, Handler h...
method GetIntercepterChainRange (line 398) | std::pair<Intercepter::ChainIterator, Intercepter::ChainIterator>
class ApplicationMgr (line 484) | class ApplicationMgr
method ApplicationMgr (line 487) | ApplicationMgr() = default;
method ApplicationMgr (line 488) | ApplicationMgr(ApplicationMgr const&) = delete;
method ApplicationMgr (line 489) | ApplicationMgr& operator = (ApplicationMgr&) = delete;
method ApplicationMap (line 507) | ApplicationMap const& All() const
method IsEmpty (line 515) | bool IsEmpty() const
method Count (line 519) | size_t Count() const
method IsFailedApp (line 524) | bool IsFailedApp(ApplicationPtr ptr)
FILE: include/daqi/client/connection_client.hpp
type da4qi4 (line 17) | namespace da4qi4
type Client (line 19) | namespace Client
class Connection (line 22) | class Connection final
method Ptr (line 40) | static Ptr Create(IOC& ioc, std::string const& server)
method Ptr (line 45) | static Ptr Create(IOC& ioc, std::string const& server, std::string...
method Ptr (line 50) | static Ptr Create(IOC& ioc, std::string const& server, unsigned sh...
method Ptr (line 55) | static Ptr Create(IOC& ioc, boost::asio::ssl::context& ctx, std::s...
method Ptr (line 60) | static Ptr Create(IOC& ioc, boost::asio::ssl::context& ctx, std::s...
method Ptr (line 66) | Ptr Create(IOC& ioc, boost::asio::ssl::context& ctx, std::string c...
method Connection (line 72) | Connection(const Connection&) = delete;
method Connection (line 73) | Connection& operator=(const Connection&) = delete;
type Error (line 78) | enum class Error {on_none = 0,
type BodySetAction (line 93) | enum class BodySetAction {none, reset_content_length}
method Write (line 103) | void Write(std::string const& body, NotifyFunction notify)
type ActionAfterRequest (line 111) | enum class ActionAfterRequest { keep_connection, close_connection }
method RequestSync (line 121) | bool RequestSync(ActionAfterRequest action = ActionAfterRequest::k...
method IOC (line 132) | IOC& GetIOC()
method IsWithSSL (line 137) | bool IsWithSSL() const
method ICHeaders (line 165) | ICHeaders const& GetRequestHeaders() const
method ICHeaders (line 174) | ICHeaders const& GetResponseHeaders() const
method HasError (line 183) | bool HasError() const
method Error (line 188) | Error GetError() const
method GetResponseStatusCode (line 198) | unsigned int GetResponseStatusCode() const
type ReadingHeaderPart (line 258) | enum ReadingHeaderPart {header_none_part, header_field_part, heade...
type ReadCompletePart (line 263) | enum ReadCompletePart {read_none_complete,
FILE: include/daqi/connection.hpp
type da4qi4 (line 16) | namespace da4qi4
class Application (line 19) | class Application
class Connection (line 21) | class Connection
method ConnectionPtr (line 31) | static ConnectionPtr Create(IOC& ioc, size_t ioc_index)
method ConnectionPtr (line 36) | static ConnectionPtr Create(IOC& ioc, size_t ioc_index, boost::asio:...
method Connection (line 41) | Connection(const Connection&) = delete;
method Connection (line 42) | Connection& operator=(const Connection&) = delete;
method Request (line 51) | Request const& GetRequest() const
method Request (line 55) | Request& GetRequest()
method Response (line 60) | Response& GetResponse()
method Response (line 64) | Response const& GetResponse() const
method HasApplication (line 69) | bool HasApplication() const
method GetIOContextIndex (line 76) | size_t GetIOContextIndex() const
method IsWithSSL (line 87) | bool IsWithSSL() const
type MultpartParseStatus (line 140) | enum MultpartParseStatus { mp_cannot_init = -1, mp_parsing = 0, mp_...
type ReadingHeaderPart (line 162) | enum ReadingHeaderPart {header_none_part, header_field_part, header_...
type ReadCompletePart (line 169) | enum ReadCompletePart {read_none_complete,
type MultipartParsePart (line 177) | enum MultipartParsePart {mp_parse_none,
type mp_free_flag (line 183) | enum mp_free_flag {will_free_mp_setting = 1, will_free_mp_parser = ...
FILE: include/daqi/context.hpp
type da4qi4 (line 18) | namespace da4qi4
class Connection (line 21) | class Connection
class ContextIMP (line 24) | class ContextIMP
method ContextIMP (line 37) | ContextIMP(ContextIMP const&) = delete;
method ContextIMP (line 38) | ContextIMP& operator = (ContextIMP const&) = delete;
method Json (line 51) | Json const& Data(std::string const& name) const
method Json (line 63) | Json& Data(std::string const& name)
method Json (line 76) | Json const& LoadData(std::string const& name) const
method SaveData (line 81) | void SaveData(std::string const& name, Json const& data)
method RemoveData (line 86) | void RemoveData(std::string const& name)
method Json (line 96) | Json& ModelData()
method Json (line 101) | Json const& ModelData() const
method Json (line 106) | Json const& LoadModelData() const
method SaveModelData (line 111) | void SaveModelData(Json const& data)
method Json (line 116) | Json& SessionData()
method Json (line 121) | Json const& SessionData() const
method Json (line 126) | Json LoadSessionData() const
method SaveSessionData (line 131) | void SaveSessionData(Json const& data)
method Logger (line 154) | log::LoggerPtr Logger()
method SetTemplateName (line 165) | void SetTemplateName(std::string const& template_name)
method ClearTemplateName (line 170) | void ClearTemplateName()
method ContextIMP (line 183) | ContextIMP& Render(char const* template_name, Json const& data = the...
method ContextIMP (line 191) | ContextIMP& RenderWithoutData(http_status status)
method ContextIMP (line 195) | ContextIMP& RenderWithoutData(std::string const& template_name)
method ContextIMP (line 199) | ContextIMP& RenderWithoutData(std::string const& template_name, http...
method ContextIMP (line 203) | ContextIMP& RenderWithoutData()
method ContextIMP (line 209) | ContextIMP& RenderNofound(Json const& data = theNullJson)
method ContextIMP (line 213) | ContextIMP& RenderNofound(std::string const& template_name, Json con...
method ContextIMP (line 217) | ContextIMP& RenderNofound(char const* const template_name, Json cons...
method ContextIMP (line 222) | ContextIMP& RenderBadRequest(Json const& data = theNullJson)
method ContextIMP (line 226) | ContextIMP& RenderBadRequest(std::string const& template_name, Json ...
method ContextIMP (line 230) | ContextIMP& RenderBadRequest(char const* const template_name, Json c...
method ContextIMP (line 235) | ContextIMP& RenderUnauthorized(Json const& data = theNullJson)
method ContextIMP (line 239) | ContextIMP& RenderUnauthorized(std::string const& template_name, Jso...
method ContextIMP (line 243) | ContextIMP& RenderUnauthorized(char const* const template_name, Json...
method ContextIMP (line 248) | ContextIMP& RenderForbidden(Json const& data = theNullJson)
method ContextIMP (line 252) | ContextIMP& RenderForbidden(std::string const& template_name, Json c...
method ContextIMP (line 256) | ContextIMP& RenderForbidden(char const* const template_name, Json co...
method ContextIMP (line 261) | ContextIMP& RenderNotImplemented(Json const& data = theNullJson)
method ContextIMP (line 265) | ContextIMP& RenderNotImplemented(std::string const& template_name, J...
method ContextIMP (line 269) | ContextIMP& RenderNotImplemented(char const* const template_name, Js...
method ContextIMP (line 274) | ContextIMP& RenderServiceUnavailable(Json const& data = theNullJson)
method ContextIMP (line 278) | ContextIMP& RenderServiceUnavailable(std::string const& template_nam...
method ContextIMP (line 282) | ContextIMP& RenderServiceUnavailable(char const* const template_name...
method ContextIMP (line 287) | ContextIMP& RenderInternalServerError(Json const& data = theNullJson)
method ContextIMP (line 291) | ContextIMP& RenderInternalServerError(std::string const& template_na...
method ContextIMP (line 295) | ContextIMP& RenderInternalServerError(char const* const template_nam...
method ContextIMP (line 301) | ContextIMP& Redirect(std::string const& dst_location)
method HasRedis (line 308) | bool HasRedis() const
method RedisClientPtr (line 313) | RedisClientPtr Redis()
method is_exists_parameter (line 373) | bool is_exists_parameter(std::string const& name) const
method is_exists_header (line 383) | bool is_exists_header(std::string const& field) const
method is_exists_url_parameter (line 393) | bool is_exists_url_parameter(std::string const& name) const
method is_exists_path_parameter (line 403) | bool is_exists_path_parameter(std::string const& name) const
method is_exists_form_data (line 413) | bool is_exists_form_data(std::string const& name) const
method is_exists_cookie (line 423) | bool is_exists_cookie(std::string const& name) const
class Application (line 27) | class Application
class ContextIMP (line 29) | class ContextIMP
method ContextIMP (line 37) | ContextIMP(ContextIMP const&) = delete;
method ContextIMP (line 38) | ContextIMP& operator = (ContextIMP const&) = delete;
method Json (line 51) | Json const& Data(std::string const& name) const
method Json (line 63) | Json& Data(std::string const& name)
method Json (line 76) | Json const& LoadData(std::string const& name) const
method SaveData (line 81) | void SaveData(std::string const& name, Json const& data)
method RemoveData (line 86) | void RemoveData(std::string const& name)
method Json (line 96) | Json& ModelData()
method Json (line 101) | Json const& ModelData() const
method Json (line 106) | Json const& LoadModelData() const
method SaveModelData (line 111) | void SaveModelData(Json const& data)
method Json (line 116) | Json& SessionData()
method Json (line 121) | Json const& SessionData() const
method Json (line 126) | Json LoadSessionData() const
method SaveSessionData (line 131) | void SaveSessionData(Json const& data)
method Logger (line 154) | log::LoggerPtr Logger()
method SetTemplateName (line 165) | void SetTemplateName(std::string const& template_name)
method ClearTemplateName (line 170) | void ClearTemplateName()
method ContextIMP (line 183) | ContextIMP& Render(char const* template_name, Json const& data = the...
method ContextIMP (line 191) | ContextIMP& RenderWithoutData(http_status status)
method ContextIMP (line 195) | ContextIMP& RenderWithoutData(std::string const& template_name)
method ContextIMP (line 199) | ContextIMP& RenderWithoutData(std::string const& template_name, http...
method ContextIMP (line 203) | ContextIMP& RenderWithoutData()
method ContextIMP (line 209) | ContextIMP& RenderNofound(Json const& data = theNullJson)
method ContextIMP (line 213) | ContextIMP& RenderNofound(std::string const& template_name, Json con...
method ContextIMP (line 217) | ContextIMP& RenderNofound(char const* const template_name, Json cons...
method ContextIMP (line 222) | ContextIMP& RenderBadRequest(Json const& data = theNullJson)
method ContextIMP (line 226) | ContextIMP& RenderBadRequest(std::string const& template_name, Json ...
method ContextIMP (line 230) | ContextIMP& RenderBadRequest(char const* const template_name, Json c...
method ContextIMP (line 235) | ContextIMP& RenderUnauthorized(Json const& data = theNullJson)
method ContextIMP (line 239) | ContextIMP& RenderUnauthorized(std::string const& template_name, Jso...
method ContextIMP (line 243) | ContextIMP& RenderUnauthorized(char const* const template_name, Json...
method ContextIMP (line 248) | ContextIMP& RenderForbidden(Json const& data = theNullJson)
method ContextIMP (line 252) | ContextIMP& RenderForbidden(std::string const& template_name, Json c...
method ContextIMP (line 256) | ContextIMP& RenderForbidden(char const* const template_name, Json co...
method ContextIMP (line 261) | ContextIMP& RenderNotImplemented(Json const& data = theNullJson)
method ContextIMP (line 265) | ContextIMP& RenderNotImplemented(std::string const& template_name, J...
method ContextIMP (line 269) | ContextIMP& RenderNotImplemented(char const* const template_name, Js...
method ContextIMP (line 274) | ContextIMP& RenderServiceUnavailable(Json const& data = theNullJson)
method ContextIMP (line 278) | ContextIMP& RenderServiceUnavailable(std::string const& template_nam...
method ContextIMP (line 282) | ContextIMP& RenderServiceUnavailable(char const* const template_name...
method ContextIMP (line 287) | ContextIMP& RenderInternalServerError(Json const& data = theNullJson)
method ContextIMP (line 291) | ContextIMP& RenderInternalServerError(std::string const& template_na...
method ContextIMP (line 295) | ContextIMP& RenderInternalServerError(char const* const template_nam...
method ContextIMP (line 301) | ContextIMP& Redirect(std::string const& dst_location)
method HasRedis (line 308) | bool HasRedis() const
method RedisClientPtr (line 313) | RedisClientPtr Redis()
method is_exists_parameter (line 373) | bool is_exists_parameter(std::string const& name) const
method is_exists_header (line 383) | bool is_exists_header(std::string const& field) const
method is_exists_url_parameter (line 393) | bool is_exists_url_parameter(std::string const& name) const
method is_exists_path_parameter (line 403) | bool is_exists_path_parameter(std::string const& name) const
method is_exists_form_data (line 413) | bool is_exists_form_data(std::string const& name) const
method is_exists_cookie (line 423) | bool is_exists_cookie(std::string const& name) const
FILE: include/daqi/cookie.hpp
type da4qi4 (line 12) | namespace da4qi4
type Cookie (line 14) | struct Cookie
type HttpOnly (line 16) | enum class HttpOnly {for_http_and_js = 0, for_http_only = 1}
type Secure (line 17) | enum class Secure {for_http_and_https = 0, for_https_only = 1}
type SameSite (line 18) | enum class SameSite {none = 0, lax, strict}
method Cookie (line 20) | Cookie() = default;
method Cookie (line 21) | Cookie(Cookie const&) = default;
method Cookie (line 22) | Cookie(Cookie&& o)
method Cookie (line 39) | Cookie& operator = (Cookie const& o) = default;
method Cookie (line 40) | Cookie& operator = (Cookie&& o) = default;
method Cookie (line 42) | Cookie(std::string const& name, std::string const& value)
method Cookie (line 46) | Cookie(std::string const& name, std::string const& value, std::strin...
method Cookie (line 50) | Cookie(std::string const& name, std::string const& value
method Cookie (line 75) | Cookie& SetName(std::string const& name)
method Cookie (line 81) | Cookie& SetValue(std::string const& value)
method Cookie (line 87) | Cookie& SetDomain(std::string const& domain)
method Cookie (line 93) | Cookie& SetPath(std::string const& path)
method Cookie (line 99) | Cookie& ApplyHttpVersion(unsigned short http_version_major, unsigned...
method Cookie (line 106) | Cookie& SetHttpOnly(HttpOnly only)
method IsHttpOnly (line 112) | bool IsHttpOnly() const
method Cookie (line 117) | Cookie& SetMaxAge(int seconds)
method GetMaxAge (line 123) | int GetMaxAge() const
method Cookie (line 130) | Cookie& SetExpiredAfterBrowerClose()
method IsExpiredAfterBrowerClose (line 136) | bool IsExpiredAfterBrowerClose() const
method Cookie (line 141) | Cookie& SetExpiredImmediately()
method IsExpiredImmediately (line 147) | bool IsExpiredImmediately() const
method IsOldVersion (line 152) | bool IsOldVersion() const
method IsSecure (line 157) | bool IsSecure() const
method Cookie (line 162) | Cookie& SetSecure(Secure secure)
method SameSite (line 168) | SameSite GetSameSite() const
method Cookie (line 173) | Cookie& SetSameSite(SameSite ss)
method ClearValue (line 179) | void ClearValue()
method IsEmpty (line 184) | bool IsEmpty() const
FILE: include/daqi/def/asio_def.hpp
type da4qi4 (line 7) | namespace da4qi4
FILE: include/daqi/def/boost_def.hpp
type da4qi4 (line 12) | namespace da4qi4
FILE: include/daqi/def/def.hpp
type da4qi4 (line 14) | namespace da4qi4
type CacheControl (line 20) | enum class CacheControl {Public, Private}
type PathResolve (line 21) | enum PathResolve {is_relative, is_absolute}
FILE: include/daqi/def/inja_def.hpp
type da4qi4 (line 8) | namespace da4qi4
FILE: include/daqi/def/json_def.hpp
type da4qi4 (line 8) | namespace da4qi4
type Valuetool (line 14) | namespace Valuetool
FILE: include/daqi/def/log_def.hpp
type da4qi4 (line 10) | namespace da4qi4
type log (line 12) | namespace log
FILE: include/daqi/def/redis_def.hpp
type da4qi4 (line 4) | namespace da4qi4
FILE: include/daqi/handler.hpp
type da4qi4 (line 11) | namespace da4qi4
type HandlerMethod (line 14) | enum class HandlerMethod
type HandlerMethods (line 35) | struct HandlerMethods
method HandlerMethods (line 37) | HandlerMethods() = default;
method HandlerMethods (line 40) | HandlerMethods(HandlerMethodMark mark)
function Handler (line 63) | Handler member_handler(C* o, void (C::*f)(Context))
FILE: include/daqi/intercepter.hpp
type da4qi4 (line 9) | namespace da4qi4
class ContextIMP (line 12) | class ContextIMP
type Intercepter (line 15) | namespace Intercepter
type Result (line 18) | enum class Result { Pass, Stop }
type On (line 19) | enum class On {Request, Handle, Response}
FILE: include/daqi/intercepters/session_redis.hpp
type da4qi4 (line 12) | namespace da4qi4
type Intercepter (line 14) | namespace Intercepter
type SessionOnRedis (line 17) | struct SessionOnRedis
method SessionOnRedis (line 19) | SessionOnRedis() = default;
method SessionOnRedis (line 21) | SessionOnRedis(std::string const& name,
method SessionOnRedis (line 30) | SessionOnRedis(int session_max_age_seconds)
method SessionOnRedis (line 35) | SessionOnRedis(SessionOptions const& options)
method SessionOnRedis (line 40) | SessionOnRedis(SessionOnRedis const&) = default;
method SessionOnRedis (line 41) | SessionOnRedis& operator = (SessionOnRedis const&) = default;
method SessionOnRedis (line 43) | SessionOnRedis& SetName(std::string const& name)
method SessionOnRedis (line 49) | SessionOnRedis& SetPrefix(std::string const& prefix)
method SessionOnRedis (line 55) | SessionOnRedis& SetMaxAge(int max_age)
method SessionOnRedis (line 61) | SessionOnRedis& SetDomain(std::string const& domain)
method SessionOnRedis (line 67) | SessionOnRedis& SetPath(std::string const& path)
method SessionOnRedis (line 73) | SessionOnRedis& SetHttpOnly(Cookie::HttpOnly http_only)
method SessionOnRedis (line 79) | SessionOnRedis& SetSecure(Cookie::Secure secure)
method SessionOnRedis (line 85) | SessionOnRedis& SetSameSite(Cookie::SameSite samesite)
method SessionOptions (line 91) | SessionOptions const& GetOptions() const
FILE: include/daqi/intercepters/static_file.hpp
type da4qi4 (line 12) | namespace da4qi4
type Intercepter (line 15) | namespace Intercepter
type StaticFile (line 18) | struct StaticFile
method StaticFile (line 22) | StaticFile()
method StaticFile (line 29) | StaticFile(int cache_max_age
method StaticFile (line 38) | StaticFile(StaticFile const&) = default;
method StaticFile (line 39) | StaticFile& operator = (StaticFile const&) = default;
method GetCacheMaxAge (line 41) | int GetCacheMaxAge() const
method StaticFile (line 46) | StaticFile& SetCacheMaxAge(int seconds)
method PathResolve (line 52) | PathResolve GetUrlResolveType() const
method StaticFile (line 57) | StaticFile& SetUrlResolveType(PathResolve type)
method PathResolve (line 63) | PathResolve GetDirResolveType() const
method StaticFile (line 68) | StaticFile& SetDirResolveType(PathResolve type)
FILE: include/daqi/net-detail/net_detail_client.hpp
type da4qi4 (line 7) | namespace da4qi4
type Client (line 9) | namespace Client
type net_detail (line 11) | namespace net_detail
type SocketBase (line 18) | struct SocketBase
type Socket (line 39) | struct Socket : SocketBase
method Socket (line 41) | Socket(IOC& ioc)
type SocketWithSSL (line 66) | struct SocketWithSSL : SocketBase
method SocketWithSSL (line 68) | SocketWithSSL(IOC& ioc, boost::asio::ssl::context& ssl_ctx)
FILE: include/daqi/net-detail/net_detail_server.hpp
type da4qi4 (line 9) | namespace da4qi4
type net_detail (line 11) | namespace net_detail
type SocketInterface (line 20) | struct SocketInterface
type Socket (line 36) | struct Socket : SocketInterface
method Socket (line 38) | Socket(IOC& ioc)
method close (line 45) | void close(errorcode& ec) override
method IsWithSSL (line 51) | bool IsWithSSL() const override
method async_read_some (line 63) | void async_read_some(ReadBuffer& read_buffer, SocketCompletionCall...
method async_write (line 68) | void async_write(WriteBuffer& write_buffer, SocketCompletionCallba...
method async_write (line 73) | void async_write(ChunkedBuffer const& chunked_buffer, SocketComple...
type SocketWithSSL (line 82) | struct SocketWithSSL : SocketInterface
method SocketWithSSL (line 84) | SocketWithSSL(IOC& ioc, boost::asio::ssl::context& ssl_ctx)
method close (line 91) | void close(errorcode& ec) override
method IsWithSSL (line 98) | bool IsWithSSL() const override
method async_read_some (line 110) | void async_read_some(ReadBuffer& read_buffer, SocketCompletionCall...
method async_write (line 115) | void async_write(WriteBuffer& write_buffer, SocketCompletionCallba...
method async_write (line 120) | void async_write(ChunkedBuffer const& chunked_buffer, SocketComple...
FILE: include/daqi/redis-client/redis_buffer.hpp
type da4qi4 (line 7) | namespace da4qi4
type RedisBuffer (line 10) | struct RedisBuffer
method RedisBuffer (line 12) | RedisBuffer() = default;
method RedisBuffer (line 19) | RedisBuffer(SrcT const& value)
FILE: include/daqi/redis-client/redis_client.hpp
type da4qi4 (line 14) | namespace da4qi4
type RedisClientErrorHandlePolicy (line 17) | enum class RedisClientErrorHandlePolicy {do_nothing, auto_reconnect}
class RedisParser (line 19) | class RedisParser
class RedisClient (line 22) | class RedisClient
method RedisClient (line 26) | RedisClient(IOC& ioc,
method ReconnectSync (line 42) | bool ReconnectSync()
method IsConnected (line 60) | bool IsConnected() const
method IsConnectting (line 65) | bool IsConnectting() const
type ConnectStatus (line 107) | enum ConnectStatus {not_connect, is_connectting, is_connected}
FILE: include/daqi/redis-client/redis_command.hpp
type da4qi4 (line 9) | namespace da4qi4
FILE: include/daqi/redis-client/redis_parser.hpp
type da4qi4 (line 11) | namespace da4qi4
class RedisParser (line 14) | class RedisParser
type ParseResult (line 19) | enum ParseResult
method is_char (line 33) | inline bool is_char(int c)
method is_control (line 38) | inline bool is_control(int c)
type State (line 46) | enum State
FILE: include/daqi/redis-client/redis_value.hpp
type da4qi4 (line 11) | namespace da4qi4
class RedisValue (line 14) | class RedisValue
type ErrorTag (line 17) | struct ErrorTag {}
type ErrorTag (line 25) | struct ErrorTag
type ErrorTag (line 26) | struct ErrorTag
method RedisValue (line 30) | RedisValue(const RedisValue&) = default;
method RedisValue (line 31) | RedisValue& operator = (const RedisValue&) = default;
method RedisValue (line 32) | RedisValue& operator = (RedisValue&&) = default;
method ToInt32 (line 46) | int ToInt32() const
type NullTag (line 93) | struct NullTag
function T (line 107) | T RedisValue::cast_to() const
FILE: include/daqi/rediscli_pool.hpp
type da4qi4 (line 17) | namespace da4qi4
class IOContextPool (line 20) | class IOContextPool
class RedisClientPool (line 21) | class RedisClientPool
method RedisClientPool (line 23) | RedisClientPool() = default;
method RedisClientPtr (line 37) | RedisClientPtr Get(size_t index)
FILE: include/daqi/request.hpp
type da4qi4 (line 16) | namespace da4qi4
type RoutingPathParameters (line 18) | struct RoutingPathParameters
method RoutingPathParameters (line 20) | RoutingPathParameters() = default;
method RoutingPathParameters (line 21) | RoutingPathParameters(RoutingPathParameters const&) = default;
method RoutingPathParameters (line 22) | RoutingPathParameters(RoutingPathParameters&& o)
method GetCount (line 27) | size_t GetCount() const
method Clear (line 32) | void Clear()
type MultiPart (line 52) | struct MultiPart
type SubHeaders (line 54) | struct SubHeaders
method IsEmpty (line 59) | bool IsEmpty() const
method MultiPart (line 65) | MultiPart() = default;
method HeaderCount (line 71) | size_t HeaderCount() const
method DataSize (line 75) | size_t DataSize() const
method ICHeaders (line 86) | ICHeaders& GetHeaders()
method ICHeaders (line 90) | ICHeaders const& GetHeaders() const
method SetData (line 105) | void SetData(std::string&& data)
method ClearData (line 112) | void ClearData()
method Clear (line 118) | void Clear()
type TransferResult (line 124) | enum TransferResult
method TransferResult (line 130) | TransferResult GetTransferResult() const
method SetTransferResult (line 135) | void SetTransferResult(TransferResult transfer_result)
type FormDataItem (line 145) | struct FormDataItem
method FormDataItem (line 147) | FormDataItem() = default;
method FormDataItem (line 148) | FormDataItem(std::string const& name, std::string&& data)
type DataFlag (line 153) | enum DataFlag {is_data, is_file_data, is_file_temporary_name}
method IsData (line 159) | bool IsData() const
method IsFile (line 164) | bool IsFile() const
method IsSavedFile (line 169) | bool IsSavedFile() const
method Reset (line 179) | void Reset()
class Application (line 189) | class Application
type UploadFileSaveOptions (line 190) | struct UploadFileSaveOptions
type UploadFile (line 192) | struct UploadFile
method UploadFile (line 194) | UploadFile() = default;
method UploadFile (line 195) | UploadFile(UploadFile const&) = default;
method UploadFile (line 196) | UploadFile(UploadFile&& o)
method InMemory (line 220) | bool InMemory() const
method InStream (line 224) | bool InStream() const
method IsNoFound (line 229) | bool IsNoFound() const
type Status (line 271) | enum Status {no_found, in_stream, in_memory}
class Request (line 285) | class Request
type ParameterSrc (line 288) | enum ParameterSrc
method InitPathParameters (line 301) | void InitPathParameters(std::vector<std::string> const& names
method IsExistsPathParameter (line 307) | bool IsExistsPathParameter(std::string const& name) const
method OptionalStringRefConst (line 315) | OptionalStringRefConst TryGetPathParameter(std::string const& name) ...
method ParameterSrc (line 328) | ParameterSrc IsExistsParameter(std::string const& name) const
method UrlUnderApp (line 350) | UrlUnderApp const& GetUrl() const
method UrlUnderApp (line 355) | UrlUnderApp& GetUrl()
method llhttp_method_t (line 360) | llhttp_method_t GetMethod() const
method GetHost (line 365) | std::string GetHost() const
method GetMethodName (line 371) | std::string GetMethodName() const
method ICHeaders (line 376) | ICHeaders const& GetHeader() const
method ICHeaders (line 381) | ICHeaders& GetHeader()
method ICCookies (line 386) | ICCookies const& GetCookies() const
method ICCookies (line 391) | ICCookies& GetCookies()
method RoutingPathParameters (line 396) | RoutingPathParameters const& GetPathParameters() const
method GetVersion (line 416) | void GetVersion(unsigned short& major, unsigned short& minor) const
method GetVersion (line 422) | std::pair<unsigned short, unsigned short> GetVersion()
method IsContentLengthProvided (line 427) | bool IsContentLengthProvided() const
method GetContentLength (line 431) | uint64_t GetContentLength() const
method IsChunked (line 436) | bool IsChunked() const
method IsUpgrade (line 440) | bool IsUpgrade() const
method IsFormData (line 444) | bool IsFormData() const
method IsFormUrlEncoded (line 448) | bool IsFormUrlEncoded() const
method IsOctetStream (line 452) | bool IsOctetStream() const
method IsMultiPart (line 456) | bool IsMultiPart() const
method IsKeepAlive (line 460) | bool IsKeepAlive() const
method IsBodySkipped (line 464) | bool IsBodySkipped() const
method HasBody (line 469) | bool HasBody() const
method MarkUpgrade (line 487) | void MarkUpgrade(bool upgrade)
method MarkKeepAlive (line 491) | void MarkKeepAlive(bool keep)
method MarkMultiPart (line 495) | void MarkMultiPart(bool multipart)
method MarkFormUrlEncoded (line 499) | void MarkFormUrlEncoded(bool formurlencoded)
method MarkOctetStream (line 503) | void MarkOctetStream(bool octetstream)
method MarkFormData (line 507) | void MarkFormData(bool formdata)
method SetMethod (line 512) | void SetMethod(unsigned int method)
method SetVersion (line 516) | void SetVersion(unsigned short major, unsigned short minor)
method SetContentLength (line 521) | void SetContentLength(uint64_t content_length)
method SetFlags (line 525) | void SetFlags(unsigned int flags)
method SetBody (line 529) | void SetBody(std::string&& body)
method AddMultiPart (line 535) | void AddMultiPart(MultiPart&& part)
FILE: include/daqi/response.hpp
type da4qi4 (line 19) | namespace da4qi4
type ChunkedBodies (line 24) | struct ChunkedBodies
class Response (line 35) | class Response
method Response (line 39) | Response(http_status code)
method GetStatusCode (line 43) | int GetStatusCode() const
method GetVersion (line 48) | void GetVersion(unsigned short& major, unsigned short& minor) const
method GetVersion (line 54) | std::pair<unsigned short, unsigned short> GetVersion() const
type ContentTypePart (line 64) | enum ContentTypePart {without_chartset = 0, with_chartset = 1}
method ICHeaders (line 71) | ICHeaders const& GetHeaders() const
method PopChunkedBody (line 81) | std::string PopChunkedBody(bool& is_last)
method PushChunkedBody (line 86) | void PushChunkedBody(std::string const& body, bool is_last)
method SetStatusCode (line 95) | void SetStatusCode(http_status code)
method SetVersion (line 100) | void SetVersion(unsigned short major, unsigned short minor)
method SetBody (line 106) | void SetBody(std::string&& body)
method SetBody (line 111) | void SetBody(std::string const& body)
method SetContentEncoding (line 121) | void SetContentEncoding(std::string const& encoding)
method IsRedirected (line 128) | bool IsRedirected() const
method SetLocation (line 133) | void SetLocation(std::string const& dst_location)
method SetExpires (line 138) | void SetExpires(std::time_t time_point)
method CacheControlMaxAge (line 143) | void CacheControlMaxAge(int max_age_seconds = 0, CacheControl cc = C...
method NoCache (line 149) | void NoCache()
method TurnOffCache (line 154) | void TurnOffCache()
method RemoveLocation (line 165) | void RemoveLocation()
method MarkChunked (line 171) | void MarkChunked()
method SetCookie (line 182) | void SetCookie(std::string const& name, std::string const& value)
method SetSecureCookie (line 189) | void SetSecureCookie(std::string const& name, std::string const& value)
method SetCookie (line 197) | void SetCookie(std::string const& name, std::string const& value, Co...
method SetSecureCookie (line 205) | void SetSecureCookie(std::string const& name, std::string const& val...
method SetCookie (line 214) | void SetCookie(std::string const& name, std::string const& value
method SetSecureCookie (line 224) | void SetSecureCookie(std::string const& name, std::string const& value
method SetCookie (line 235) | void SetCookie(std::string const& name, std::string const& value
method SetSecureCookie (line 246) | void SetSecureCookie(std::string const& name, std::string const& value
method ReplyOkJSON (line 284) | void ReplyOkJSON(std::string json_string,
method ReplyContinue (line 293) | void ReplyContinue()
method ReplyLengthRequired (line 312) | void ReplyLengthRequired()
type RedirectType (line 324) | enum class RedirectType {temporary, permanent}
FILE: include/daqi/router.hpp
type da4qi4 (line 11) | namespace da4qi4
type UniformItem (line 14) | struct UniformItem
method UniformItem (line 16) | UniformItem() = default;
method UniformItem (line 17) | UniformItem(std::string const& url_matcher)
type RouterItem (line 26) | struct RouterItem
type RouterResult (line 32) | struct RouterResult
method RouterResult (line 34) | RouterResult() = default;
method RouterResult (line 36) | RouterResult(RouterItem* item, HandlerMethod method)
type router_equals (line 56) | struct router_equals
method router_equals (line 58) | explicit router_equals(std::string const& s)
type router_starts (line 70) | struct router_starts
method router_starts (line 72) | explicit router_starts(std::string const& s)
type router_regex (line 84) | struct router_regex
method router_regex (line 86) | explicit router_regex(std::string const& s)
class RoutingTable (line 103) | class RoutingTable
method IMP (line 106) | IMP* imp()
method Add (line 112) | bool Add(std::string const& url_matcher, HandlerMethod method, Hand...
method Add (line 145) | bool Add(std::string const& url_matcher, HandlerMethods methods, Han...
method Result (line 167) | Result Search(std::string const& url, HandlerMethod method, bool& ur...
class EqualsRoutingTable (line 173) | class EqualsRoutingTable : public RoutingTable<EqualsRoutingTable, Rou...
method Insert (line 181) | bool Insert(std::string const& url_matcher, RouterItem const& item,...
method Item (line 188) | Item* Exists(std::string const& url_matcher)
method Result (line 194) | Result Match(std::string const& url, HandlerMethod method, bool& url...
type StartsRouterResult (line 207) | struct StartsRouterResult : public RouterResult
method StartsRouterResult (line 209) | StartsRouterResult() = default;
method StartsRouterResult (line 210) | StartsRouterResult(RouterItem* item, HandlerMethod method, std::stri...
class StartsWithRoutingTable (line 217) | class StartsWithRoutingTable
method Insert (line 225) | bool Insert(std::string const& url_matcher, RouterItem const& item,...
method Item (line 232) | Item* Exists(std::string const& url_matcher)
type UniformRegexItem (line 246) | struct UniformRegexItem : public UniformItem
type RegexRouterItem (line 253) | struct RegexRouterItem : public RouterItem
method RegexRouterItem (line 259) | RegexRouterItem() = default;
method RegexRouterItem (line 261) | explicit RegexRouterItem(RouterItem const& base)
type RegexRouterResult (line 269) | struct RegexRouterResult : public RouterResult
method RegexRouterResult (line 271) | RegexRouterResult() = default;
method RegexRouterResult (line 272) | RegexRouterResult(RegexRouterItem* item, HandlerMethod method)
class RegexMatchRoutingTable (line 280) | class RegexMatchRoutingTable :
FILE: include/daqi/server.hpp
type da4qi4 (line 17) | namespace da4qi4
class Server (line 22) | class Server
type WithSSL (line 25) | enum class WithSSL {no, yes}
type SSLOptions (line 29) | struct SSLOptions
type PrivateKeyType (line 31) | enum class PrivateKeyType {normal, RSA}
method SSLOptions (line 33) | explicit SSLOptions()
method SSLOptions (line 43) | explicit SSLOptions(OnNeedSSLPassword&& password_callback)
method SSLOptions (line 54) | SSLOptions(SSLContextBase::options options)
method SSLOptions (line 60) | SSLOptions(SSLContextBase::options options, OnNeedSSLPassword&& pa...
method EnableSSLV3 (line 68) | void EnableSSLV3()
method EnableTLSV1 (line 73) | void EnableTLSV1()
method EnableVerifyClient (line 78) | void EnableVerifyClient()
method DisableVerifyClient (line 83) | void DisableVerifyClient()
method InitFiles (line 88) | void InitFiles(std::string certificate_chain_file
method IOContextPool (line 146) | IOContextPool* GetIOContextPool()
method IsWithSSL (line 152) | bool IsWithSSL() const
method IsIdleTimerRunning (line 164) | bool IsIdleTimerRunning() const
method EnableDetectTemplates (line 169) | void EnableDetectTemplates(int interval_seconds = _detect_templates_...
method DisableDetectTemplates (line 184) | void DisableDetectTemplates()
method IsEnabledDetetTemplates (line 189) | bool IsEnabledDetetTemplates() const
method ApplicationPtr (line 202) | ApplicationPtr AddHandler(HandlerMethod m, std::string const& url, H...
method ApplicationPtr (line 211) | ApplicationPtr AddHandler(HandlerMethods ms, std::string const& url,...
type IdleFunctionStatus (line 257) | struct IdleFunctionStatus
method IdleFunctionStatus (line 259) | IdleFunctionStatus()
method IdleFunctionStatus (line 263) | IdleFunctionStatus(IdleFunctionStatus const&) = default;
method IdleFunctionStatus (line 265) | IdleFunctionStatus(int interval_seconds, IdleFunction func)
FILE: include/daqi/server_engine.hpp
type da4qi4 (line 16) | namespace da4qi4
class IOContextPool (line 19) | class IOContextPool
method Size (line 28) | size_t Size() const
FILE: include/daqi/session.hpp
type da4qi4 (line 9) | namespace da4qi4
type SessionOptions (line 17) | struct SessionOptions
FILE: include/daqi/templates.hpp
type da4qi4 (line 12) | namespace da4qi4
class Templates (line 25) | class Templates
method Templates (line 28) | Templates()
method Templates (line 32) | Templates(Templates const&) = default;
method Templates (line 34) | Templates(std::string const& template_root, std::string const& app_u...
method InitPathes (line 38) | void InitPathes(std::string const& template_root, std::string const&...
method Enable (line 64) | void Enable()
method Disable (line 69) | void Disable()
method IsDisabled (line 74) | bool IsDisabled() const
type TemplateFlag (line 83) | enum class TemplateFlag {for_normal, for_include}
type TemplateUpdateAction (line 100) | enum class TemplateUpdateAction
type Item (line 113) | struct Item
FILE: include/daqi/url.hpp
type da4qi4 (line 8) | namespace da4qi4
type UrlBase (line 11) | struct UrlBase
method Clear (line 29) | void Clear()
type UrlUnderApp (line 43) | struct UrlUnderApp : public UrlBase
type UrlFlag (line 55) | enum class UrlFlag
FILE: include/daqi/utilities/asio_utilities.hpp
type da4qi4 (line 11) | namespace da4qi4
type Utilities (line 13) | namespace Utilities
FILE: include/daqi/utilities/base64_utilities.hpp
type da4qi4 (line 7) | namespace da4qi4
type Utilities (line 9) | namespace Utilities
FILE: include/daqi/utilities/container_utilities.hpp
type da4qi4 (line 10) | namespace da4qi4
type Utilities (line 12) | namespace Utilities
function IsExistsHeader (line 16) | bool IsExistsHeader(HeadersT const& headers, std::string const& field)
function OptionalStringRefConst (line 30) | OptionalStringRefConst TryGetHeader(HeadersT const& headers, std::st...
FILE: include/daqi/utilities/des3_utilities.hpp
type da4qi4 (line 6) | namespace da4qi4
type Utilities (line 8) | namespace Utilities
FILE: include/daqi/utilities/encoding_utilities.hpp
type da4qi4 (line 7) | namespace da4qi4
type Utilities (line 9) | namespace Utilities
type iconvpp (line 12) | namespace iconvpp
class Converter (line 15) | class Converter
method IgnoreCount (line 38) | std::size_t IgnoreCount() const noexcept
FILE: include/daqi/utilities/file_utilities.hpp
type da4qi4 (line 7) | namespace da4qi4
type Utilities (line 9) | namespace Utilities
type FileOverwriteOptions (line 18) | enum class FileOverwriteOptions
FILE: include/daqi/utilities/hmac_sha1_utilities.hpp
type da4qi4 (line 8) | namespace da4qi4
type Utilities (line 10) | namespace Utilities
FILE: include/daqi/utilities/html_utilities.hpp
type da4qi4 (line 8) | namespace da4qi4
type Utilities (line 10) | namespace Utilities
FILE: include/daqi/utilities/http_utilities.hpp
type da4qi4 (line 7) | namespace da4qi4
type Utilities (line 9) | namespace Utilities
FILE: include/daqi/utilities/md5_utilities.hpp
type da4qi4 (line 6) | namespace da4qi4
type Utilities (line 8) | namespace Utilities
type MD5ResultEncoding (line 11) | enum class MD5ResultEncoding
FILE: include/daqi/utilities/string_utilities.hpp
type da4qi4 (line 9) | namespace da4qi4
type Utilities (line 11) | namespace Utilities
type IgnoreCaseCompare (line 25) | struct IgnoreCaseCompare
type IgnoreCaseCompareDESC (line 30) | struct IgnoreCaseCompareDESC
type CompareDESC (line 39) | struct CompareDESC
type TrimOptions (line 57) | enum class TrimOptions {keep_space, trim_all, trim_left, trim_right}
FILE: include/daqi/websocket/connection_websocket.hpp
type da4qi4 (line 15) | namespace da4qi4
type Websocket (line 17) | namespace Websocket
type WriteDataType (line 20) | enum class WriteDataType {continuation = 0, text = 1, binary = 2}
class Connection (line 22) | class Connection final : public std::enable_shared_from_this<Connect...
method Connection (line 35) | Connection(const Connection&) = delete;
method Connection (line 36) | Connection& operator=(const Connection&) = delete;
method IsWithSSL (line 39) | bool IsWithSSL() const
method GetIOContextIndex (line 44) | size_t GetIOContextIndex() const
method SetID (line 62) | void SetID(std::string const& id)
method Url (line 67) | Url const* GetURLDataPtr() const
method ClearURLData (line 72) | void ClearURLData()
method ReleaseURLData (line 81) | void ReleaseURLData()
method ICHeaders (line 90) | ICHeaders const& GetHeaders() const
method ICHeaders (line 95) | ICHeaders& GetHeaders()
method ClearHeaders (line 100) | void ClearHeaders()
method ICCookies (line 105) | ICCookies const& GetCookies() const
method ICCookies (line 110) | ICCookies& GetCookies()
method ClearCookies (line 115) | void ClearCookies()
method RemoveHttpInfo (line 120) | void RemoveHttpInfo()
method EventsHandler (line 127) | EventsHandler* GetEventHandler()
method EventsHandler (line 132) | EventsHandler const* GetEventHandler() const
method makesure_url_path_storaged (line 156) | void makesure_url_path_storaged()
class Connections (line 192) | class Connections
method Connections (line 195) | Connections()
method Connections (line 200) | Connections(Connections const&) = delete;
method Connections (line 201) | Connections& operator = (Connections const&) = delete;
method Connections (line 203) | Connections(Connections&& o) = default;
method Connections (line 205) | Connections(Connection::Ptr cnt)
FILE: include/daqi/websocket/context_websocket.hpp
type da4qi4 (line 9) | namespace da4qi4
class Application (line 12) | class Application
type Websocket (line 15) | namespace Websocket
class ContextIMP (line 18) | class ContextIMP final : public std::enable_shared_from_this<Context...
method ApplicationPtr (line 36) | ApplicationPtr AppPtr()
method SendBinary (line 57) | void SendBinary(std::string const& data)
method URLPath (line 71) | std::string URLPath() const
method Url (line 83) | Url GetURL() const
method ICHeaders (line 89) | ICHeaders const& Headers() const
method ICCookies (line 94) | ICCookies const& Cookies() const
method RemoveHTTPInfo (line 99) | void RemoveHTTPInfo()
method IsHoldConnectionLife (line 105) | bool IsHoldConnectionLife() const
class ContextList (line 126) | class ContextList
type iterator (line 129) | struct iterator
method iterator (line 131) | iterator(std::list<Connection::Ptr>::iterator lst_it, std::weak_...
method iterator (line 135) | iterator& operator = (iterator const& o)
method iterator (line 146) | iterator& operator ++()
method iterator (line 152) | iterator operator ++(int)
method Context (line 160) | Context operator * ()
type const_iterator (line 170) | struct const_iterator
method const_iterator (line 172) | const_iterator(std::list<Connection::Ptr>::const_iterator lst_it...
method const_iterator (line 176) | const_iterator& operator = (const_iterator const& o)
method const_iterator (line 187) | const_iterator& operator ++()
method const_iterator (line 193) | const_iterator operator ++(int)
method Context (line 201) | const Context operator * ()
FILE: include/daqi/websocket/frame_websocket.hpp
type da4qi4 (line 14) | namespace da4qi4
type Websocket (line 16) | namespace Websocket
type FrameType (line 19) | enum FrameType
type FrameHeader (line 29) | struct FrameHeader
class FrameBuilder (line 56) | class FrameBuilder
method FrameBuilder (line 59) | FrameBuilder() = default;
method FrameBuilder (line 61) | FrameBuilder& ResetMaskingKey()
method FrameBuilder (line 67) | FrameBuilder& SetMaskingKey(uint32_t masking_key)
method FrameBuilder (line 73) | FrameBuilder& SetFIN(bool val)
method FrameBuilder (line 78) | FrameBuilder& SetFrameType(FrameType type)
method Build (line 84) | std::string Build(std::string const& data)
method Build (line 89) | std::string Build(const char* data)
method Build (line 94) | std::string Build()
class FrameParser (line 124) | class FrameParser
method FrameParser (line 129) | FrameParser()
method FrameParser (line 136) | FrameParser(FrameParser&& parser)
method FrameParser (line 141) | FrameParser& operator= (FrameParser&& parser)
method FrameParser (line 147) | FrameParser& RegistMsgCallback(MsgCallback const& handle)
method Reset (line 155) | void Reset()
type parser_step (line 170) | enum parser_step
FILE: include/daqi/websocket/handler_websocket.hpp
type da4qi4 (line 7) | namespace da4qi4
type Websocket (line 9) | namespace Websocket
class ContextIMP (line 12) | class ContextIMP
type EventOn (line 15) | enum class EventOn
class EventsHandler (line 20) | class EventsHandler
class EmptyEventsHandler (line 36) | class EmptyEventsHandler : public EventsHandler
method EmptyEventsHandler (line 39) | EmptyEventsHandler() = default;
method OnOpen (line 42) | bool OnOpen(Context) override
method OnText (line 47) | void OnText(Context, std::string&&, bool) override {}
method OnBinary (line 48) | void OnBinary(Context, std::string&&, bool) override {}
method OnError (line 49) | void OnError(Context, EventOn, int, std::string const&) override {}
method OnClose (line 50) | void OnClose(Context, EventOn) override {}
type EventHandleFunctor (line 53) | struct EventHandleFunctor : public EventsHandler
FILE: inja/bytecode.hpp
type inja (line 14) | namespace inja {
type Bytecode (line 19) | struct Bytecode {
type Op (line 20) | enum class Op : uint8_t {
type Flag (line 106) | enum Flag {
method Bytecode (line 126) | Bytecode(): args(0), flags(0) {}
method Bytecode (line 127) | explicit Bytecode(Op op, unsigned int args = 0): op(op), args(args),...
method Bytecode (line 128) | explicit Bytecode(Op op, nonstd::string_view str, unsigned int flags...
method Bytecode (line 129) | explicit Bytecode(Op op, json&& value, unsigned int flags): op(op), ...
FILE: inja/config.hpp
type inja (line 12) | namespace inja {
type ElementNotation (line 14) | enum class ElementNotation {
type LexerConfig (line 22) | struct LexerConfig {
method update_open_chars (line 35) | void update_open_chars() {
type ParserConfig (line 55) | struct ParserConfig {
FILE: inja/environment.hpp
type inja (line 23) | namespace inja {
class Environment (line 30) | class Environment {
class Impl (line 31) | class Impl {
method Environment (line 46) | Environment(): Environment("") { }
method Environment (line 48) | explicit Environment(const std::string& global_path): m_impl(stdinja...
method Environment (line 53) | explicit Environment(const std::string& input_path, const std::strin...
method set_statement (line 59) | void set_statement(const std::string& open, const std::string& close) {
method set_line_statement (line 66) | void set_line_statement(const std::string& open) {
method set_expression (line 72) | void set_expression(const std::string& open, const std::string& clos...
method set_comment (line 79) | void set_comment(const std::string& open, const std::string& close) {
method set_trim_blocks (line 86) | void set_trim_blocks(bool trim_blocks) {
method set_lstrip_blocks (line 91) | void set_lstrip_blocks(bool lstrip_blocks) {
method set_element_notation (line 96) | void set_element_notation(ElementNotation notation) {
method Template (line 101) | Template parse(nonstd::string_view input) {
method Template (line 106) | Template parse_template(const std::string& filename) {
method render (line 111) | std::string render(nonstd::string_view input, const json& data) {
method render (line 115) | std::string render(const Template& tmpl, const json& data) {
method render_file (line 121) | std::string render_file(const std::string& filename, const json& dat...
method render_file_with_json_file (line 125) | std::string render_file_with_json_file(const std::string& filename, ...
method write (line 130) | void write(const std::string& filename, const json& data, const std:...
method write (line 136) | void write(const Template& temp, const json& data, const std::string...
method write_with_json_file (line 142) | void write_with_json_file(const std::string& filename, const std::st...
method write_with_json_file (line 147) | void write_with_json_file(const Template& temp, const std::string& f...
method load_file (line 157) | std::string load_file(const std::string& filename) {
method json (line 162) | json load_json(const std::string& filename) {
method add_callback (line 169) | void add_callback(const std::string& name, unsigned int numArgs, con...
method include_template (line 177) | void include_template(const std::string& name, const Template& tmpl) {
function render (line 185) | inline std::string render(nonstd::string_view input, const json& data) {
function render_to (line 192) | inline void render_to(std::ostream& os, nonstd::string_view input, con...
FILE: inja/function_storage.hpp
type inja (line 12) | namespace inja {
class FunctionStorage (line 22) | class FunctionStorage {
method add_builtin (line 24) | void add_builtin(nonstd::string_view name, unsigned int num_args, By...
method add_callback (line 29) | void add_callback(nonstd::string_view name, unsigned int num_args, c...
method find_builtin (line 34) | Bytecode::Op find_builtin(nonstd::string_view name, unsigned int num...
method CallbackFunction (line 41) | CallbackFunction find_callback(nonstd::string_view name, unsigned in...
type FunctionData (line 49) | struct FunctionData {
method FunctionData (line 55) | FunctionData& get_or_new(nonstd::string_view name, unsigned int num_...
method FunctionData (line 65) | const FunctionData* get(nonstd::string_view name, unsigned int num_a...
FILE: inja/lexer.hpp
type inja (line 14) | namespace inja {
class Lexer (line 19) | class Lexer {
type State (line 20) | enum class State {
method Lexer (line 38) | explicit Lexer(const LexerConfig& config) : m_config(config) {}
method start (line 40) | void start(nonstd::string_view in) {
method Token (line 47) | Token scan() {
method LexerConfig (line 135) | const LexerConfig& get_config() const { return m_config; }
method Token (line 138) | Token scan_body(nonstd::string_view close, Token::Kind closeKind, bo...
method Token (line 228) | Token scan_id() {
method Token (line 242) | Token scan_number() {
method Token (line 257) | Token scan_string() {
method Token (line 273) | Token make_token(Token::Kind kind) const {
method skip_newline (line 277) | void skip_newline() {
method clear_final_line_if_whitespace (line 290) | static nonstd::string_view clear_final_line_if_whitespace(nonstd::st...
FILE: inja/parser.hpp
type inja (line 22) | namespace inja {
class ParserStatic (line 24) | class ParserStatic {
method ParserStatic (line 25) | ParserStatic() {
method ParserStatic (line 55) | ParserStatic(const ParserStatic&) = delete;
method ParserStatic (line 56) | ParserStatic& operator=(const ParserStatic&) = delete;
method ParserStatic (line 58) | static const ParserStatic& get_instance() {
class Parser (line 69) | class Parser {
method Parser (line 71) | explicit Parser(const ParserConfig& parser_config, const LexerConfig...
method parse_expression (line 73) | bool parse_expression(Template& tmpl) {
method parse_expression_and (line 82) | bool parse_expression_and(Template& tmpl) {
method parse_expression_not (line 91) | bool parse_expression_not(Template& tmpl) {
method parse_expression_comparison (line 102) | bool parse_expression_comparison(Template& tmpl) {
method parse_expression_datum (line 139) | bool parse_expression_datum(Template& tmpl) {
method parse_statement (line 273) | bool parse_statement(Template& tmpl, nonstd::string_view path) {
method append_function (line 410) | void append_function(Template& tmpl, Bytecode::Op op, unsigned int n...
method append_callback (line 425) | void append_callback(Template& tmpl, nonstd::string_view name, unsig...
method parse_into (line 443) | void parse_into(Template& tmpl, nonstd::string_view path) {
method Template (line 496) | Template parse(nonstd::string_view input, nonstd::string_view path) {
method Template (line 503) | Template parse(nonstd::string_view input) {
method Template (line 507) | Template parse_template(nonstd::string_view filename) {
method load_file (line 517) | std::string load_file(nonstd::string_view filename) {
type IfData (line 532) | struct IfData {
method IfData (line 536) | explicit IfData(unsigned int condJump): prev_cond_jump(condJump) {}
method get_next_token (line 542) | void get_next_token() {
method get_peek_token (line 551) | void get_peek_token() {
FILE: inja/polyfill.hpp
type stdinja (line 15) | namespace stdinja {
type _Unique_if (line 17) | struct _Unique_if {
type _Unique_if<T[]> (line 21) | struct _Unique_if<T[]> {
type _Unique_if<T[N]> (line 25) | struct _Unique_if<T[N]> {
function make_unique (line 30) | typename _Unique_if<T>::_Single_object
function make_unique (line 36) | typename _Unique_if<T>::_Unknown_bound
FILE: inja/renderer.hpp
type inja (line 19) | namespace inja {
function convert_dot_to_json_pointer (line 21) | inline nonstd::string_view convert_dot_to_json_pointer(nonstd::string_...
class Renderer (line 35) | class Renderer {
method pop_args (line 59) | void pop_args(const Bytecode& bc) {
method json (line 69) | const json* get_imm(const Bytecode& bc) {
method truthy (line 100) | bool truthy(const json& var) const {
method update_loop_data (line 117) | void update_loop_data() {
type LoopLevel (line 139) | struct LoopLevel {
type Type (line 140) | enum class Type { Map, Array }
method Renderer (line 168) | Renderer(const TemplateStorage& included_templates, const FunctionSt...
method render_to (line 174) | void render_to(std::ostream& os, const Template& tmpl, const json& d...
FILE: inja/string_view.hpp
type nonstd (line 115) | namespace nonstd {
function to_string (line 118) | std::basic_string<CharT, Traits, Allocator>
function to_string_view (line 125) | std::basic_string_view<CharT, Traits>
type literals (line 141) | inline namespace literals {
type string_view_literals (line 142) | inline namespace string_view_literals {
type sv_lite (line 403) | namespace sv_lite {
class basic_string_view (line 410) | class basic_string_view
method nssv_constexpr (line 450) | nssv_constexpr basic_string_view( basic_string_view const & other ...
method begin (line 483) | begin() const nssv_noexcept { return data_; }
method end (line 484) | end() const nssv_noexcept { return data_ + size_; }
method cbegin (line 486) | cbegin() const nssv_noexcept { return begin(); }
method cend (line 487) | cend() const nssv_noexcept { return end(); }
method rbegin (line 489) | rbegin() const nssv_noexcept { return const_reverse_iterator( end...
method rend (line 490) | rend() const nssv_noexcept { return const_reverse_iterator( beg...
method crbegin (line 492) | crbegin() const nssv_noexcept { return rbegin(); }
method crend (line 493) | crend() const nssv_noexcept { return rend(); }
method nssv_constexpr (line 497) | nssv_constexpr size_type size() const nssv_noexcept { return s...
method nssv_constexpr (line 498) | nssv_constexpr size_type length() const nssv_noexcept { return s...
method nssv_constexpr (line 499) | nssv_constexpr size_type max_size() const nssv_noexcept { return (...
method empty (line 502) | bool empty() const nssv_noexcept
method at (line 514) | at( size_type pos ) const
method front (line 527) | front() const { return data_at( 0 ); }
method back (line 528) | back() const { return data_at( size() - 1 ); }
method data (line 530) | data() const nssv_noexcept { return data_; }
method nssv_constexpr14 (line 534) | nssv_constexpr14 void remove_prefix( size_type n )
method nssv_constexpr14 (line 541) | nssv_constexpr14 void remove_suffix( size_type n )
method nssv_constexpr14 (line 547) | nssv_constexpr14 void swap( basic_string_view & other ) nssv_noexcept
method size_type (line 556) | size_type copy( CharT * dest, size_type n, size_type pos = 0 ) const
method substr (line 573) | substr( size_type pos = 0, size_type n = npos ) const
method nssv_constexpr14 (line 588) | nssv_constexpr14 int compare( basic_string_view other ) const nssv...
method nssv_constexpr (line 596) | nssv_constexpr int compare( size_type pos1, size_type n1, basic_st...
method nssv_constexpr (line 601) | nssv_constexpr int compare( size_type pos1, size_type n1, basic_st...
method nssv_constexpr (line 606) | nssv_constexpr int compare( CharT const * s ) const // (4)
method nssv_constexpr (line 611) | nssv_constexpr int compare( size_type pos1, size_type n1, CharT co...
method nssv_constexpr (line 616) | nssv_constexpr int compare( size_type pos1, size_type n1, CharT co...
method nssv_constexpr (line 625) | nssv_constexpr bool starts_with( basic_string_view v ) const nssv_...
method nssv_constexpr (line 630) | nssv_constexpr bool starts_with( CharT c ) const nssv_noexcept //...
method nssv_constexpr (line 635) | nssv_constexpr bool starts_with( CharT const * s ) const // (3)
method nssv_constexpr (line 642) | nssv_constexpr bool ends_with( basic_string_view v ) const nssv_no...
method nssv_constexpr (line 647) | nssv_constexpr bool ends_with( CharT c ) const nssv_noexcept // (2)
method nssv_constexpr (line 652) | nssv_constexpr bool ends_with( CharT const * s ) const // (3)
method nssv_constexpr14 (line 659) | nssv_constexpr14 size_type find( basic_string_view v, size_type po...
method nssv_constexpr14 (line 667) | nssv_constexpr14 size_type find( CharT c, size_type pos = 0 ) cons...
method nssv_constexpr14 (line 672) | nssv_constexpr14 size_type find( CharT const * s, size_type pos, s...
method nssv_constexpr14 (line 677) | nssv_constexpr14 size_type find( CharT const * s, size_type pos = ...
method nssv_constexpr14 (line 684) | nssv_constexpr14 size_type rfind( basic_string_view v, size_type p...
method nssv_constexpr14 (line 698) | nssv_constexpr14 size_type rfind( CharT c, size_type pos = npos ) ...
method nssv_constexpr14 (line 703) | nssv_constexpr14 size_type rfind( CharT const * s, size_type pos, ...
method nssv_constexpr14 (line 708) | nssv_constexpr14 size_type rfind( CharT const * s, size_type pos =...
method nssv_constexpr (line 715) | nssv_constexpr size_type find_first_of( basic_string_view v, size_...
method nssv_constexpr (line 722) | nssv_constexpr size_type find_first_of( CharT c, size_type pos = 0...
method nssv_constexpr (line 727) | nssv_constexpr size_type find_first_of( CharT const * s, size_type...
method nssv_constexpr (line 732) | nssv_constexpr size_type find_first_of( CharT const * s, size_typ...
method nssv_constexpr (line 739) | nssv_constexpr size_type find_last_of( basic_string_view v, size_t...
method nssv_constexpr (line 748) | nssv_constexpr size_type find_last_of( CharT c, size_type pos = np...
method nssv_constexpr (line 753) | nssv_constexpr size_type find_last_of( CharT const * s, size_type ...
method nssv_constexpr (line 758) | nssv_constexpr size_type find_last_of( CharT const * s, size_type ...
method nssv_constexpr (line 765) | nssv_constexpr size_type find_first_not_of( basic_string_view v, s...
method nssv_constexpr (line 772) | nssv_constexpr size_type find_first_not_of( CharT c, size_type pos...
method nssv_constexpr (line 777) | nssv_constexpr size_type find_first_not_of( CharT const * s, size_...
method nssv_constexpr (line 782) | nssv_constexpr size_type find_first_not_of( CharT const * s, size_...
method nssv_constexpr (line 789) | nssv_constexpr size_type find_last_not_of( basic_string_view v, si...
method nssv_constexpr (line 798) | nssv_constexpr size_type find_last_not_of( CharT c, size_type pos ...
method nssv_constexpr (line 803) | nssv_constexpr size_type find_last_not_of( CharT const * s, size_t...
method nssv_constexpr (line 808) | nssv_constexpr size_type find_last_not_of( CharT const * s, size_t...
type size_type (line 818) | enum : size_type { npos = size_type(-1) }
type not_in_view (line 824) | struct not_in_view
method nssv_constexpr (line 828) | nssv_constexpr not_in_view( basic_string_view v ) : v( v ) {}
method nssv_constexpr (line 830) | nssv_constexpr bool operator()( CharT c ) const
method nssv_constexpr (line 836) | nssv_constexpr size_type to_pos( const_iterator it ) const
method nssv_constexpr (line 841) | nssv_constexpr size_type to_pos( const_reverse_iterator it ) const
method data_at (line 846) | data_at( size_type pos ) const
method basic_string_view (line 863) | basic_string_view( std::basic_string<CharT, Traits, Allocator> con...
method to_string (line 881) | std::basic_string<CharT, Traits, Allocator>
method to_string (line 889) | std::basic_string<CharT, Traits>
method to_string (line 896) | std::basic_string<CharT, Traits, Allocator>
class basic_string_view (line 421) | class basic_string_view
method nssv_constexpr (line 450) | nssv_constexpr basic_string_view( basic_string_view const & other ...
method begin (line 483) | begin() const nssv_noexcept { return data_; }
method end (line 484) | end() const nssv_noexcept { return data_ + size_; }
method cbegin (line 486) | cbegin() const nssv_noexcept { return begin(); }
method cend (line 487) | cend() const nssv_noexcept { return end(); }
method rbegin (line 489) | rbegin() const nssv_noexcept { return const_reverse_iterator( end...
method rend (line 490) | rend() const nssv_noexcept { return const_reverse_iterator( beg...
method crbegin (line 492) | crbegin() const nssv_noexcept { return rbegin(); }
method crend (line 493) | crend() const nssv_noexcept { return rend(); }
method nssv_constexpr (line 497) | nssv_constexpr size_type size() const nssv_noexcept { return s...
method nssv_constexpr (line 498) | nssv_constexpr size_type length() const nssv_noexcept { return s...
method nssv_constexpr (line 499) | nssv_constexpr size_type max_size() const nssv_noexcept { return (...
method empty (line 502) | bool empty() const nssv_noexcept
method at (line 514) | at( size_type pos ) const
method front (line 527) | front() const { return data_at( 0 ); }
method back (line 528) | back() const { return data_at( size() - 1 ); }
method data (line 530) | data() const nssv_noexcept { return data_; }
method nssv_constexpr14 (line 534) | nssv_constexpr14 void remove_prefix( size_type n )
method nssv_constexpr14 (line 541) | nssv_constexpr14 void remove_suffix( size_type n )
method nssv_constexpr14 (line 547) | nssv_constexpr14 void swap( basic_string_view & other ) nssv_noexcept
method size_type (line 556) | size_type copy( CharT * dest, size_type n, size_type pos = 0 ) const
method substr (line 573) | substr( size_type pos = 0, size_type n = npos ) const
method nssv_constexpr14 (line 588) | nssv_constexpr14 int compare( basic_string_view other ) const nssv...
method nssv_constexpr (line 596) | nssv_constexpr int compare( size_type pos1, size_type n1, basic_st...
method nssv_constexpr (line 601) | nssv_constexpr int compare( size_type pos1, size_type n1, basic_st...
method nssv_constexpr (line 606) | nssv_constexpr int compare( CharT const * s ) const // (4)
method nssv_constexpr (line 611) | nssv_constexpr int compare( size_type pos1, size_type n1, CharT co...
method nssv_constexpr (line 616) | nssv_constexpr int compare( size_type pos1, size_type n1, CharT co...
method nssv_constexpr (line 625) | nssv_constexpr bool starts_with( basic_string_view v ) const nssv_...
method nssv_constexpr (line 630) | nssv_constexpr bool starts_with( CharT c ) const nssv_noexcept //...
method nssv_constexpr (line 635) | nssv_constexpr bool starts_with( CharT const * s ) const // (3)
method nssv_constexpr (line 642) | nssv_constexpr bool ends_with( basic_string_view v ) const nssv_no...
method nssv_constexpr (line 647) | nssv_constexpr bool ends_with( CharT c ) const nssv_noexcept // (2)
method nssv_constexpr (line 652) | nssv_constexpr bool ends_with( CharT const * s ) const // (3)
method nssv_constexpr14 (line 659) | nssv_constexpr14 size_type find( basic_string_view v, size_type po...
method nssv_constexpr14 (line 667) | nssv_constexpr14 size_type find( CharT c, size_type pos = 0 ) cons...
method nssv_constexpr14 (line 672) | nssv_constexpr14 size_type find( CharT const * s, size_type pos, s...
method nssv_constexpr14 (line 677) | nssv_constexpr14 size_type find( CharT const * s, size_type pos = ...
method nssv_constexpr14 (line 684) | nssv_constexpr14 size_type rfind( basic_string_view v, size_type p...
method nssv_constexpr14 (line 698) | nssv_constexpr14 size_type rfind( CharT c, size_type pos = npos ) ...
method nssv_constexpr14 (line 703) | nssv_constexpr14 size_type rfind( CharT const * s, size_type pos, ...
method nssv_constexpr14 (line 708) | nssv_constexpr14 size_type rfind( CharT const * s, size_type pos =...
method nssv_constexpr (line 715) | nssv_constexpr size_type find_first_of( basic_string_view v, size_...
method nssv_constexpr (line 722) | nssv_constexpr size_type find_first_of( CharT c, size_type pos = 0...
method nssv_constexpr (line 727) | nssv_constexpr size_type find_first_of( CharT const * s, size_type...
method nssv_constexpr (line 732) | nssv_constexpr size_type find_first_of( CharT const * s, size_typ...
method nssv_constexpr (line 739) | nssv_constexpr size_type find_last_of( basic_string_view v, size_t...
method nssv_constexpr (line 748) | nssv_constexpr size_type find_last_of( CharT c, size_type pos = np...
method nssv_constexpr (line 753) | nssv_constexpr size_type find_last_of( CharT const * s, size_type ...
method nssv_constexpr (line 758) | nssv_constexpr size_type find_last_of( CharT const * s, size_type ...
method nssv_constexpr (line 765) | nssv_constexpr size_type find_first_not_of( basic_string_view v, s...
method nssv_constexpr (line 772) | nssv_constexpr size_type find_first_not_of( CharT c, size_type pos...
method nssv_constexpr (line 777) | nssv_constexpr size_type find_first_not_of( CharT const * s, size_...
method nssv_constexpr (line 782) | nssv_constexpr size_type find_first_not_of( CharT const * s, size_...
method nssv_constexpr (line 789) | nssv_constexpr size_type find_last_not_of( basic_string_view v, si...
method nssv_constexpr (line 798) | nssv_constexpr size_type find_last_not_of( CharT c, size_type pos ...
method nssv_constexpr (line 803) | nssv_constexpr size_type find_last_not_of( CharT const * s, size_t...
method nssv_constexpr (line 808) | nssv_constexpr size_type find_last_not_of( CharT const * s, size_t...
type size_type (line 818) | enum : size_type { npos = size_type(-1) }
type not_in_view (line 824) | struct not_in_view
method nssv_constexpr (line 828) | nssv_constexpr not_in_view( basic_string_view v ) : v( v ) {}
method nssv_constexpr (line 830) | nssv_constexpr bool operator()( CharT c ) const
method nssv_constexpr (line 836) | nssv_constexpr size_type to_pos( const_iterator it ) const
method nssv_constexpr (line 841) | nssv_constexpr size_type to_pos( const_reverse_iterator it ) const
method data_at (line 846) | data_at( size_type pos ) const
method basic_string_view (line 863) | basic_string_view( std::basic_string<CharT, Traits, Allocator> con...
method to_string (line 881) | std::basic_string<CharT, Traits, Allocator>
method to_string (line 889) | std::basic_string<CharT, Traits>
method to_string (line 896) | std::basic_string<CharT, Traits, Allocator>
function nssv_constexpr (line 915) | nssv_constexpr bool operator== (
function nssv_constexpr (line 921) | nssv_constexpr bool operator!= (
function nssv_constexpr (line 927) | nssv_constexpr bool operator< (
function nssv_constexpr (line 933) | nssv_constexpr bool operator<= (
function nssv_constexpr (line 939) | nssv_constexpr bool operator> (
function nssv_constexpr (line 945) | nssv_constexpr bool operator>= (
class Traits (line 967) | class Traits
function nssv_constexpr (line 968) | nssv_constexpr bool operator==(
class Traits (line 973) | class Traits
function nssv_constexpr (line 974) | nssv_constexpr bool operator==(
class Traits (line 981) | class Traits
function nssv_constexpr (line 982) | nssv_constexpr bool operator!= (
class Traits (line 987) | class Traits
function nssv_constexpr (line 988) | nssv_constexpr bool operator!= (
class Traits (line 995) | class Traits
function nssv_constexpr (line 996) | nssv_constexpr bool operator< (
class Traits (line 1001) | class Traits
function nssv_constexpr (line 1002) | nssv_constexpr bool operator< (
class Traits (line 1009) | class Traits
function nssv_constexpr (line 1010) | nssv_constexpr bool operator<= (
class Traits (line 1015) | class Traits
function nssv_constexpr (line 1016) | nssv_constexpr bool operator<= (
class Traits (line 1023) | class Traits
function nssv_constexpr (line 1024) | nssv_constexpr bool operator> (
class Traits (line 1029) | class Traits
function nssv_constexpr (line 1030) | nssv_constexpr bool operator> (
class Traits (line 1037) | class Traits
function nssv_constexpr (line 1038) | nssv_constexpr bool operator>= (
class Traits (line 1043) | class Traits
function nssv_constexpr (line 1044) | nssv_constexpr bool operator>= (
type detail (line 1056) | namespace detail {
function write_padding (line 1059) | void write_padding( Stream & os, std::streamsize n )
function Stream (line 1066) | Stream & write_to_stream( Stream & os, View const & sv )
function to_string (line 1192) | std::basic_string<CharT, Traits, Allocator>
function to_string (line 1201) | std::basic_string<CharT, Traits>
function to_string (line 1208) | std::basic_string<CharT, Traits, Allocator>
function to_string_view (line 1217) | basic_string_view<CharT, Traits>
function nssv_inline_ns (line 1123) | nssv_inline_ns namespace literals {
type sv_lite (line 1185) | namespace sv_lite {
class basic_string_view (line 410) | class basic_string_view
method nssv_constexpr (line 450) | nssv_constexpr basic_string_view( basic_string_view const & other ...
method begin (line 483) | begin() const nssv_noexcept { return data_; }
method end (line 484) | end() const nssv_noexcept { return data_ + size_; }
method cbegin (line 486) | cbegin() const nssv_noexcept { return begin(); }
method cend (line 487) | cend() const nssv_noexcept { return end(); }
method rbegin (line 489) | rbegin() const nssv_noexcept { return const_reverse_iterator( end...
method rend (line 490) | rend() const nssv_noexcept { return const_reverse_iterator( beg...
method crbegin (line 492) | crbegin() const nssv_noexcept { return rbegin(); }
method crend (line 493) | crend() const nssv_noexcept { return rend(); }
method nssv_constexpr (line 497) | nssv_constexpr size_type size() const nssv_noexcept { return s...
method nssv_constexpr (line 498) | nssv_constexpr size_type length() const nssv_noexcept { return s...
method nssv_constexpr (line 499) | nssv_constexpr size_type max_size() const nssv_noexcept { return (...
method empty (line 502) | bool empty() const nssv_noexcept
method at (line 514) | at( size_type pos ) const
method front (line 527) | front() const { return data_at( 0 ); }
method back (line 528) | back() const { return data_at( size() - 1 ); }
method data (line 530) | data() const nssv_noexcept { return data_; }
method nssv_constexpr14 (line 534) | nssv_constexpr14 void remove_prefix( size_type n )
method nssv_constexpr14 (line 541) | nssv_constexpr14 void remove_suffix( size_type n )
method nssv_constexpr14 (line 547) | nssv_constexpr14 void swap( basic_string_view & other ) nssv_noexcept
method size_type (line 556) | size_type copy( CharT * dest, size_type n, size_type pos = 0 ) const
method substr (line 573) | substr( size_type pos = 0, size_type n = npos ) const
method nssv_constexpr14 (line 588) | nssv_constexpr14 int compare( basic_string_view other ) const nssv...
method nssv_constexpr (line 596) | nssv_constexpr int compare( size_type pos1, size_type n1, basic_st...
method nssv_constexpr (line 601) | nssv_constexpr int compare( size_type pos1, size_type n1, basic_st...
method nssv_constexpr (line 606) | nssv_constexpr int compare( CharT const * s ) const // (4)
method nssv_constexpr (line 611) | nssv_constexpr int compare( size_type pos1, size_type n1, CharT co...
method nssv_constexpr (line 616) | nssv_constexpr int compare( size_type pos1, size_type n1, CharT co...
method nssv_constexpr (line 625) | nssv_constexpr bool starts_with( basic_string_view v ) const nssv_...
method nssv_constexpr (line 630) | nssv_constexpr bool starts_with( CharT c ) const nssv_noexcept //...
method nssv_constexpr (line 635) | nssv_constexpr bool starts_with( CharT const * s ) const // (3)
method nssv_constexpr (line 642) | nssv_constexpr bool ends_with( basic_string_view v ) const nssv_no...
method nssv_constexpr (line 647) | nssv_constexpr bool ends_with( CharT c ) const nssv_noexcept // (2)
method nssv_constexpr (line 652) | nssv_constexpr bool ends_with( CharT const * s ) const // (3)
method nssv_constexpr14 (line 659) | nssv_constexpr14 size_type find( basic_string_view v, size_type po...
method nssv_constexpr14 (line 667) | nssv_constexpr14 size_type find( CharT c, size_type pos = 0 ) cons...
method nssv_constexpr14 (line 672) | nssv_constexpr14 size_type find( CharT const * s, size_type pos, s...
method nssv_constexpr14 (line 677) | nssv_constexpr14 size_type find( CharT const * s, size_type pos = ...
method nssv_constexpr14 (line 684) | nssv_constexpr14 size_type rfind( basic_string_view v, size_type p...
method nssv_constexpr14 (line 698) | nssv_constexpr14 size_type rfind( CharT c, size_type pos = npos ) ...
method nssv_constexpr14 (line 703) | nssv_constexpr14 size_type rfind( CharT const * s, size_type pos, ...
method nssv_constexpr14 (line 708) | nssv_constexpr14 size_type rfind( CharT const * s, size_type pos =...
method nssv_constexpr (line 715) | nssv_constexpr size_type find_first_of( basic_string_view v, size_...
method nssv_constexpr (line 722) | nssv_constexpr size_type find_first_of( CharT c, size_type pos = 0...
method nssv_constexpr (line 727) | nssv_constexpr size_type find_first_of( CharT const * s, size_type...
method nssv_constexpr (line 732) | nssv_constexpr size_type find_first_of( CharT const * s, size_typ...
method nssv_constexpr (line 739) | nssv_constexpr size_type find_last_of( basic_string_view v, size_t...
method nssv_constexpr (line 748) | nssv_constexpr size_type find_last_of( CharT c, size_type pos = np...
method nssv_constexpr (line 753) | nssv_constexpr size_type find_last_of( CharT const * s, size_type ...
method nssv_constexpr (line 758) | nssv_constexpr size_type find_last_of( CharT const * s, size_type ...
method nssv_constexpr (line 765) | nssv_constexpr size_type find_first_not_of( basic_string_view v, s...
method nssv_constexpr (line 772) | nssv_constexpr size_type find_first_not_of( CharT c, size_type pos...
method nssv_constexpr (line 777) | nssv_constexpr size_type find_first_not_of( CharT const * s, size_...
method nssv_constexpr (line 782) | nssv_constexpr size_type find_first_not_of( CharT const * s, size_...
method nssv_constexpr (line 789) | nssv_constexpr size_type find_last_not_of( basic_string_view v, si...
method nssv_constexpr (line 798) | nssv_constexpr size_type find_last_not_of( CharT c, size_type pos ...
method nssv_constexpr (line 803) | nssv_constexpr size_type find_last_not_of( CharT const * s, size_t...
method nssv_constexpr (line 808) | nssv_constexpr size_type find_last_not_of( CharT const * s, size_t...
type size_type (line 818) | enum : size_type { npos = size_type(-1) }
type not_in_view (line 824) | struct not_in_view
method nssv_constexpr (line 828) | nssv_constexpr not_in_view( basic_string_view v ) : v( v ) {}
method nssv_constexpr (line 830) | nssv_constexpr bool operator()( CharT c ) const
method nssv_constexpr (line 836) | nssv_constexpr size_type to_pos( const_iterator it ) const
method nssv_constexpr (line 841) | nssv_constexpr size_type to_pos( const_reverse_iterator it ) const
method data_at (line 846) | data_at( size_type pos ) const
method basic_string_view (line 863) | basic_string_view( std::basic_string<CharT, Traits, Allocator> con...
method to_string (line 881) | std::basic_string<CharT, Traits, Allocator>
method to_string (line 889) | std::basic_string<CharT, Traits>
method to_string (line 896) | std::basic_string<CharT, Traits, Allocator>
class basic_string_view (line 421) | class basic_string_view
method nssv_constexpr (line 450) | nssv_constexpr basic_string_view( basic_string_view const & other ...
method begin (line 483) | begin() const nssv_noexcept { return data_; }
method end (line 484) | end() const nssv_noexcept { return data_ + size_; }
method cbegin (line 486) | cbegin() const nssv_noexcept { return begin(); }
method cend (line 487) | cend() const nssv_noexcept { return end(); }
method rbegin (line 489) | rbegin() const nssv_noexcept { return const_reverse_iterator( end...
method rend (line 490) | rend() const nssv_noexcept { return const_reverse_iterator( beg...
method crbegin (line 492) | crbegin() const nssv_noexcept { return rbegin(); }
method crend (line 493) | crend() const nssv_noexcept { return rend(); }
method nssv_constexpr (line 497) | nssv_constexpr size_type size() const nssv_noexcept { return s...
method nssv_constexpr (line 498) | nssv_constexpr size_type length() const nssv_noexcept { return s...
method nssv_constexpr (line 499) | nssv_constexpr size_type max_size() const nssv_noexcept { return (...
method empty (line 502) | bool empty() const nssv_noexcept
method at (line 514) | at( size_type pos ) const
method front (line 527) | front() const { return data_at( 0 ); }
method back (line 528) | back() const { return data_at( size() - 1 ); }
method data (line 530) | data() const nssv_noexcept { return data_; }
method nssv_constexpr14 (line 534) | nssv_constexpr14 void remove_prefix( size_type n )
method nssv_constexpr14 (line 541) | nssv_constexpr14 void remove_suffix( size_type n )
method nssv_constexpr14 (line 547) | nssv_constexpr14 void swap( basic_string_view & other ) nssv_noexcept
method size_type (line 556) | size_type copy( CharT * dest, size_type n, size_type pos = 0 ) const
method substr (line 573) | substr( size_type pos = 0, size_type n = npos ) const
method nssv_constexpr14 (line 588) | nssv_constexpr14 int compare( basic_string_view other ) const nssv...
method nssv_constexpr (line 596) | nssv_constexpr int compare( size_type pos1, size_type n1, basic_st...
method nssv_constexpr (line 601) | nssv_constexpr int compare( size_type pos1, size_type n1, basic_st...
method nssv_constexpr (line 606) | nssv_constexpr int compare( CharT const * s ) const // (4)
method nssv_constexpr (line 611) | nssv_constexpr int compare( size_type pos1, size_type n1, CharT co...
method nssv_constexpr (line 616) | nssv_constexpr int compare( size_type pos1, size_type n1, CharT co...
method nssv_constexpr (line 625) | nssv_constexpr bool starts_with( basic_string_view v ) const nssv_...
method nssv_constexpr (line 630) | nssv_constexpr bool starts_with( CharT c ) const nssv_noexcept //...
method nssv_constexpr (line 635) | nssv_constexpr bool starts_with( CharT const * s ) const // (3)
method nssv_constexpr (line 642) | nssv_constexpr bool ends_with( basic_string_view v ) const nssv_no...
method nssv_constexpr (line 647) | nssv_constexpr bool ends_with( CharT c ) const nssv_noexcept // (2)
method nssv_constexpr (line 652) | nssv_constexpr bool ends_with( CharT const * s ) const // (3)
method nssv_constexpr14 (line 659) | nssv_constexpr14 size_type find( basic_string_view v, size_type po...
method nssv_constexpr14 (line 667) | nssv_constexpr14 size_type find( CharT c, size_type pos = 0 ) cons...
method nssv_constexpr14 (line 672) | nssv_constexpr14 size_type find( CharT const * s, size_type pos, s...
method nssv_constexpr14 (line 677) | nssv_constexpr14 size_type find( CharT const * s, size_type pos = ...
method nssv_constexpr14 (line 684) | nssv_constexpr14 size_type rfind( basic_string_view v, size_type p...
method nssv_constexpr14 (line 698) | nssv_constexpr14 size_type rfind( CharT c, size_type pos = npos ) ...
method nssv_constexpr14 (line 703) | nssv_constexpr14 size_type rfind( CharT const * s, size_type pos, ...
method nssv_constexpr14 (line 708) | nssv_constexpr14 size_type rfind( CharT const * s, size_type pos =...
method nssv_constexpr (line 715) | nssv_constexpr size_type find_first_of( basic_string_view v, size_...
method nssv_constexpr (line 722) | nssv_constexpr size_type find_first_of( CharT c, size_type pos = 0...
method nssv_constexpr (line 727) | nssv_constexpr size_type find_first_of( CharT const * s, size_type...
method nssv_constexpr (line 732) | nssv_constexpr size_type find_first_of( CharT const * s, size_typ...
method nssv_constexpr (line 739) | nssv_constexpr size_type find_last_of( basic_string_view v, size_t...
method nssv_constexpr (line 748) | nssv_constexpr size_type find_last_of( CharT c, size_type pos = np...
method nssv_constexpr (line 753) | nssv_constexpr size_type find_last_of( CharT const * s, size_type ...
method nssv_constexpr (line 758) | nssv_constexpr size_type find_last_of( CharT const * s, size_type ...
method nssv_constexpr (line 765) | nssv_constexpr size_type find_first_not_of( basic_string_view v, s...
method nssv_constexpr (line 772) | nssv_constexpr size_type find_first_not_of( CharT c, size_type pos...
method nssv_constexpr (line 777) | nssv_constexpr size_type find_first_not_of( CharT const * s, size_...
method nssv_constexpr (line 782) | nssv_constexpr size_type find_first_not_of( CharT const * s, size_...
method nssv_constexpr (line 789) | nssv_constexpr size_type find_last_not_of( basic_string_view v, si...
method nssv_constexpr (line 798) | nssv_constexpr size_type find_last_not_of( CharT c, size_type pos ...
method nssv_constexpr (line 803) | nssv_constexpr size_type find_last_not_of( CharT const * s, size_t...
method nssv_constexpr (line 808) | nssv_constexpr size_type find_last_not_of( CharT const * s, size_t...
type size_type (line 818) | enum : size_type { npos = size_type(-1) }
type not_in_view (line 824) | struct not_in_view
method nssv_constexpr (line 828) | nssv_constexpr not_in_view( basic_string_view v ) : v( v ) {}
method nssv_constexpr (line 830) | nssv_constexpr bool operator()( CharT c ) const
method nssv_constexpr (line 836) | nssv_constexpr size_type to_pos( const_iterator it ) const
method nssv_constexpr (line 841) | nssv_constexpr size_type to_pos( const_reverse_iterator it ) const
method data_at (line 846) | data_at( size_type pos ) const
method basic_string_view (line 863) | basic_string_view( std::basic_string<CharT, Traits, Allocator> con...
method to_string (line 881) | std::basic_string<CharT, Traits, Allocator>
method to_string (line 889) | std::basic_string<CharT, Traits>
method to_string (line 896) | std::basic_string<CharT, Traits, Allocator>
function nssv_constexpr (line 915) | nssv_constexpr bool operator== (
function nssv_constexpr (line 921) | nssv_constexpr bool operator!= (
function nssv_constexpr (line 927) | nssv_constexpr bool operator< (
function nssv_constexpr (line 933) | nssv_constexpr bool operator<= (
function nssv_constexpr (line 939) | nssv_constexpr bool operator> (
function nssv_constexpr (line 945) | nssv_constexpr bool operator>= (
class Traits (line 967) | class Traits
function nssv_constexpr (line 968) | nssv_constexpr bool operator==(
class Traits (line 973) | class Traits
function nssv_constexpr (line 974) | nssv_constexpr bool operator==(
class Traits (line 981) | class Traits
function nssv_constexpr (line 982) | nssv_constexpr bool operator!= (
class Traits (line 987) | class Traits
function nssv_constexpr (line 988) | nssv_constexpr bool operator!= (
class Traits (line 995) | class Traits
function nssv_constexpr (line 996) | nssv_constexpr bool operator< (
class Traits (line 1001) | class Traits
function nssv_constexpr (line 1002) | nssv_constexpr bool operator< (
class Traits (line 1009) | class Traits
function nssv_constexpr (line 1010) | nssv_constexpr bool operator<= (
class Traits (line 1015) | class Traits
function nssv_constexpr (line 1016) | nssv_constexpr bool operator<= (
class Traits (line 1023) | class Traits
function nssv_constexpr (line 1024) | nssv_constexpr bool operator> (
class Traits (line 1029) | class Traits
function nssv_constexpr (line 1030) | nssv_constexpr bool operator> (
class Traits (line 1037) | class Traits
function nssv_constexpr (line 1038) | nssv_constexpr bool operator>= (
class Traits (line 1043) | class Traits
function nssv_constexpr (line 1044) | nssv_constexpr bool operator>= (
type detail (line 1056) | namespace detail {
function write_padding (line 1059) | void write_padding( Stream & os, std::streamsize n )
function Stream (line 1066) | Stream & write_to_stream( Stream & os, View const & sv )
function to_string (line 1192) | std::basic_string<CharT, Traits, Allocator>
function to_string (line 1201) | std::basic_string<CharT, Traits>
function to_string (line 1208) | std::basic_string<CharT, Traits, Allocator>
function to_string_view (line 1217) | basic_string_view<CharT, Traits>
type nonstd (line 173) | namespace nonstd {
function to_string (line 118) | std::basic_string<CharT, Traits, Allocator>
function to_string_view (line 125) | std::basic_string_view<CharT, Traits>
type literals (line 141) | inline namespace literals {
type string_view_literals (line 142) | inline namespace string_view_literals {
type sv_lite (line 403) | namespace sv_lite {
class basic_string_view (line 410) | class basic_string_view
method nssv_constexpr (line 450) | nssv_constexpr basic_string_view( basic_string_view const & other ...
method begin (line 483) | begin() const nssv_noexcept { return data_; }
method end (line 484) | end() const nssv_noexcept { return data_ + size_; }
method cbegin (line 486) | cbegin() const nssv_noexcept { return begin(); }
method cend (line 487) | cend() const nssv_noexcept { return end(); }
method rbegin (line 489) | rbegin() const nssv_noexcept { return const_reverse_iterator( end...
method rend (line 490) | rend() const nssv_noexcept { return const_reverse_iterator( beg...
method crbegin (line 492) | crbegin() const nssv_noexcept { return rbegin(); }
method crend (line 493) | crend() const nssv_noexcept { return rend(); }
method nssv_constexpr (line 497) | nssv_constexpr size_type size() const nssv_noexcept { return s...
method nssv_constexpr (line 498) | nssv_constexpr size_type length() const nssv_noexcept { return s...
method nssv_constexpr (line 499) | nssv_constexpr size_type max_size() const nssv_noexcept { return (...
method empty (line 502) | bool empty() const nssv_noexcept
method at (line 514) | at( size_type pos ) const
method front (line 527) | front() const { return data_at( 0 ); }
method back (line 528) | back() const { return data_at( size() - 1 ); }
method data (line 530) | data() const nssv_noexcept { return data_; }
method nssv_constexpr14 (line 534) | nssv_constexpr14 void remove_prefix( size_type n )
method nssv_constexpr14 (line 541) | nssv_constexpr14 void remove_suffix( size_type n )
method nssv_constexpr14 (line 547) | nssv_constexpr14 void swap( basic_string_view & other ) nssv_noexcept
method size_type (line 556) | size_type copy( CharT * dest, size_type n, size_type pos = 0 ) const
method substr (line 573) | substr( size_type pos = 0, size_type n = npos ) const
method nssv_constexpr14 (line 588) | nssv_constexpr14 int compare( basic_string_view other ) const nssv...
method nssv_constexpr (line 596) | nssv_constexpr int compare( size_type pos1, size_type n1, basic_st...
method nssv_constexpr (line 601) | nssv_constexpr int compare( size_type pos1, size_type n1, basic_st...
method nssv_constexpr (line 606) | nssv_constexpr int compare( CharT const * s ) const // (4)
method nssv_constexpr (line 611) | nssv_constexpr int compare( size_type pos1, size_type n1, CharT co...
method nssv_constexpr (line 616) | nssv_constexpr int compare( size_type pos1, size_type n1, CharT co...
method nssv_constexpr (line 625) | nssv_constexpr bool starts_with( basic_string_view v ) const nssv_...
method nssv_constexpr (line 630) | nssv_constexpr bool starts_with( CharT c ) const nssv_noexcept //...
method nssv_constexpr (line 635) | nssv_constexpr bool starts_with( CharT const * s ) const // (3)
method nssv_constexpr (line 642) | nssv_constexpr bool ends_with( basic_string_view v ) const nssv_no...
method nssv_constexpr (line 647) | nssv_constexpr bool ends_with( CharT c ) const nssv_noexcept // (2)
method nssv_constexpr (line 652) | nssv_constexpr bool ends_with( CharT const * s ) const // (3)
method nssv_constexpr14 (line 659) | nssv_constexpr14 size_type find( basic_string_view v, size_type po...
method nssv_constexpr14 (line 667) | nssv_constexpr14 size_type find( CharT c, size_type pos = 0 ) cons...
method nssv_constexpr14 (line 672) | nssv_constexpr14 size_type find( CharT const * s, size_type pos, s...
method nssv_constexpr14 (line 677) | nssv_constexpr14 size_type find( CharT const * s, size_type pos = ...
method nssv_constexpr14 (line 684) | nssv_constexpr14 size_type rfind( basic_string_view v, size_type p...
method nssv_constexpr14 (line 698) | nssv_constexpr14 size_type rfind( CharT c, size_type pos = npos ) ...
method nssv_constexpr14 (line 703) | nssv_constexpr14 size_type rfind( CharT const * s, size_type pos, ...
method nssv_constexpr14 (line 708) | nssv_constexpr14 size_type rfind( CharT const * s, size_type pos =...
method nssv_constexpr (line 715) | nssv_constexpr size_type find_first_of( basic_string_view v, size_...
method nssv_constexpr (line 722) | nssv_constexpr size_type find_first_of( CharT c, size_type pos = 0...
method nssv_constexpr (line 727) | nssv_constexpr size_type find_first_of( CharT const * s, size_type...
method nssv_constexpr (line 732) | nssv_constexpr size_type find_first_of( CharT const * s, size_typ...
method nssv_constexpr (line 739) | nssv_constexpr size_type find_last_of( basic_string_view v, size_t...
method nssv_constexpr (line 748) | nssv_constexpr size_type find_last_of( CharT c, size_type pos = np...
method nssv_constexpr (line 753) | nssv_constexpr size_type find_last_of( CharT const * s, size_type ...
method nssv_constexpr (line 758) | nssv_constexpr size_type find_last_of( CharT const * s, size_type ...
method nssv_constexpr (line 765) | nssv_constexpr size_type find_first_not_of( basic_string_view v, s...
method nssv_constexpr (line 772) | nssv_constexpr size_type find_first_not_of( CharT c, size_type pos...
method nssv_constexpr (line 777) | nssv_constexpr size_type find_first_not_of( CharT const * s, size_...
method nssv_constexpr (line 782) | nssv_constexpr size_type find_first_not_of( CharT const * s, size_...
method nssv_constexpr (line 789) | nssv_constexpr size_type find_last_not_of( basic_string_view v, si...
method nssv_constexpr (line 798) | nssv_constexpr size_type find_last_not_of( CharT c, size_type pos ...
method nssv_constexpr (line 803) | nssv_constexpr size_type find_last_not_of( CharT const * s, size_t...
method nssv_constexpr (line 808) | nssv_constexpr size_type find_last_not_of( CharT const * s, size_t...
type size_type (line 818) | enum : size_type { npos = size_type(-1) }
type not_in_view (line 824) | struct not_in_view
method nssv_constexpr (line 828) | nssv_constexpr not_in_view( basic_string_view v ) : v( v ) {}
method nssv_constexpr (line 830) | nssv_constexpr bool operator()( CharT c ) const
method nssv_constexpr (line 836) | nssv_constexpr size_type to_pos( const_iterator it ) const
method nssv_constexpr (line 841) | nssv_constexpr size_type to_pos( const_reverse_iterator it ) const
method data_at (line 846) | data_at( size_type pos ) const
method basic_string_view (line 863) | basic_string_view( std::basic_string<CharT, Traits, Allocator> con...
method to_string (line 881) | std::basic_string<CharT, Traits, Allocator>
method to_string (line 889) | std::basic_string<CharT, Traits>
method to_string (line 896) | std::basic_string<CharT, Traits, Allocator>
class basic_string_view (line 421) | class basic_string_view
method nssv_constexpr (line 450) | nssv_constexpr basic_string_view( basic_string_view const & other ...
method begin (line 483) | begin() const nssv_noexcept { return data_; }
method end (line 484) | end() const nssv_noexcept { return data_ + size_; }
method cbegin (line 486) | cbegin() const nssv_noexcept { return begin(); }
method cend (line 487) | cend() const nssv_noexcept { return end(); }
method rbegin (line 489) | rbegin() const nssv_noexcept { return const_reverse_iterator( end...
method rend (line 490) | rend() const nssv_noexcept { return const_reverse_iterator( beg...
method crbegin (line 492) | crbegin() const nssv_noexcept { return rbegin(); }
method crend (line 493) | crend() const nssv_noexcept { return rend(); }
method nssv_constexpr (line 497) | nssv_constexpr size_type size() const nssv_noexcept { return s...
method nssv_constexpr (line 498) | nssv_constexpr size_type length() const nssv_noexcept { return s...
method nssv_constexpr (line 499) | nssv_constexpr size_type max_size() const nssv_noexcept { return (...
method empty (line 502) | bool empty() const nssv_noexcept
method at (line 514) | at( size_type pos ) const
method front (line 527) | front() const { return data_at( 0 ); }
method back (line 528) | back() const { return data_at( size() - 1 ); }
method data (line 530) | data() const nssv_noexcept { return data_; }
method nssv_constexpr14 (line 534) | nssv_constexpr14 void remove_prefix( size_type n )
method nssv_constexpr14 (line 541) | nssv_constexpr14 void remove_suffix( size_type n )
method nssv_constexpr14 (line 547) | nssv_constexpr14 void swap( basic_string_view & other ) nssv_noexcept
method size_type (line 556) | size_type copy( CharT * dest, size_type n, size_type pos = 0 ) const
method substr (line 573) | substr( size_type pos = 0, size_type n = npos ) const
method nssv_constexpr14 (line 588) | nssv_constexpr14 int compare( basic_string_view other ) const nssv...
method nssv_constexpr (line 596) | nssv_constexpr int compare( size_type pos1, size_type n1, basic_st...
method nssv_constexpr (line 601) | nssv_constexpr int compare( size_type pos1, size_type n1, basic_st...
method nssv_constexpr (line 606) | nssv_constexpr int compare( CharT const * s ) const // (4)
method nssv_constexpr (line 611) | nssv_constexpr int compare( size_type pos1, size_type n1, CharT co...
method nssv_constexpr (line 616) | nssv_constexpr int compare( size_type pos1, size_type n1, CharT co...
method nssv_constexpr (line 625) | nssv_constexpr bool starts_with( basic_string_view v ) const nssv_...
method nssv_constexpr (line 630) | nssv_constexpr bool starts_with( CharT c ) const nssv_noexcept //...
method nssv_constexpr (line 635) | nssv_constexpr bool starts_with( CharT const * s ) const // (3)
method nssv_constexpr (line 642) | nssv_constexpr bool ends_with( basic_string_view v ) const nssv_no...
method nssv_constexpr (line 647) | nssv_constexpr bool ends_with( CharT c ) const nssv_noexcept // (2)
method nssv_constexpr (line 652) | nssv_constexpr bool ends_with( CharT const * s ) const // (3)
method nssv_constexpr14 (line 659) | nssv_constexpr14 size_type find( basic_string_view v, size_type po...
method nssv_constexpr14 (line 667) | nssv_constexpr14 size_type find( CharT c, size_type pos = 0 ) cons...
method nssv_constexpr14 (line 672) | nssv_constexpr14 size_type find( CharT const * s, size_type pos, s...
method nssv_constexpr14 (line 677) | nssv_constexpr14 size_type find( CharT const * s, size_type pos = ...
method nssv_constexpr14 (line 684) | nssv_constexpr14 size_type rfind( basic_string_view v, size_type p...
method nssv_constexpr14 (line 698) | nssv_constexpr14 size_type rfind( CharT c, size_type pos = npos ) ...
method nssv_constexpr14 (line 703) | nssv_constexpr14 size_type rfind( CharT const * s, size_type pos, ...
method nssv_constexpr14 (line 708) | nssv_constexpr14 size_type rfind( CharT const * s, size_type pos =...
method nssv_constexpr (line 715) | nssv_constexpr size_type find_first_of( basic_string_view v, size_...
method nssv_constexpr (line 722) | nssv_constexpr size_type find_first_of( CharT c, size_type pos = 0...
method nssv_constexpr (line 727) | nssv_constexpr size_type find_first_of( CharT const * s, size_type...
method nssv_constexpr (line 732) | nssv_constexpr size_type find_first_of( CharT const * s, size_typ...
method nssv_constexpr (line 739) | nssv_constexpr size_type find_last_of( basic_string_view v, size_t...
method nssv_constexpr (line 748) | nssv_constexpr size_type find_last_of( CharT c, size_type pos = np...
method nssv_constexpr (line 753) | nssv_constexpr size_type find_last_of( CharT const * s, size_type ...
method nssv_constexpr (line 758) | nssv_constexpr size_type find_last_of( CharT const * s, size_type ...
method nssv_constexpr (line 765) | nssv_constexpr size_type find_first_not_of( basic_string_view v, s...
method nssv_constexpr (line 772) | nssv_constexpr size_type find_first_not_of( CharT c, size_type pos...
method nssv_constexpr (line 777) | nssv_constexpr size_type find_first_not_of( CharT const * s, size_...
method nssv_constexpr (line 782) | nssv_constexpr size_type find_first_not_of( CharT const * s, size_...
method nssv_constexpr (line 789) | nssv_constexpr size_type find_last_not_of( basic_string_view v, si...
method nssv_constexpr (line 798) | nssv_constexpr size_type find_last_not_of( CharT c, size_type pos ...
method nssv_constexpr (line 803) | nssv_constexpr size_type find_last_not_of( CharT const * s, size_t...
method nssv_constexpr (line 808) | nssv_constexpr size_type find_last_not_of( CharT const * s, size_t...
type size_type (line 818) | enum : size_type { npos = size_type(-1) }
type not_in_view (line 824) | struct not_in_view
method nssv_constexpr (line 828) | nssv_constexpr not_in_view( basic_string_view v ) : v( v ) {}
method nssv_constexpr (line 830) | nssv_constexpr bool operator()( CharT c ) const
method nssv_constexpr (line 836) | nssv_constexpr size_type to_pos( const_iterator it ) const
method nssv_constexpr (line 841) | nssv_constexpr size_type to_pos( const_reverse_iterator it ) const
method data_at (line 846) | data_at( size_type pos ) const
method basic_string_view (line 863) | basic_string_view( std::basic_string<CharT, Traits, Allocator> con...
method to_string (line 881) | std::basic_string<CharT, Traits, Allocator>
method to_string (line 889) | std::basic_string<CharT, Traits>
method to_string (line 896) | std::basic_string<CharT, Traits, Allocator>
function nssv_constexpr (line 915) | nssv_constexpr bool operator== (
function nssv_constexpr (line 921) | nssv_constexpr bool operator!= (
function nssv_constexpr (line 927) | nssv_constexpr bool operator< (
function nssv_constexpr (line 933) | nssv_constexpr bool operator<= (
function nssv_constexpr (line 939) | nssv_constexpr bool operator> (
function nssv_constexpr (line 945) | nssv_constexpr bool operator>= (
class Traits (line 967) | class Traits
function nssv_constexpr (line 968) | nssv_constexpr bool operator==(
class Traits (line 973) | class Traits
function nssv_constexpr (line 974) | nssv_constexpr bool operator==(
class Traits (line 981) | class Traits
function nssv_constexpr (line 982) | nssv_constexpr bool operator!= (
class Traits (line 987) | class Traits
function nssv_constexpr (line 988) | nssv_constexpr bool operator!= (
class Traits (line 995) | class Traits
function nssv_constexpr (line 996) | nssv_constexpr bool operator< (
class Traits (line 1001) | class Traits
function nssv_constexpr (line 1002) | nssv_constexpr bool operator< (
class Traits (line 1009) | class Traits
function nssv_constexpr (line 1010) | nssv_constexpr bool operator<= (
class Traits (line 1015) | class Traits
function nssv_constexpr (line 1016) | nssv_constexpr bool operator<= (
class Traits (line 1023) | class Traits
function nssv_constexpr (line 1024) | nssv_constexpr bool operator> (
class Traits (line 1029) | class Traits
function nssv_constexpr (line 1030) | nssv_constexpr bool operator> (
class Traits (line 1037) | class Traits
function nssv_constexpr (line 1038) | nssv_constexpr bool operator>= (
class Traits (line 1043) | class Traits
function nssv_constexpr (line 1044) | nssv_constexpr bool operator>= (
type detail (line 1056) | namespace detail {
function write_padding (line 1059) | void write_padding( Stream & os, std::streamsize n )
function Stream (line 1066) | Stream & write_to_stream( Stream & os, View const & sv )
function to_string (line 1192) | std::basic_string<CharT, Traits, Allocator>
function to_string (line 1201) | std::basic_string<CharT, Traits>
function to_string (line 1208) | std::basic_string<CharT, Traits, Allocator>
function to_string_view (line 1217) | basic_string_view<CharT, Traits>
function nssv_inline_ns (line 1123) | nssv_inline_ns namespace literals {
type sv_lite (line 1185) | namespace sv_lite {
class basic_string_view (line 410) | class basic_string_view
method nssv_constexpr (line 450) | nssv_constexpr basic_string_view( basic_string_view const & other ...
method begin (line 483) | begin() const nssv_noexcept { return data_; }
method end (line 484) | end() const nssv_noexcept { return data_ + size_; }
method cbegin (line 486) | cbegin() const nssv_noexcept { return begin(); }
method cend (line 487) | cend() const nssv_noexcept { return end(); }
method rbegin (line 489) | rbegin() const nssv_noexcept { return const_reverse_iterator( end...
method rend (line 490) | rend() const nssv_noexcept { return const_reverse_iterator( beg...
method crbegin (line 492) | crbegin() const nssv_noexcept { return rbegin(); }
method crend (line 493) | crend() const nssv_noexcept { return rend(); }
method nssv_constexpr (line 497) | nssv_constexpr size_type size() const nssv_noexcept { return s...
method nssv_constexpr (line 498) | nssv_constexpr size_type length() const nssv_noexcept { return s...
method nssv_constexpr (line 499) | nssv_constexpr size_type max_size() const nssv_noexcept { return (...
method empty (line 502) | bool empty() const nssv_noexcept
method at (line 514) | at( size_type pos ) const
method front (line 527) | front() const { return data_at( 0 ); }
method back (line 528) | back() const { return data_at( size() - 1 ); }
method data (line 530) | data() const nssv_noexcept { return data_; }
method nssv_constexpr14 (line 534) | nssv_constexpr14 void remove_prefix( size_type n )
method nssv_constexpr14 (line 541) | nssv_constexpr14 void remove_suffix( size_type n )
method nssv_constexpr14 (line 547) | nssv_constexpr14 void swap( basic_string_view & other ) nssv_noexcept
method size_type (line 556) | size_type copy( CharT * dest, size_type n, size_type pos = 0 ) const
method substr (line 573) | substr( size_type pos = 0, size_type n = npos ) const
method nssv_constexpr14 (line 588) | nssv_constexpr14 int compare( basic_string_view other ) const nssv...
method nssv_constexpr (line 596) | nssv_constexpr int compare( size_type pos1, size_type n1, basic_st...
method nssv_constexpr (line 601) | nssv_constexpr int compare( size_type pos1, size_type n1, basic_st...
method nssv_constexpr (line 606) | nssv_constexpr int compare( CharT const * s ) const // (4)
method nssv_constexpr (line 611) | nssv_constexpr int compare( size_type pos1, size_type n1, CharT co...
method nssv_constexpr (line 616) | nssv_constexpr int compare( size_type pos1, size_type n1, CharT co...
method nssv_constexpr (line 625) | nssv_constexpr bool starts_with( basic_string_view v ) const nssv_...
method nssv_constexpr (line 630) | nssv_constexpr bool starts_with( CharT c ) const nssv_noexcept //...
method nssv_constexpr (line 635) | nssv_constexpr bool starts_with( CharT const * s ) const // (3)
method nssv_constexpr (line 642) | nssv_constexpr bool ends_with( basic_string_view v ) const nssv_no...
method nssv_constexpr (line 647) | nssv_constexpr bool ends_with( CharT c ) const nssv_noexcept // (2)
method nssv_constexpr (line 652) | nssv_constexpr bool ends_with( CharT const * s ) const // (3)
method nssv_constexpr14 (line 659) | nssv_constexpr14 size_type find( basic_string_view v, size_type po...
method nssv_constexpr14 (line 667) | nssv_constexpr14 size_type find( CharT c, size_type pos = 0 ) cons...
method nssv_constexpr14 (line 672) | nssv_constexpr14 size_type find( CharT const * s, size_type pos, s...
method nssv_constexpr14 (line 677) | nssv_constexpr14 size_type find( CharT const * s, size_type pos = ...
method nssv_constexpr14 (line 684) | nssv_constexpr14 size_type rfind( basic_string_view v, size_type p...
method nssv_constexpr14 (line 698) | nssv_constexpr14 size_type rfind( CharT c, size_type pos = npos ) ...
method nssv_constexpr14 (line 703) | nssv_constexpr14 size_type rfind( CharT const * s, size_type pos, ...
method nssv_constexpr14 (line 708) | nssv_constexpr14 size_type rfind( CharT const * s, size_type pos =...
method nssv_constexpr (line 715) | nssv_constexpr size_type find_first_of( basic_string_view v, size_...
method nssv_constexpr (line 722) | nssv_constexpr size_type find_first_of( CharT c, size_type pos = 0...
method nssv_constexpr (line 727) | nssv_constexpr size_type find_first_of( CharT const * s, size_type...
method nssv_constexpr (line 732) | nssv_constexpr size_type find_first_of( CharT const * s, size_typ...
method nssv_constexpr (line 739) | nssv_constexpr size_type find_last_of( basic_string_view v, size_t...
method nssv_constexpr (line 748) | nssv_constexpr size_type find_last_of( CharT c, size_type pos = np...
method nssv_constexpr (line 753) | nssv_constexpr size_type find_last_of( CharT const * s, size_type ...
method nssv_constexpr (line 758) | nssv_constexpr size_type find_last_of( CharT const * s, size_type ...
method nssv_constexpr (line 765) | nssv_constexpr size_type find_first_not_of( basic_string_view v, s...
method nssv_constexpr (line 772) | nssv_constexpr size_type find_first_not_of( CharT c, size_type pos...
method nssv_constexpr (line 777) | nssv_constexpr size_type find_first_not_of( CharT const * s, size_...
method nssv_constexpr (line 782) | nssv_constexpr size_type find_first_not_of( CharT const * s, size_...
method nssv_constexpr (line 789) | nssv_constexpr size_type find_last_not_of( basic_string_view v, si...
method nssv_constexpr (line 798) | nssv_constexpr size_type find_last_not_of( CharT c, size_type pos ...
method nssv_constexpr (line 803) | nssv_constexpr size_type find_last_not_of( CharT const * s, size_t...
method nssv_constexpr (line 808) | nssv_constexpr size_type find_last_not_of( CharT const * s, size_t...
type size_type (line 818) | enum : size_type { npos = size_type(-1) }
type not_in_view (line 824) | struct not_in_view
method nssv_constexpr (line 828) | nssv_constexpr not_in_view( basic_string_view v ) : v( v ) {}
method nssv_constexpr (line 830) | nssv_constexpr bool operator()( CharT c ) const
method nssv_constexpr (line 836) | nssv_constexpr size_type to_pos( const_iterator it ) const
method nssv_constexpr (line 841) | nssv_constexpr size_type to_pos( const_reverse_iterator it ) const
method data_at (line 846) | data_at( size_type pos ) const
method basic_string_view (line 863) | basic_string_view( std::basic_string<CharT, Traits, Allocator> con...
method to_string (line 881) | std::basic_string<CharT, Traits, Allocator>
method to_string (line 889) | std::basic_string<CharT, Traits>
method to_string (line 896) | std::basic_string<CharT, Traits, Allocator>
class basic_string_view (line 421) | class basic_string_view
method nssv_constexpr (line 450) | nssv_constexpr basic_string_view( basic_string_view const & other ...
method begin (line 483) | begin() const nssv_noexcept { return data_; }
method end (line 484) | end() const nssv_noexcept { return data_ + size_; }
method cbegin (line 486) | cbegin() const nssv_noexcept { return begin(); }
method cend (line 487) | cend() const nssv_noexcept { return end(); }
method rbegin (line 489) | rbegin() const nssv_noexcept { return const_reverse_iterator( end...
method rend (line 490) | rend() const nssv_noexcept { return const_reverse_iterator( beg...
method crbegin (line 492) | crbegin() const nssv_noexcept { return rbegin(); }
method crend (line 493) | crend() const nssv_noexcept { return rend(); }
method nssv_constexpr (line 497) | nssv_constexpr size_type size() const nssv_noexcept { return s...
method nssv_constexpr (line 498) | nssv_constexpr size_type length() const nssv_noexcept { return s...
method nssv_constexpr (line 499) | nssv_constexpr size_type max_size() const nssv_noexcept { return (...
method empty (line 502) | bool empty() const nssv_noexcept
method at (line 514) | at( size_type pos ) const
method front (line 527) | front() const { return data_at( 0 ); }
method back (line 528) | back() const { return data_at( size() - 1 ); }
method data (line 530) | data() const nssv_noexcept { return data_; }
method nssv_constexpr14 (line 534) | nssv_constexpr14 void remove_prefix( size_type n )
method nssv_constexpr14 (line 541) | nssv_constexpr14 void remove_suffix( size_type n )
method nssv_constexpr14 (line 547) | nssv_constexpr14 void swap( basic_string_view & other ) nssv_noexcept
method size_type (line 556) | size_type copy( CharT * dest, size_type n, size_type pos = 0 ) const
method substr (line 573) | substr( size_type pos = 0, size_type n = npos ) const
method nssv_constexpr14 (line 588) | nssv_constexpr14 int compare( basic_string_view other ) const nssv...
method nssv_constexpr (line 596) | nssv_constexpr int compare( size_type pos1, size_type n1, basic_st...
method nssv_constexpr (line 601) | nssv_constexpr int compare( size_type pos1, size_type n1, basic_st...
method nssv_constexpr (line 606) | nssv_constexpr int compare( CharT const * s ) const // (4)
method nssv_constexpr (line 611) | nssv_constexpr int compare( size_type pos1, size_type n1, CharT co...
method nssv_constexpr (line 616) | nssv_constexpr int compare( size_type pos1, size_type n1, CharT co...
method nssv_constexpr (line 625) | nssv_constexpr bool starts_with( basic_string_view v ) const nssv_...
method nssv_constexpr (line 630) | nssv_constexpr bool starts_with( CharT c ) const nssv_noexcept //...
method nssv_constexpr (line 635) | nssv_constexpr bool starts_with( CharT const * s ) const // (3)
method nssv_constexpr (line 642) | nssv_constexpr bool ends_with( basic_string_view v ) const nssv_no...
method nssv_constexpr (line 647) | nssv_constexpr bool ends_with( CharT c ) const nssv_noexcept // (2)
method nssv_constexpr (line 652) | nssv_constexpr bool ends_with( CharT const * s ) const // (3)
method nssv_constexpr14 (line 659) | nssv_constexpr14 size_type find( basic_string_view v, size_type po...
method nssv_constexpr14 (line 667) | nssv_constexpr14 size_type find( CharT c, size_type pos = 0 ) cons...
method nssv_constexpr14 (line 672) | nssv_constexpr14 size_type find( CharT const * s, size_type pos, s...
method nssv_constexpr14 (line 677) | nssv_constexpr14 size_type find( CharT const * s, size_type pos = ...
method nssv_constexpr14 (line 684) | nssv_constexpr14 size_type rfind( basic_string_view v, size_type p...
method nssv_constexpr14 (line 698) | nssv_constexpr14 size_type rfind( CharT c, size_type pos = npos ) ...
method nssv_constexpr14 (line 703) | nssv_constexpr14 size_type rfind( CharT const * s, size_type pos, ...
method nssv_constexpr14 (line 708) | nssv_constexpr14 size_type rfind( CharT const * s, size_type pos =...
method nssv_constexpr (line 715) | nssv_constexpr size_type find_first_of( basic_string_view v, size_...
method nssv_constexpr (line 722) | nssv_constexpr size_type find_first_of( CharT c, size_type pos = 0...
method nssv_constexpr (line 727) | nssv_constexpr size_type find_first_of( CharT const * s, size_type...
method nssv_constexpr (line 732) | nssv_constexpr size_type find_first_of( CharT const * s, size_typ...
method nssv_constexpr (line 739) | nssv_constexpr size_type find_last_of( basic_string_view v, size_t...
method nssv_constexpr (line 748) | nssv_constexpr size_type find_last_of( CharT c, size_type pos = np...
method nssv_constexpr (line 753) | nssv_constexpr size_type find_last_of( CharT const * s, size_type ...
method nssv_constexpr (line 758) | nssv_constexpr size_type find_last_of( CharT const * s, size_type ...
method nssv_constexpr (line 765) | nssv_constexpr size_type find_first_not_of( basic_string_view v, s...
method nssv_constexpr (line 772) | nssv_constexpr size_type find_first_not_of( CharT c, size_type pos...
method nssv_constexpr (line 777) | nssv_constexpr size_type find_first_not_of( CharT const * s, size_...
method nssv_constexpr (line 782) | nssv_constexpr size_type find_first_not_of( CharT const * s, size_...
method nssv_constexpr (line 789) | nssv_constexpr size_type find_last_not_of( basic_string_view v, si...
method nssv_constexpr (line 798) | nssv_constexpr size_type find_last_not_of( CharT c, size_type pos ...
method nssv_constexpr (line 803) | nssv_constexpr size_type find_last_not_of( CharT const * s, size_t...
method nssv_constexpr (line 808) | nssv_constexpr size_type find_last_not_of( CharT const * s, size_t...
type size_type (line 818) | enum : size_type { npos = size_type(-1) }
type not_in_view (line 824) | struct not_in_view
method nssv_constexpr (line 828) | nssv_constexpr not_in_view( basic_string_view v ) : v( v ) {}
method nssv_constexpr (line 830) | nssv_constexpr bool operator()( CharT c ) const
method nssv_constexpr (line 836) | nssv_constexpr size_type to_pos( const_iterator it ) const
method nssv_constexpr (line 841) | nssv_constexpr size_type to_pos( const_reverse_iterator it ) const
method data_at (line 846) | data_at( size_type pos ) const
method basic_string_view (line 863) | basic_string_view( std::basic_string<CharT, Traits, Allocator> con...
method to_string (line 881) | std::basic_string<CharT, Traits, Allocator>
method to_string (line 889) | std::basic_string<CharT, Traits>
method to_string (line 896) | std::basic_string<CharT, Traits, Allocator>
function nssv_constexpr (line 915) | nssv_constexpr bool operator== (
function nssv_constexpr (line 921) | nssv_constexpr bool operator!= (
function nssv_constexpr (line 927) | nssv_constexpr bool operator< (
function nssv_constexpr (line 933) | nssv_constexpr bool operator<= (
function nssv_constexpr (line 939) | nssv_constexpr bool operator> (
function nssv_constexpr (line 945) | nssv_constexpr bool operator>= (
class Traits (line 967) | class Traits
function nssv_constexpr (line 968) | nssv_constexpr bool operator==(
class Traits (line 973) | class Traits
function nssv_constexpr (line 974) | nssv_constexpr bool operator==(
class Traits (line 981) | class Traits
function nssv_constexpr (line 982) | nssv_constexpr bool operator!= (
class Traits (line 987) | class Traits
function nssv_constexpr (line 988) | nssv_constexpr bool operator!= (
class Traits (line 995) | class Traits
function nssv_constexpr (line 996) | nssv_constexpr bool operator< (
class Traits (line 1001) | class Traits
function nssv_constexpr (line 1002) | nssv_constexpr bool operator< (
class Traits (line 1009) | class Traits
function nssv_constexpr (line 1010) | nssv_constexpr bool operator<= (
class Traits (line 1015) | class Traits
function nssv_constexpr (line 1016) | nssv_constexpr bool operator<= (
class Traits (line 1023) | class Traits
function nssv_constexpr (line 1024) | nssv_constexpr bool operator> (
class Traits (line 1029) | class Traits
function nssv_constexpr (line 1030) | nssv_constexpr bool operator> (
class Traits (line 1037) | class Traits
function nssv_constexpr (line 1038) | nssv_constexpr bool operator>= (
class Traits (line 1043) | class Traits
function nssv_constexpr (line 1044) | nssv_constexpr bool operator>= (
type detail (line 1056) | namespace detail {
function write_padding (line 1059) | void write_padding( Stream & os, std::streamsize n )
function Stream (line 1066) | Stream & write_to_stream( Stream & os, View const & sv )
function to_string (line 1192) | std::basic_string<CharT, Traits, Allocator>
function to_string (line 1201) | std::basic_string<CharT, Traits>
function to_string (line 1208) | std::basic_string<CharT, Traits, Allocator>
function to_string_view (line 1217) | basic_string_view<CharT, Traits>
type nonstd (line 403) | namespace nonstd { namespace sv_lite {
function to_string (line 118) | std::basic_string<CharT, Traits, Allocator>
function to_string_view (line 125) | std::basic_string_view<CharT, Traits>
type literals (line 141) | inline namespace literals {
type string_view_literals (line 142) | inline namespace string_view_literals {
type sv_lite (line 403) | namespace sv_lite {
class basic_string_view (line 410) | class basic_string_view
method nssv_constexpr (line 450) | nssv_constexpr basic_string_view( basic_string_view const & other ...
method begin (line 483) | begin() const nssv_noexcept { return data_; }
method end (line 484) | end() const nssv_noexcept { return data_ + size_; }
method cbegin (line 486) | cbegin() const nssv_noexcept { return begin(); }
method cend (line 487) | cend() const nssv_noexcept { return end(); }
method rbegin (line 489) | rbegin() const nssv_noexcept { return const_reverse_iterator( end...
method rend (line 490) | rend() const nssv_noexcept { return const_reverse_iterator( beg...
method crbegin (line 492) | crbegin() const nssv_noexcept { return rbegin(); }
method crend (line 493) | crend() const nssv_noexcept { return rend(); }
method nssv_constexpr (line 497) | nssv_constexpr size_type size() const nssv_noexcept { return s...
method nssv_constexpr (line 498) | nssv_constexpr size_type length() const nssv_noexcept { return s...
method nssv_constexpr (line 499) | nssv_constexpr size_type max_size() const nssv_noexcept { return (...
method empty (line 502) | bool empty() const nssv_noexcept
method at (line 514) | at( size_type pos ) const
method front (line 527) | front() const { return data_at( 0 ); }
method back (line 528) | back() const { return data_at( size() - 1 ); }
method data (line 530) | data() const nssv_noexcept { return data_; }
method nssv_constexpr14 (line 534) | nssv_constexpr14 void remove_prefix( size_type n )
method nssv_constexpr14 (line 541) | nssv_constexpr14 void remove_suffix( size_type n )
method nssv_constexpr14 (line 547) | nssv_constexpr14 void swap( basic_string_view & other ) nssv_noexcept
method size_type (line 556) | size_type copy( CharT * dest, size_type n, size_type pos = 0 ) const
method substr (line 573) | substr( size_type pos = 0, size_type n = npos ) const
method nssv_constexpr14 (line 588) | nssv_constexpr14 int compare( basic_string_view other ) const nssv...
method nssv_constexpr (line 596) | nssv_constexpr int compare( size_type pos1, size_type n1, basic_st...
method nssv_constexpr (line 601) | nssv_constexpr int compare( size_type pos1, size_type n1, basic_st...
method nssv_constexpr (line 606) | nssv_constexpr int compare( CharT const * s ) const // (4)
method nssv_constexpr (line 611) | nssv_constexpr int compare( size_type pos1, size_type n1, CharT co...
method nssv_constexpr (line 616) | nssv_constexpr int compare( size_type pos1, size_type n1, CharT co...
method nssv_constexpr (line 625) | nssv_constexpr bool starts_with( basic_string_view v ) const nssv_...
method nssv_constexpr (line 630) | nssv_constexpr bool starts_with( CharT c ) const nssv_noexcept //...
method nssv_constexpr (line 635) | nssv_constexpr bool starts_with( CharT const * s ) const // (3)
method nssv_constexpr (line 642) | nssv_constexpr bool ends_with( basic_string_view v ) const nssv_no...
method nssv_constexpr (line 647) | nssv_constexpr bool ends_with( CharT c ) const nssv_noexcept // (2)
method nssv_constexpr (line 652) | nssv_constexpr bool ends_with( CharT const * s ) const // (3)
method nssv_constexpr14 (line 659) | nssv_constexpr14 size_type find( basic_string_view v, size_type po...
method nssv_constexpr14 (line 667) | nssv_constexpr14 size_type find( CharT c, size_type pos = 0 ) cons...
method nssv_constexpr14 (line 672) | nssv_constexpr14 size_type find( CharT const * s, size_type pos, s...
method nssv_constexpr14 (line 677) | nssv_constexpr14 size_type find( CharT const * s, size_type pos = ...
method nssv_constexpr14 (line 684) | nssv_constexpr14 size_type rfind( basic_string_view v, size_type p...
method nssv_constexpr14 (line 698) | nssv_constexpr14 size_type rfind( CharT c, size_type pos = npos ) ...
method nssv_constexpr14 (line 703) | nssv_constexpr14 size_type rfind( CharT const * s, size_type pos, ...
method nssv_constexpr14 (line 708) | nssv_constexpr14 size_type rfind( CharT const * s, size_type pos =...
method nssv_constexpr (line 715) | nssv_constexpr size_type find_first_of( basic_string_view v, size_...
method nssv_constexpr (line 722) | nssv_constexpr size_type find_first_of( CharT c, size_type pos = 0...
method nssv_constexpr (line 727) | nssv_constexpr size_type find_first_of( CharT const * s, size_type...
method nssv_constexpr (line 732) | nssv_constexpr size_type find_first_of( CharT const * s, size_typ...
method nssv_constexpr (line 739) | nssv_constexpr size_type find_last_of( basic_string_view v, size_t...
method nssv_constexpr (line 748) | nssv_constexpr size_type find_last_of( CharT c, size_type pos = np...
method nssv_constexpr (line 753) | nssv_constexpr size_type find_last_of( CharT const * s, size_type ...
method nssv_constexpr (line 758) | nssv_constexpr size_type find_last_of( CharT const * s, size_type ...
method nssv_constexpr (line 765) | nssv_constexpr size_type find_first_not_of( basic_string_view v, s...
method nssv_constexpr (line 772) | nssv_constexpr size_type find_first_not_of( CharT c, size_type pos...
method nssv_constexpr (line 777) | nssv_constexpr size_type find_first_not_of( CharT const * s, size_...
method nssv_constexpr (line 782) | nssv_constexpr size_type find_first_not_of( CharT const * s, size_...
method nssv_constexpr (line 789) | nssv_constexpr size_type find_last_not_of( basic_string_view v, si...
method nssv_constexpr (line 798) | nssv_constexpr size_type find_last_not_of( CharT c, size_type pos ...
method nssv_constexpr (line 803) | nssv_constexpr size_type find_last_not_of( CharT const * s, size_t...
method nssv_constexpr (line 808) | nssv_constexpr size_type find_last_not_of( CharT const * s, size_t...
type size_type (line 818) | enum : size_type { npos = size_type(-1) }
type not_in_view (line 824) | struct not_in_view
method nssv_constexpr (line 828) | nssv_constexpr not_in_view( basic_string_view v ) : v( v ) {}
method nssv_constexpr (line 830) | nssv_constexpr bool operator()( CharT c ) const
method nssv_constexpr (line 836) | nssv_constexpr size_type to_pos( const_iterator it ) const
method nssv_constexpr (line 841) | nssv_constexpr size_type to_pos( const_reverse_iterator it ) const
method data_at (line 846) | data_at( size_type pos ) const
method basic_string_view (line 863) | basic_string_view( std::basic_string<CharT, Traits, Allocator> con...
method to_string (line 881) | std::basic_string<CharT, Traits, Allocator>
method to_string (line 889) | std::basic_string<CharT, Traits>
method to_string (line 896) | std::basic_string<CharT, Traits, Allocator>
class basic_string_view (line 421) | class basic_string_view
method nssv_constexpr (line 450) | nssv_constexpr basic_string_view( basic_string_view const & other ...
method begin (line 483) | begin() const nssv_noexcept { return data_; }
method end (line 484) | end() const nssv_noexcept { return data_ + size_; }
method cbegin (line 486) | cbegin() const nssv_noexcept { return begin(); }
method cend (line 487) | cend() const nssv_noexcept { return end(); }
method rbegin (line 489) | rbegin() const nssv_noexcept { return const_reverse_iterator( end...
method rend (line 490) | rend() const nssv_noexcept { return const_reverse_iterator( beg...
method crbegin (line 492) | crbegin() const nssv_noexcept { return rbegin(); }
method crend (line 493) | crend() const nssv_noexcept { return rend(); }
method nssv_constexpr (line 497) | nssv_constexpr size_type size() const nssv_noexcept { return s...
method nssv_constexpr (line 498) | nssv_constexpr size_type length() const nssv_noexcept { return s...
method nssv_constexpr (line 499) | nssv_constexpr size_type max_size() const nssv_noexcept { return (...
method empty (line 502) | bool empty() const nssv_noexcept
method at (line 514) | at( size_type pos ) const
method front (line 527) | front() const { return data_at( 0 ); }
method back (line 528) | back() const { return data_at( size() - 1 ); }
method data (line 530) | data() const nssv_noexcept { return data_; }
method nssv_constexpr14 (line 534) | nssv_constexpr14 void remove_prefix( size_type n )
method nssv_constexpr14 (line 541) | nssv_constexpr14 void remove_suffix( size_type n )
method nssv_constexpr14 (line 547) | nssv_constexpr14 void swap( basic_string_view & other ) nssv_noexcept
method size_type (line 556) | size_type copy( CharT * dest, size_type n, size_type pos = 0 ) const
method substr (line 573) | substr( size_type pos = 0, size_type n = npos ) const
method nssv_constexpr14 (line 588) | nssv_constexpr14 int compare( basic_string_view other ) const nssv...
method nssv_constexpr (line 596) | nssv_constexpr int compare( size_type pos1, size_type n1, basic_st...
method nssv_constexpr (line 601) | nssv_constexpr int compare( size_type pos1, size_type n1, basic_st...
method nssv_constexpr (line 606) | nssv_constexpr int compare( CharT const * s ) const // (4)
method nssv_constexpr (line 611) | nssv_constexpr int compare( size_type pos1, size_type n1, CharT co...
method nssv_constexpr (line 616) | nssv_constexpr int compare( size_type pos1, size_type n1, CharT co...
method nssv_constexpr (line 625) | nssv_constexpr bool starts_with( basic_string_view v ) const nssv_...
method nssv_constexpr (line 630) | nssv_constexpr bool starts_with( CharT c ) const nssv_noexcept //...
method nssv_constexpr (line 635) | nssv_constexpr bool starts_with( CharT const * s ) const // (3)
method nssv_constexpr (line 642) | nssv_constexpr bool ends_with( basic_string_view v ) const nssv_no...
method nssv_constexpr (line 647) | nssv_constexpr bool ends_with( CharT c ) const nssv_noexcept // (2)
method nssv_constexpr (line 652) | nssv_constexpr bool ends_with( CharT const * s ) const // (3)
method nssv_constexpr14 (line 659) | nssv_constexpr14 size_type find( basic_string_view v, size_type po...
method nssv_constexpr14 (line 667) | nssv_constexpr14 size_type find( CharT c, size_type pos = 0 ) cons...
method nssv_constexpr14 (line 672) | nssv_constexpr14 size_type find( CharT const * s, size_type pos, s...
method nssv_constexpr14 (line 677) | nssv_constexpr14 size_type find( CharT const * s, size_type pos = ...
method nssv_constexpr14 (line 684) | nssv_constexpr14 size_type rfind( basic_string_view v, size_type p...
method nssv_constexpr14 (line 698) | nssv_constexpr14 size_type rfind( CharT c, size_type pos = npos ) ...
method nssv_constexpr14 (line 703) | nssv_constexpr14 size_type rfind( CharT const * s, size_type pos, ...
method nssv_constexpr14 (line 708) | nssv_constexpr14 size_type rfind( CharT const * s, size_type pos =...
method nssv_constexpr (line 715) | nssv_constexpr size_type find_first_of( basic_string_view v, size_...
method nssv_constexpr (line 722) | nssv_constexpr size_type find_first_of( CharT c, size_type pos = 0...
method nssv_constexpr (line 727) | nssv_constexpr size_type find_first_of( CharT const * s, size_type...
method nssv_constexpr (line 732) | nssv_constexpr size_type find_first_of( CharT const * s, size_typ...
method nssv_constexpr (line 739) | nssv_constexpr size_type find_last_of( basic_string_view v, size_t...
method nssv_constexpr (line 748) | nssv_constexpr size_type find_last_of( CharT c, size_type pos = np...
method nssv_constexpr (line 753) | nssv_constexpr size_type find_last_of( CharT const * s, size_type ...
method nssv_constexpr (line 758) | nssv_constexpr size_type find_last_of( CharT const * s, size_type ...
method nssv_constexpr (line 765) | nssv_constexpr size_type find_first_not_of( basic_string_view v, s...
method nssv_constexpr (line 772) | nssv_constexpr size_type find_first_not_of( CharT c, size_type pos...
method nssv_constexpr (line 777) | nssv_constexpr size_type find_first_not_of( CharT const * s, size_...
method nssv_constexpr (line 782) | nssv_constexpr size_type find_first_not_of( CharT const * s, size_...
method nssv_constexpr (line 789) | nssv_constexpr size_type find_last_not_of( basic_string_view v, si...
method nssv_constexpr (line 798) | nssv_constexpr size_type find_last_not_of( CharT c, size_type pos ...
method nssv_constexpr (line 803) | nssv_constexpr size_type find_last_not_of( CharT const * s, size_t...
method nssv_constexpr (line 808) | nssv_constexpr size_type find_last_not_of( CharT const * s, size_t...
type size_type (line 818) | enum : size_type { npos = size_type(-1) }
type not_in_view (line 824) | struct not_in_view
method nssv_constexpr (line 828) | nssv_constexpr not_in_view( basic_string_view v ) : v( v ) {}
method nssv_constexpr (line 830) | nssv_constexpr bool operator()( CharT c ) const
method nssv_constexpr (line 836) | nssv_constexpr size_type to_pos( const_iterator it ) const
method nssv_constexpr (line 841) | nssv_constexpr size_type to_pos( const_reverse_iterator it ) const
method data_at (line 846) | data_at( size_type pos ) const
method basic_string_view (line 863) | basic_string_view( std::basic_string<CharT, Traits, Allocator> con...
method to_string (line 881) | std::basic_string<CharT, Traits, Allocator>
method to_string (line 889) | std::basic_string<CharT, Traits>
method to_string (line 896) | std::basic_string<CharT, Traits, Allocator>
function nssv_constexpr (line 915) | nssv_constexpr bool operator== (
function nssv_constexpr (line 921) | nssv_constexpr bool operator!= (
function nssv_constexpr (line 927) | nssv_constexpr bool operator< (
function nssv_constexpr (line 933) | nssv_constexpr bool operator<= (
function nssv_constexpr (line 939) | nssv_constexpr bool operator> (
function nssv_constexpr (line 945) | nssv_constexpr bool operator>= (
class Traits (line 967) | class Traits
function nssv_constexpr (line 968) | nssv_constexpr bool operator==(
class Traits (line 973) | class Traits
function nssv_constexpr (line 974) | nssv_constexpr bool operator==(
class Traits (line 981) | class Traits
function nssv_constexpr (line 982) | nssv_constexpr bool operator!= (
class Traits (line 987) | class Traits
function nssv_constexpr (line 988) | nssv_constexpr bool operator!= (
class Traits (line 995) | class Traits
function nssv_constexpr (line 996) | nssv_constexpr bool operator< (
class Traits (line 1001) | class Traits
function nssv_constexpr (line 1002) | nssv_constexpr bool operator< (
class Traits (line 1009) | class Traits
function nssv_constexpr (line 1010) | nssv_constexpr bool operator<= (
class Traits (line 1015) | class Traits
function nssv_constexpr (line 1016) | nssv_constexpr bool operator<= (
class Traits (line 1023) | class Traits
function nssv_constexpr (line 1024) | nssv_constexpr bool operator> (
class Traits (line 1029) | class Traits
function nssv_constexpr (line 1030) | nssv_constexpr bool operator> (
class Traits (line 1037) | class Traits
function nssv_constexpr (line 1038) | nssv_constexpr bool operator>= (
class Traits (line 1043) | class Traits
function nssv_constexpr (line 1044) | nssv_constexpr bool operator>= (
type detail (line 1056) | namespace detail {
function write_padding (line 1059) | void write_padding( Stream & os, std::streamsize n )
function Stream (line 1066) | Stream & write_to_stream( Stream & os, View const & sv )
function to_string (line 1192) | std::basic_string<CharT, Traits, Allocator>
function to_string (line 1201) | std::basic_string<CharT, Traits>
function to_string (line 1208) | std::basic_string<CharT, Traits, Allocator>
function to_string_view (line 1217) | basic_string_view<CharT, Traits>
function nssv_inline_ns (line 1123) | nssv_inline_ns namespace literals {
type sv_lite (line 1185) | namespace sv_lite {
class basic_string_view (line 410) | class basic_string_view
method nssv_constexpr (line 450) | nssv_constexpr basic_string_view( basic_string_view const & other ...
method begin (line 483) | begin() const nssv_noexcept { return data_; }
method end (line 484) | end() const nssv_noexcept { return data_ + size_; }
method cbegin (line 486) | cbegin() const nssv_noexcept { return begin(); }
method cend (line 487) | cend() const nssv_noexcept { return end(); }
method rbegin (line 489) | rbegin() const nssv_noexcept { return const_reverse_iterator( end...
method rend (line 490) | rend() const nssv_noexcept { return const_reverse_iterator( beg...
method crbegin (line 492) | crbegin() const nssv_noexcept { return rbegin(); }
method crend (line 493) | crend() const nssv_noexcept { return rend(); }
method nssv_constexpr (line 497) | nssv_constexpr size_type size() const nssv_noexcept { return s...
method nssv_constexpr (line 498) | nssv_constexpr size_type length() const nssv_noexcept { return s...
method nssv_constexpr (line 499) | nssv_constexpr size_type max_size() const nssv_noexcept { return (...
method empty (line 502) | bool empty() const nssv_noexcept
method at (line 514) | at( size_type pos ) const
method front (line 527) | front() const { return data_at( 0 ); }
method back (line 528) | back() const { return data_at( size() - 1 ); }
method data (line 530) | data() const nssv_noexcept { return data_; }
method nssv_constexpr14 (line 534) | nssv_constexpr14 void remove_prefix( size_type n )
method nssv_constexpr14 (line 541) | nssv_constexpr14 void remove_suffix( size_type n )
method nssv_constexpr14 (line 547) | nssv_constexpr14 void swap( basic_string_view & other ) nssv_noexcept
method size_type (line 556) | size_type copy( CharT * dest, size_type n, size_type pos = 0 ) const
method substr (line 573) | substr( size_type pos = 0, size_type n = npos ) const
method nssv_constexpr14 (line 588) | nssv_constexpr14 int compare( basic_string_view other ) const nssv...
method nssv_constexpr (line 596) | nssv_constexpr int compare( size_type pos1, size_type n1, basic_st...
method nssv_constexpr (line 601) | nssv_constexpr int compare( size_type pos1, size_type n1, basic_st...
method nssv_constexpr (line 606) | nssv_constexpr int compare( CharT const * s ) const // (4)
method nssv_constexpr (line 611) | nssv_constexpr int compare( size_type pos1, size_type n1, CharT co...
method nssv_constexpr (line 616) | nssv_constexpr int compare( size_type pos1, size_type n1, CharT co...
method nssv_constexpr (line 625) | nssv_constexpr bool starts_with( basic_string_view v ) const nssv_...
method nssv_constexpr (line 630) | nssv_constexpr bool starts_with( CharT c ) const nssv_noexcept //...
method nssv_constexpr (line 635) | nssv_constexpr bool starts_with( CharT const * s ) const // (3)
method nssv_constexpr (line 642) | nssv_constexpr bool ends_with( basic_string_view v ) const nssv_no...
method nssv_constexpr (line 647) | nssv_constexpr bool ends_with( CharT c ) const nssv_noexcept // (2)
method nssv_constexpr (line 652) | nssv_constexpr bool ends_with( CharT const * s ) const // (3)
method nssv_constexpr14 (line 659) | nssv_constexpr14 size_type find( basic_string_view v, size_type po...
method nssv_constexpr14 (line 667) | nssv_constexpr14 size_type find( CharT c, size_type pos = 0 ) cons...
method nssv_constexpr14 (line 672) | nssv_constexpr14 size_type find( CharT const * s, size_type pos, s...
method nssv_constexpr14 (line 677) | nssv_constexpr14 size_type find( CharT const * s, size_type pos = ...
method nssv_constexpr14 (line 684) | nssv_constexpr14 size_type rfind( basic_string_view v, size_type p...
method nssv_constexpr14 (line 698) | nssv_constexpr14 size_type rfind( CharT c, size_type pos = npos ) ...
method nssv_constexpr14 (line 703) | nssv_constexpr14 size_type rfind( CharT const * s, size_type pos, ...
method nssv_constexpr14 (line 708) | nssv_constexpr14 size_type rfind( CharT const * s, size_type pos =...
method nssv_constexpr (line 715) | nssv_constexpr size_type find_first_of( basic_string_view v, size_...
method nssv_constexpr (line 722) | nssv_constexpr size_type find_first_of( CharT c, size_type pos = 0...
method nssv_constexpr (line 727) | nssv_constexpr size_type find_first_of( CharT const * s, size_type...
method nssv_constexpr (line 732) | nssv_constexpr size_type find_first_of( CharT const * s, size_typ...
method nssv_constexpr (line 739) | nssv_constexpr size_type find_last_of( basic_string_view v, size_t...
method nssv_constexpr (line 748) | nssv_constexpr size_type find_last_of( CharT c, size_type pos = np...
method nssv_constexpr (line 753) | nssv_constexpr size_type find_last_of( CharT const * s, size_type ...
method nssv_constexpr (line 758) | nssv_constexpr size_type find_last_of( CharT const * s, size_type ...
method nssv_constexpr (line 765) | nssv_constexpr size_type find_first_not_of( basic_string_view v, s...
method nssv_constexpr (line 772) | nssv_constexpr size_type find_first_not_of( CharT c, size_type pos...
method nssv_constexpr (line 777) | nssv_constexpr size_type find_first_not_of( CharT const * s, size_...
method nssv_constexpr (line 782) | nssv_constexpr size_type find_first_not_of( CharT const * s, size_...
method nssv_constexpr (line 789) | nssv_constexpr size_type find_last_not_of( basic_string_view v, si...
method nssv_constexpr (line 798) | nssv_constexpr size_type find_last_not_of( CharT c, size_type pos ...
method nssv_constexpr (line 803) | nssv_constexpr size_type find_last_not_of( CharT const * s, size_t...
method nssv_constexpr (line 808) | nssv_constexpr size_type find_last_not_of( CharT const * s, size_t...
type size_type (line 818) | enum : size_type { npos = size_type(-1) }
type not_in_view (line 824) | struct not_in_view
method nssv_constexpr (line 828) | nssv_constexpr not_in_view( basic_string_view v ) : v( v ) {}
method nssv_constexpr (line 830) | nssv_constexpr bool operator()( CharT c ) const
method nssv_constexpr (line 836) | nssv_constexpr size_type to_pos( const_iterator it ) const
method nssv_constexpr (line 841) | nssv_constexpr size_type to_pos( const_reverse_iterator it ) const
method data_at (line 846) | data_at( size_type pos ) const
method basic_string_view (line 863) | basic_string_view( std::basic_string<CharT, Traits, Allocator> con...
method to_string (line 881) | std::basic_string<CharT, Traits, Allocator>
method to_string (line 889) | std::basic_string<CharT, Traits>
method to_string (line 896) | std::basic_string<CharT, Traits, Allocator>
class basic_string_view (line 421) | class basic_string_view
method nssv_constexpr (line 450) | nssv_constexpr basic_string_view( basic_string_view const & other ...
method begin (line 483) | begin() const nssv_noexcept { return data_; }
method end (line 484) | end() const nssv_noexcept { return data_ + size_; }
method cbegin (line 486) | cbegin() const nssv_noexcept { return begin(); }
method cend (line 487) | cend() const nssv_noexcept { return end(); }
method rbegin (line 489) | rbegin() const nssv_noexcept { return const_reverse_iterator( end...
method rend (line 490) | rend() const nssv_noexcept { return const_reverse_iterator( beg...
method crbegin (line 492) | crbegin() const nssv_noexcept { return rbegin(); }
method crend (line 493) | crend() const nssv_noexcept { return rend(); }
method nssv_constexpr (line 497) | nssv_constexpr size_type size() const nssv_noexcept { return s...
method nssv_constexpr (line 498) | nssv_constexpr size_type length() const nssv_noexcept { return s...
method nssv_constexpr (line 499) | nssv_constexpr size_type max_size() const nssv_noexcept { return (...
method empty (line 502) | bool empty() const nssv_noexcept
method at (line 514) | at( size_type pos ) const
method front (line 527) | front() const { return data_at( 0 ); }
method back (line 528) | back() const { return data_at( size() - 1 ); }
method data (line 530) | data() const nssv_noexcept { return data_; }
method nssv_constexpr14 (line 534) | nssv_constexpr14 void remove_prefix( size_type n )
method nssv_constexpr14 (line 541) | nssv_constexpr14 void remove_suffix( size_type n )
method nssv_constexpr14 (line 547) | nssv_constexpr14 void swap( basic_string_view & other ) nssv_noexcept
method size_type (line 556) | size_type copy( CharT * dest, size_type n, size_type pos = 0 ) const
method substr (line 573) | substr( size_type pos = 0, size_type n = npos ) const
method nssv_constexpr14 (line 588) | nssv_constexpr14 int compare( basic_string_view other ) const nssv...
method nssv_constexpr (line 596) | nssv_constexpr int compare( size_type pos1, size_type n1, basic_st...
method nssv_constexpr (line 601) | nssv_constexpr int compare( size_type pos1, size_type n1, basic_st...
method nssv_constexpr (line 606) | nssv_constexpr int compare( CharT const * s ) const // (4)
method nssv_constexpr (line 611) | nssv_constexpr int compare( size_type pos1, size_type n1, CharT co...
method nssv_constexpr (line 616) | nssv_constexpr int compare( size_type pos1, size_type n1, CharT co...
method nssv_constexpr (line 625) | nssv_constexpr bool starts_with( basic_string_view v ) const nssv_...
method nssv_constexpr (line 630) | nssv_constexpr bool starts_with( CharT c ) const nssv_noexcept //...
method nssv_constexpr (line 635) | nssv_constexpr bool starts_with( CharT const * s ) const // (3)
method nssv_constexpr (line 642) | nssv_constexpr bool ends_with( basic_string_view v ) const nssv_no...
method nssv_constexpr (line 647) | nssv_constexpr bool ends_with( CharT c ) const nssv_noexcept // (2)
method nssv_constexpr (line 652) | nssv_constexpr bool ends_with( CharT const * s ) const // (3)
method nssv_constexpr14 (line 659) | nssv_constexpr14 size_type find( basic_string_view v, size_type po...
method nssv_constexpr14 (line 667) | nssv_constexpr14 size_type find( CharT c, size_type pos = 0 ) cons...
method nssv_constexpr14 (line 672) | nssv_constexpr14 size_type find( CharT const * s, size_type pos, s...
method nssv_constexpr14 (line 677) | nssv_constexpr14 size_type find( CharT const * s, size_type pos = ...
method nssv_constexpr14 (line 684) | nssv_constexpr14 size_type rfind( basic_string_view v, size_type p...
method nssv_constexpr14 (line 698) | nssv_constexpr14 size_type rfind( CharT c, size_type pos = npos ) ...
method nssv_constexpr14 (line 703) | nssv_constexpr14 size_type rfind( CharT const * s, size_type pos, ...
method nssv_constexpr14 (line 708) | nssv_constexpr14 size_type rfind( CharT const * s, size_type pos =...
method nssv_constexpr (line 715) | nssv_constexpr size_type find_first_of( basic_string_view v, size_...
method nssv_constexpr (line 722) | nssv_constexpr size_type find_first_of( CharT c, size_type pos = 0...
method nssv_constexpr (line 727) | nssv_constexpr size_type find_first_of( CharT const * s, size_type...
method nssv_constexpr (line 732) | nssv_constexpr size_type find_first_of( CharT const * s, size_typ...
method nssv_constexpr (line 739) | nssv_constexpr size_type find_last_of( basic_string_view v, size_t...
method nssv_constexpr (line 748) | nssv_constexpr size_type find_last_of( CharT c, size_type pos = np...
method nssv_constexpr (line 753) | nssv_constexpr size_type find_last_of( CharT const * s, size_type ...
method nssv_constexpr (line 758) | nssv_constexpr size_type find_last_of( CharT const * s, size_type ...
method nssv_constexpr (line 765) | nssv_constexpr size_type find_first_not_of( basic_string_view v, s...
method nssv_constexpr (line 772) | nssv_constexpr size_type find_first_not_of( CharT c, size_type pos...
method nssv_constexpr (line 777) | nssv_constexpr size_type find_first_not_of( CharT const * s, size_...
method nssv_constexpr (line 782) | nssv_constexpr size_type find_first_not_of( CharT const * s, size_...
method nssv_constexpr (line 789) | nssv_constexpr size_type find_last_not_of( basic_string_view v, si...
method nssv_constexpr (line 798) | nssv_constexpr size_type find_last_not_of( CharT c, size_type pos ...
method nssv_constexpr (line 803) | nssv_constexpr size_type find_last_not_of( CharT const * s, size_t...
method nssv_constexpr (line 808) | nssv_constexpr size_type find_last_not_of( CharT const * s, size_t...
type size_type (line 818) | enum : size_type { npos = size_type(-1) }
type not_in_view (line 824) | struct not_in_view
method nssv_constexpr (line 828) | nssv_constexpr not_in_view( basic_string_view v ) : v( v ) {}
method nssv_constexpr (line 830) | nssv_constexpr bool operator()( CharT c ) const
method nssv_constexpr (line 836) | nssv_constexpr size_type to_pos( const_iterator it ) const
method nssv_constexpr (line 841) | nssv_constexpr size_type to_pos( const_reverse_iterator it ) const
method data_at (line 846) | data_at( size_type pos ) const
method basic_string_view (line 863) | basic_string_view( std::basic_string<CharT, Traits, Allocator> con...
method to_string (line 881) | std::basic_string<CharT, Traits, Allocator>
method to_string (line 889) | std::basic_string<CharT, Traits>
method to_string (line 896) | std::basic_string<CharT, Traits, Allocator>
function nssv_constexpr (line 915) | nssv_constexpr bool operator== (
function nssv_constexpr (line 921) | nssv_constexpr bool operator!= (
function nssv_constexpr (line 927) | nssv_constexpr bool operator< (
function nssv_constexpr (line 933) | nssv_constexpr bool operator<= (
function nssv_constexpr (line 939) | nssv_constexpr bool operator> (
function nssv_constexpr (line 945) | nssv_constexpr bool operator>= (
class Traits (line 967) | class Traits
function nssv_constexpr (line 968) | nssv_constexpr bool operator==(
class Traits (line 973) | class Traits
function nssv_constexpr (line 974) | nssv_constexpr bool operator==(
class Traits (line 981) | class Traits
function nssv_constexpr (line 982) | nssv_constexpr bool operator!= (
class Traits (line 987) | class Traits
function nssv_constexpr (line 988) | nssv_constexpr bool operator!= (
class Traits (line 995) | class Traits
function nssv_constexpr (line 996) | nssv_constexpr bool operator< (
class Traits (line 1001) | class Traits
function nssv_constexpr (line 1002) | nssv_constexpr bool operator< (
class Traits (line 1009) | class Traits
function nssv_constexpr (line 1010) | nssv_constexpr bool operator<= (
class Traits (line 1015) | class Traits
function nssv_constexpr (line 1016) | nssv_constexpr bool operator<= (
class Traits (line 1023) | class Traits
function nssv_constexpr (line 1024) | nssv_constexpr bool operator> (
class Traits (line 1029) | class Traits
function nssv_constexpr (line 1030) | nssv_constexpr bool operator> (
class Traits (line 1037) | class Traits
function nssv_constexpr (line 1038) | nssv_constexpr bool operator>= (
class Traits (line 1043) | class Traits
function nssv_constexpr (line 1044) | nssv_constexpr bool operator>= (
type detail (line 1056) | namespace detail {
function write_padding (line 1059) | void write_padding( Stream & os, std::streamsize n )
function Stream (line 1066) | Stream & write_to_stream( Stream & os, View const & sv )
function to_string (line 1192) | std::basic_string<CharT, Traits, Allocator>
function to_string (line 1201) | std::basic_string<CharT, Traits>
function to_string (line 1208) | std::basic_string<CharT, Traits, Allocator>
function to_string_view (line 1217) | basic_string_view<CharT, Traits>
type nonstd (line 1122) | namespace nonstd {
function to_string (line 118) | std::basic_string<CharT, Traits, Allocator>
function to_string_view (line 125) | std::basic_string_view<CharT, Traits>
type literals (line 141) | inline namespace literals {
type string_view_literals (line 142) | inline namespace string_view_literals {
type sv_lite (line 403) | namespace sv_lite {
class basic_string_view (line 410) | class basic_string_view
method nssv_constexpr (line 450) | nssv_constexpr basic_string_view( basic_string_view const & other ...
method begin (line 483) | begin() const nssv_noexcept { return data_; }
method end (line 484) | end() const nssv_noexcept { return data_ + size_; }
method cbegin (line 486) | cbegin() const nssv_noexcept { return begin(); }
method cend (line 487) | cend() const nssv_noexcept { return end(); }
method rbegin (line 489) | rbegin() const nssv_noexcept { return const_reverse_iterator( end...
method rend (line 490) | rend() const nssv_noexcept { return const_reverse_iterator( beg...
method crbegin (line 492) | crbegin() const nssv_noexcept { return rbegin(); }
method crend (line 493) | crend() const nssv_noexcept { return rend(); }
method nssv_constexpr (line 497) | nssv_constexpr size_type size() const nssv_noexcept { return s...
method nssv_constexpr (line 498) | nssv_constexpr size_type length() const nssv_noexcept { return s...
method nssv_constexpr (line 499) | nssv_constexpr size_type max_size() const nssv_noexcept { return (...
method empty (line 502) | bool empty() const nssv_noexcept
method at (line 514) | at( size_type pos ) const
method front (line 527) | front() const { return data_at( 0 ); }
method back (line 528) | back() const { return data_at( size() - 1 ); }
method data (line 530) | data() const nssv_noexcept { return data_; }
method nssv_constexpr14 (line 534) | nssv_constexpr14 void remove_prefix( size_type n )
method nssv_constexpr14 (line 541) | nssv_constexpr14 void remove_suffix( size_type n )
method nssv_constexpr14 (line 547) | nssv_constexpr14 void swap( basic_string_view & other ) nssv_noexcept
method size_type (line 556) | size_type copy( CharT * dest, size_type n, size_type pos = 0 ) const
method substr (line 573) | substr( size_type pos = 0, size_type n = npos ) const
method nssv_constexpr14 (line 588) | nssv_constexpr14 int compare( basic_string_view other ) const nssv...
method nssv_constexpr (line 596) | nssv_constexpr int compare( size_type pos1, size_type n1, basic_st...
method nssv_constexpr (line 601) | nssv_constexpr int compare( size_type pos1, size_type n1, basic_st...
method nssv_constexpr (line 606) | nssv_constexpr int compare( CharT const * s ) const // (4)
method nssv_constexpr (line 611) | nssv_constexpr int compare( size_type pos1, size_type n1, CharT co...
method nssv_constexpr (line 616) | nssv_constexpr int compare( size_type pos1, size_type n1, CharT co...
method nssv_constexpr (line 625) | nssv_constexpr bool starts_with( basic_string_view v ) const nssv_...
method nssv_constexpr (line 630) | nssv_constexpr bool starts_with( CharT c ) const nssv_noexcept //...
method nssv_constexpr (line 635) | nssv_constexpr bool starts_with( CharT const * s ) const // (3)
method nssv_constexpr (line 642) | nssv_constexpr bool ends_with( basic_string_view v ) const nssv_no...
method nssv_constexpr (line 647) | nssv_constexpr bool ends_with( CharT c ) const nssv_noexcept // (2)
method nssv_constexpr (line 652) | nssv_constexpr bool ends_with( CharT const * s ) const // (3)
method nssv_constexpr14 (line 659) | nssv_constexpr14 size_type find( basic_string_view v, size_type po...
method nssv_constexpr14 (line 667) | nssv_constexpr14 size_type find( CharT c, size_type pos = 0 ) cons...
method nssv_constexpr14 (line 672) | nssv_constexpr14 size_type find( CharT const * s, size_type pos, s...
method nssv_constexpr14 (line 677) | nssv_constexpr14 size_type find( CharT const * s, size_type pos = ...
method nssv_constexpr14 (line 684) | nssv_constexpr14 size_type rfind( basic_string_view v, size_type p...
method nssv_constexpr14 (line 698) | nssv_constexpr14 size_type rfind( CharT c, size_type pos = npos ) ...
method nssv_constexpr14 (line 703) | nssv_constexpr14 size_type rfind( CharT const * s, size_type pos, ...
method nssv_constexpr14 (line 708) | nssv_constexpr14 size_type rfind( CharT const * s, size_type pos =...
method nssv_constexpr (line 715) | nssv_constexpr size_type find_first_of( basic_string_view v, size_...
method nssv_constexpr (line 722) | nssv_constexpr size_type find_first_of( CharT c, size_type pos = 0...
method nssv_constexpr (line 727) | nssv_constexpr size_type find_first_of( CharT const * s, size_type...
method nssv_constexpr (line 732) | nssv_constexpr size_type find_first_of( CharT const * s, size_typ...
method nssv_constexpr (line 739) | nssv_constexpr size_type find_last_of( basic_string_view v, size_t...
method nssv_constexpr (line 748) | nssv_constexpr size_type find_last_of( CharT c, size_type pos = np...
method nssv_constexpr (line 753) | nssv_constexpr size_type find_last_of( CharT const * s, size_type ...
method nssv_constexpr (line 758) | nssv_constexpr size_type find_last_of( CharT const * s, size_type ...
method nssv_constexpr (line 765) | nssv_constexpr size_type find_first_not_of( basic_string_view v, s...
method nssv_constexpr (line 772) | nssv_constexpr size_type find_first_not_of( CharT c, size_type pos...
method nssv_constexpr (line 777) | nssv_constexpr size_type find_first_not_of( CharT const * s, size_...
method nssv_constexpr (line 782) | nssv_constexpr size_type find_first_not_of( CharT const * s, size_...
method nssv_constexpr (line 789) | nssv_constexpr size_type find_last_not_of( basic_string_view v, si...
method nssv_constexpr (line 798) | nssv_constexpr size_type find_last_not_of( CharT c, size_type pos ...
method nssv_constexpr (line 803) | nssv_constexpr size_type find_last_not_of( CharT const * s, size_t...
method nssv_constexpr (line 808) | nssv_constexpr size_type find_last_not_of( CharT const * s, size_t...
type size_type (line 818) | enum : size_type { npos = size_type(-1) }
type not_in_view (line 824) | struct not_in_view
method nssv_constexpr (line 828) | nssv_constexpr not_in_view( basic_string_view v ) : v( v ) {}
method nssv_constexpr (line 830) | nssv_constexpr bool operator()( CharT c ) const
method nssv_constexpr (line 836) | nssv_constexpr size_type to_pos( const_iterator it ) const
method nssv_constexpr (line 841) | nssv_constexpr size_type to_pos( const_reverse_iterator it ) const
method data_at (line 846) | data_at( size_type pos ) const
method basic_string_view (line 863) | basic_string_view( std::basic_string<CharT, Traits, Allocator> con...
method to_string (line 881) | std::basic_string<CharT, Traits, Allocator>
method to_string (line 889) | std::basic_string<CharT, Traits>
method to_string (line 896) | std::basic_string<CharT, Traits, Allocator>
class basic_string_view (line 421) | class basic_string_view
method nssv_constexpr (line 450) | nssv_constexpr basic_string_view( basic_string_view const & other ...
method begin (line 483) | begin() const nssv_noexcept { return data_; }
method end (line 484) | end() const nssv_noexcept { return data_ + size_; }
method cbegin (line 486) | cbegin() const nssv_noexcept { return begin(); }
method cend (line 487) | cend() const nssv_noexcept { return end(); }
method rbegin (line 489) | rbegin() const nssv_noexcept { return const_reverse_iterator( end...
method rend (line 490) | rend() const nssv_noexcept { return const_reverse_iterator( beg...
method crbegin (line 492) | crbegin() const nssv_noexcept { return rbegin(); }
method crend (line 493) | crend() const nssv_noexcept { return rend(); }
method nssv_constexpr (line 497) | nssv_constexpr size_type size() const nssv_noexcept { return s...
method nssv_constexpr (line 498) | nssv_constexpr size_type length() const nssv_noexcept { return s...
method nssv_constexpr (line 499) | nssv_constexpr size_type max_size() const nssv_noexcept { return (...
method empty (line 502) | bool empty() const nssv_noexcept
method at (line 514) | at( size_type pos ) const
method front (line 527) | front() const { return data_at( 0 ); }
method back (line 528) | back() const { return data_at( size() - 1 ); }
method data (line 530) | data() const nssv_noexcept { return data_; }
method nssv_constexpr14 (line 534) | nssv_constexpr14 void remove_prefix( size_type n )
method nssv_constexpr14 (line 541) | nssv_constexpr14 void remove_suffix( size_type n )
method nssv_constexpr14 (line 547) | nssv_constexpr14 void swap( basic_string_view & other ) nssv_noexcept
method size_type (line 556) | size_type copy( CharT * dest, size_type n, size_type pos = 0 ) const
method substr (line 573) | substr( size_type pos = 0, size_type n = npos ) const
method nssv_constexpr14 (line 588) | nssv_constexpr14 int compare( basic_string_view other ) const nssv...
method nssv_constexpr (line 596) | nssv_constexpr int compare( size_type pos1, size_type n1, basic_st...
method nssv_constexpr (line 601) | nssv_constexpr int compare( size_type pos1, size_type n1, basic_st...
method nssv_constexpr (line 606) | nssv_constexpr int compare( CharT const * s ) const // (4)
method nssv_constexpr (line 611) | nssv_constexpr int compare( size_type pos1, size_type n1, CharT co...
method nssv_constexpr (line 616) | nssv_constexpr int compare( size_type pos1, size_type n1, CharT co...
method nssv_constexpr (line 625) | nssv_constexpr bool starts_with( basic_string_view v ) const nssv_...
method nssv_constexpr (line 630) | nssv_constexpr bool starts_with( CharT c ) const nssv_noexcept //...
method nssv_constexpr (line 635) | nssv_constexpr bool starts_with( CharT const * s ) const // (3)
method nssv_constexpr (line 642) | nssv_constexpr bool ends_with( basic_string_view v ) const nssv_no...
method nssv_constexpr (line 647) | nssv_constexpr bool ends_with( CharT c ) const nssv_noexcept // (2)
method nssv_constexpr (line 652) | nssv_constexpr bool ends_with( CharT const * s ) const // (3)
method nssv_constexpr14 (line 659) | nssv_constexpr14 size_type find( basic_string_view v, size_type po...
method nssv_constexpr14 (line 667) | nssv_constexpr14 size_type find( CharT c, size_type pos = 0 ) cons...
method nssv_constexpr14 (line 672) | nssv_constexpr14 size_type find( CharT const * s, size_type pos, s...
method nssv_constexpr14 (line 677) | nssv_constexpr14 size_type find( CharT const * s, size_type pos = ...
method nssv_constexpr14 (line 684) | nssv_constexpr14 size_type rfind( basic_string_view v, size_type p...
method nssv_constexpr14 (line 698) | nssv_constexpr14 size_type rfind( CharT c, size_type pos = npos ) ...
method nssv_constexpr14 (line 703) | nssv_constexpr14 size_type rfind( CharT const * s, size_type pos, ...
method nssv_constexpr14 (line 708) | nssv_constexpr14 size_type rfind( CharT const * s, size_type pos =...
method nssv_constexpr (line 715) | nssv_constexpr size_type find_first_of( basic_string_view v, size_...
method nssv_constexpr (line 722) | nssv_constexpr size_type find_first_of( CharT c, size_type pos = 0...
method nssv_constexpr (line 727) | nssv_constexpr size_type find_first_of( CharT const * s, size_type...
method nssv_constexpr (line 732) | nssv_constexpr size_type find_first_of( CharT const * s, size_typ...
method nssv_constexpr (line 739) | nssv_constexpr size_type find_last_of( basic_string_view v, size_t...
method nssv_constexpr (line 748) | nssv_constexpr size_type find_last_of( CharT c, size_type pos = np...
method nssv_constexpr (line 753) | nssv_constexpr size_type find_last_of( CharT const * s, size_type ...
method nssv_constexpr (line 758) | nssv_constexpr size_type find_last_of( CharT const * s, size_type ...
method nssv_constexpr (line 765) | nssv_constexpr size_type find_first_not_of( basic_string_view v, s...
method nssv_constexpr (line 772) | nssv_constexpr size_type find_first_not_of( CharT c, size_type pos...
method nssv_constexpr (line 777) | nssv_constexpr size_type find_first_not_of( CharT const * s, size_...
method nssv_constexpr (line 782) | nssv_constexpr size_type find_first_not_of( CharT const * s, size_...
method nssv_constexpr (line 789) | nssv_constexpr size_type find_last_not_of( basic_string_view v, si...
method nssv_constexpr (line 798) | nssv_constexpr size_type find_last_not_of( CharT c, size_type pos ...
method nssv_constexpr (line 803) | nssv_constexpr size_type find_last_not_of( CharT const * s, size_t...
method nssv_constexpr (line 808) | nssv_constexpr size_type find_last_not_of( CharT const * s, size_t...
type size_type (line 818) | enum : size_type { npos = size_type(-1) }
type not_in_view (line 824) | struct not_in_view
method nssv_constexpr (line 828) | nssv_constexpr not_in_view( basic_string_view v ) : v( v ) {}
method nssv_constexpr (line 830) | nssv_constexpr bool operator()( CharT c ) const
method nssv_constexpr (line 836) | nssv_constexpr size_type to_pos( const_iterator it ) const
method nssv_constexpr (line 841) | nssv_constexpr size_type to_pos( const_reverse_iterator it ) const
method data_at (line 846) | data_at( size_type pos ) const
method basic_string_view (line 863) | basic_string_view( std::basic_string<CharT, Traits, Allocator> con...
method to_string (line 881) | std::basic_string<CharT, Traits, Allocator>
method to_string (line 889) | std::basic_string<CharT, Traits>
method to_string (line 896) | std::basic_string<CharT, Traits, Allocator>
function nssv_constexpr (line 915) | nssv_constexpr bool operator== (
function nssv_constexpr (line 921) | nssv_constexpr bool operator!= (
function nssv_constexpr (line 927) | nssv_constexpr bool operator< (
function nssv_constexpr (line 933) | nssv_constexpr bool operator<= (
function nssv_constexpr (line 939) | nssv_constexpr bool operator> (
function nssv_constexpr (line 945) | nssv_constexpr bool operator>= (
class Traits (line 967) | class Traits
function nssv_constexpr (line 968) | nssv_constexpr bool operator==(
class Traits (line 973) | class Traits
function nssv_constexpr (line 974) | nssv_constexpr bool operator==(
class Traits (line 981) | class Traits
function nssv_constexpr (line 982) | nssv_constexpr bool operator!= (
class Traits (line 987) | class Traits
function nssv_constexpr (line 988) | nssv_constexpr bool operator!= (
class Traits (line 995) | class Traits
function nssv_constexpr (line 996) | nssv_constexpr bool operator< (
class Traits (line 1001) | class Traits
function nssv_constexpr (line 1002) | nssv_constexpr bool operator< (
class Traits (line 1009) | class Traits
function nssv_constexpr (line 1010) | nssv_constexpr bool operator<= (
class Traits (line 1015) | class Traits
function nssv_constexpr (line 1016) | nssv_constexpr bool operator<= (
class Traits (line 1023) | class Traits
function nssv_constexpr (line 1024) | nssv_constexpr bool operator> (
class Traits (line 1029) | class Traits
function nssv_constexpr (line 1030) | nssv_constexpr bool operator> (
class Traits (line 1037) | class Traits
function nssv_constexpr (line 1038) | nssv_constexpr bool operator>= (
class Traits (line 1043) | class Traits
function nssv_constexpr (line 1044) | nssv_constexpr bool operator>= (
type detail (line 1056) | namespace detail {
function write_padding (line 1059) | void write_padding( Stream & os, std::streamsize n )
function Stream (line 1066) | Stream & write_to_stream( Stream & os, View const & sv )
function to_string (line 1192) | std::basic_string<CharT, Traits, Allocator>
function to_string (line 1201) | std::basic_string<CharT, Traits>
function to_string (line 1208) | std::basic_string<CharT, Traits, Allocator>
function to_string_view (line 1217) | basic_string_view<CharT, Traits>
function nssv_inline_ns (line 1123) | nssv_inline_ns namespace literals {
type sv_lite (line 1185) | namespace sv_lite {
class basic_string_view (line 410) | class basic_string_view
method nssv_constexpr (line 450) | nssv_constexpr basic_string_view( basic_string_view const & other ...
method begin (line 483) | begin() const nssv_noexcept { return data_; }
method end (line 484) | end() const nssv_noexcept { return data_ + size_; }
method cbegin (line 486) | cbegin() const nssv_noexcept { return begin(); }
method cend (line 487) | cend() const nssv_noexcept { return end(); }
method rbegin (line 489) | rbegin() const nssv_noexcept { return const_reverse_iterator( end...
method rend (line 490) | rend() const nssv_noexcept { return const_reverse_iterator( beg...
method crbegin (line 492) | crbegin() const nssv_noexcept { return rbegin(); }
method crend (line 493) | crend() const nssv_noexcept { return rend(); }
method nssv_constexpr (line 497) | nssv_constexpr size_type size() const nssv_noexcept { return s...
method nssv_constexpr (line 498) | nssv_constexpr size_type length() const nssv_noexcept { return s...
method nssv_constexpr (line 499) | nssv_constexpr size_type max_size() const nssv_noexcept { return (...
method empty (line 502) | bool empty() const nssv_noexcept
method at (line 514) | at( size_type pos ) const
method front (line 527) | front() const { return data_at( 0 ); }
method back (line 528) | back() const { return data_at( size() - 1 ); }
method data (line 530) | data() const nssv_noexcept { return data_; }
method nssv_constexpr14 (line 534) | nssv_constexpr14 void remove_prefix( size_type n )
method nssv_constexpr14 (line 541) | nssv_constexpr14 void remove_suffix( size_type n )
method nssv_constexpr14 (line 547) | nssv_constexpr14 void swap( basic_string_view & other ) nssv_noexcept
method size_type (line 556) | size_type copy( CharT * dest, size_type n, size_type pos = 0 ) const
method substr (line 573) | substr( size_type pos = 0, size_type n = npos ) const
method nssv_constexpr14 (line 588) | nssv_constexpr14 int compare( basic_string_view other ) const nssv...
method nssv_constexpr (line 596) | nssv_constexpr int compare( size_type pos1, size_type n1, basic_st...
method nssv_constexpr (line 601) | nssv_constexpr int compare( size_type pos1, size_type n1, basic_st...
method nssv_constexpr (line 606) | nssv_constexpr int compare( CharT const * s ) const // (4)
method nssv_constexpr (line 611) | nssv_constexpr int compare( size_type pos1, size_type n1, CharT co...
method nssv_constexpr (line 616) | nssv_constexpr int compare( size_type pos1, size_type n1, CharT co...
method nssv_constexpr (line 625) | nssv_constexpr bool starts_with( basic_string_view v ) const nssv_...
method nssv_constexpr (line 630) | nssv_constexpr bool starts_with( CharT c ) const nssv_noexcept //...
method nssv_constexpr (line 635) | nssv_constexpr bool starts_with( CharT const * s ) const // (3)
method nssv_constexpr (line 642) | nssv_constexpr bool ends_with( basic_string_view v ) const nssv_no...
method nssv_constexpr (line 647) | nssv_constexpr bool ends_with( CharT c ) const nssv_noexcept // (2)
method nssv_constexpr (line 652) | nssv_constexpr bool ends_with( CharT const * s ) const // (3)
method nssv_constexpr14 (line 659) | nssv_constexpr14 size_type find( basic_string_view v, size_type po...
method nssv_constexpr14 (line 667) | nssv_constexpr14 size_type find( CharT c, size_type pos = 0 ) cons...
method nssv_constexpr14 (line 672) | nssv_constexpr14 size_type find( CharT const * s, size_type pos, s...
method nssv_constexpr14 (line 677) | nssv_constexpr14 size_type find( CharT const * s, size_type pos = ...
method nssv_constexpr14 (line 684) | nssv_constexpr14 size_type rfind( basic_string_view v, size_type p...
method nssv_constexpr14 (line 698) | nssv_constexpr14 size_type rfind( CharT c, size_type pos = npos ) ...
method nssv_constexpr14 (line 703) | nssv_constexpr14 size_type rfind( CharT const * s, size_type pos, ...
method nssv_constexpr14 (line 708) | nssv_constexpr14 size_type rfind( CharT const * s, size_type pos =...
method nssv_constexpr (line 715) | nssv_constexpr size_type find_first_of( basic_string_view v, size_...
method nssv_constexpr (line 722) | nssv_constexpr size_type find_first_of( CharT c, size_type pos = 0...
method nssv_constexpr (line 727) | nssv_constexpr size_type find_first_of( CharT const * s, size_type...
method nssv_constexpr (line 732) | nssv_constexpr size_type find_first_of( CharT const * s, size_typ...
method nssv_constexpr (line 739) | nssv_constexpr size_type find_last_of( basic_string_view v, size_t...
method nssv_constexpr (line 748) | nssv_constexpr size_type find_last_of( CharT c, size_type pos = np...
method nssv_constexpr (line 753) | nssv_constexpr size_type find_last_of( CharT const * s, size_type ...
method nssv_constexpr (line 758) | nssv_constexpr size_type find_last_of( CharT const * s, size_type ...
method nssv_constexpr (line 765) | nssv_constexpr size_type find_first_not_of( basic_string_view v, s...
method nssv_constexpr (line 772) | nssv_constexpr size_type find_first_not_of( CharT c, size_type pos...
method nssv_constexpr (line 777) | nssv_constexpr size_type find_first_not_of( CharT const * s, size_...
method nssv_constexpr (line 782) | nssv_constexpr size_type find_first_not_of( CharT const * s, size_...
method nssv_constexpr (line 789) | nssv_constexpr size_type find_last_not_of( basic_string_view v, si...
method nssv_constexpr (line 798) | nssv_constexpr size_type find_last_not_of( CharT c, size_type pos ...
method nssv_constexpr (line 803) | nssv_constexpr size_type find_last_not_of( CharT const * s, size_t...
method nssv_constexpr (line 808) | nssv_constexpr size_type find_last_not_of( CharT const * s, size_t...
type size_type (line 818) | enum : size_type { npos = size_type(-1) }
type not_in_view (line 824) | struct not_in_view
method nssv_constexpr (line 828) | nssv_constexpr not_in_view( basic_string_view v ) : v( v ) {}
method nssv_constexpr (line 830) | nssv_constexpr bool operator()( CharT c ) const
method nssv_constexpr (line 836) | nssv_constexpr size_type to_pos( const_iterator it ) const
method nssv_constexpr (line 841) | nssv_constexpr size_type to_pos( const_reverse_iterator it ) const
method data_at (line 846) | data_at( size_type pos ) const
method basic_string_view (line 863) | basic_string_view( std::basic_string<CharT, Traits, Allocator> con...
method to_string (line 881) | std::basic_string<CharT, Traits, Allocator>
method to_string (line 889) | std::basic_string<CharT, Traits>
method to_string (line 896) | std::basic_string<CharT, Traits, Allocator>
class basic_string_view (line 421) | class basic_string_view
method nssv_constexpr (line 450) | nssv_constexpr basic_string_view( basic_string_view const & other ...
method begin (line 483) | begin() const nssv_noexcept { return data_; }
method end (line 484) | end() const nssv_noexcept { return data_ + size_; }
method cbegin (line 486) | cbegin() const nssv_noexcept { return begin(); }
method cend (line 487) | cend() const nssv_noexcept { return end(); }
method rbegin (line 489) | rbegin() const nssv_noexcept { return const_reverse_iterator( end...
method rend (line 490) | rend() const nssv_noexcept { return const_reverse_iterator( beg...
method crbegin (line 492) | crbegin() const nssv_noexcept { return rbegin(); }
method crend (line 493) | crend() const nssv_noexcept { return rend(); }
method nssv_constexpr (line 497) | nssv_constexpr size_type size() const nssv_noexcept { return s...
method nssv_constexpr (line 498) | nssv_constexpr size_type length() const nssv_noexcept { return s...
method nssv_constexpr (line 499) | nssv_constexpr size_type max_size() const nssv_noexcept { return (...
method empty (line 502) | bool empty() const nssv_noexcept
method at (line 514) | at( size_type pos ) const
method front (line 527) | front() const { return data_at( 0 ); }
method back (line 528) | back() const { return data_at( size() - 1 ); }
method data (line 530) | data() const nssv_noexcept { return data_; }
method nssv_constexpr14 (line 534) | nssv_constexpr14 void remove_prefix( size_type n )
method nssv_constexpr14 (line 541) | nssv_constexpr14 void remove_suffix( size_type n )
method nssv_constexpr14 (line 547) | nssv_constexpr14 void swap( basic_string_view & other ) nssv_noexcept
method size_type (line 556) | size_type copy( CharT * dest, size_type n, size_type pos = 0 ) const
method substr (line 573) | substr( size_type pos = 0, size_type n = npos ) const
method nssv_constexpr14 (line 588) | nssv_constexpr14 int compare( basic_string_view other ) const nssv...
method nssv_constexpr (line 596) | nssv_constexpr int compare( size_type pos1, size_type n1, basic_st...
method nssv_constexpr (line 601) | nssv_constexpr int compare( size_type pos1, size_type n1, basic_st...
method nssv_constexpr (line 606) | nssv_constexpr int compare( CharT const * s ) const // (4)
method nssv_constexpr (line 611) | nssv_constexpr int compare( size_type pos1, size_type n1, CharT co...
method nssv_constexpr (line 616) | nssv_constexpr int compare( size_type pos1, size_type n1, CharT co...
method nssv_constexpr (line 625) | nssv_constexpr bool starts_with( basic_string_view v ) const nssv_...
method nssv_constexpr (line 630) | nssv_constexpr bool starts_with( CharT c ) const nssv_noexcept //...
method nssv_constexpr (line 635) | nssv_constexpr bool starts_with( CharT const * s ) const // (3)
method nssv_constexpr (line 642) | nssv_constexpr bool ends_with( basic_string_view v ) const nssv_no...
method nssv_constexpr (line 647) | nssv_constexpr bool ends_with( CharT c ) const nssv_noexcept // (2)
method nssv_constexpr (line 652) | nssv_constexpr bool ends_with( CharT const * s ) const // (3)
method nssv_constexpr14 (line 659) | nssv_constexpr14 size_type find( basic_string_view v, size_type po...
method nssv_constexpr14 (line 667) | nssv_constexpr14 size_type find( CharT c, size_type pos = 0 ) cons...
method nssv_constexpr14 (line 672) | nssv_constexpr14 size_type find( CharT const * s, size_type pos, s...
method nssv_constexpr14 (line 677) | nssv_constexpr14 size_type find( CharT const * s, size_type pos = ...
method nssv_constexpr14 (line 684) | nssv_constexpr14 size_type rfind( basic_string_view v, size_type p...
method nssv_constexpr14 (line 698) | nssv_constexpr14 size_type rfind( CharT c, size_type pos = npos ) ...
method nssv_constexpr14 (line 703) | nssv_constexpr14 size_type rfind( CharT const * s, size_type pos, ...
method nssv_constexpr14 (line 708) | nssv_constexpr14 size_type rfind( CharT const * s, size_type pos =...
method nssv_constexpr (line 715) | nssv_constexpr size_type find_first_of( basic_string_view v, size_...
method nssv_constexpr (line 722) | nssv_constexpr size_type find_first_of( CharT c, size_type pos = 0...
method nssv_constexpr (line 727) | nssv_constexpr size_type find_first_of( CharT const * s, size_type...
method nssv_constexpr (line 732) | nssv_constexpr size_type find_first_of( CharT const * s, size_typ...
method nssv_constexpr (line 739) | nssv_constexpr size_type find_last_of( basic_string_view v, size_t...
method nssv_constexpr (line 748) | nssv_constexpr size_type find_last_of( CharT c, size_type pos = np...
method nssv_constexpr (line 753) | nssv_constexpr size_type find_last_of( CharT const * s, size_type ...
method nssv_constexpr (line 758) | nssv_constexpr size_type find_last_of( CharT const * s, size_type ...
method nssv_constexpr (line 765) | nssv_constexpr size_type find_first_not_of( basic_string_view v, s...
method nssv_constexpr (line 772) | nssv_constexpr size_type find_first_not_of( CharT c, size_type pos...
method nssv_constexpr (line 777) | nssv_constexpr size_type find_first_not_of( CharT const * s, size_...
method nssv_constexpr (line 782) | nssv_constexpr size_type find_first_not_of( CharT const * s, size_...
method nssv_constexpr (line 789) | nssv_constexpr size_type find_last_not_of( basic_string_view v, si...
method nssv_constexpr (line 798) | nssv_constexpr size_type find_last_not_of( CharT c, size_type pos ...
method nssv_constexpr (line 803) | nssv_constexpr size_type find_last_not_of( CharT const * s, size_t...
method nssv_constexpr (line 808) | nssv_constexpr size_type find_last_not_of( CharT const * s, size_t...
type size_type (line 818) | enum : size_type { npos = size_type(-1) }
type not_in_view (line 824) | struct not_in_view
method nssv_constexpr (line 828) | nssv_constexpr not_in_view( basic_string_view v ) : v( v ) {}
method nssv_constexpr (line 830) | nssv_constexpr bool operator()( CharT c ) const
method nssv_constexpr (line 836) | nssv_constexpr size_type to_pos( const_iterator it ) const
method nssv_constexpr (line 841) | nssv_constexpr size_type to_pos( const_reverse_iterator it ) const
method data_at (line 846) | data_at( size_type pos ) const
method basic_string_view (line 863) | basic_string_view( std::basic_string<CharT, Traits, Allocator> con...
method to_string (line 881) | std::basic_string<CharT, Traits, Allocator>
method to_string (line 889) | std::basic_string<CharT, Traits>
method to_string (line 896) | std::basic_string<CharT, Traits, Allocator>
function nssv_constexpr (line 915) | nssv_constexpr bool operator== (
function nssv_constexpr (line 921) | nssv_constexpr bool operator!= (
function nssv_constexpr (line 927) | nssv_constexpr bool operator< (
function nssv_constexpr (line 933) | nssv_constexpr bool operator<= (
function nssv_constexpr (line 939) | nssv_constexpr bool operator> (
function nssv_constexpr (line 945) | nssv_constexpr bool operator>= (
class Traits (line 967) | class Traits
function nssv_constexpr (line 968) | nssv_constexpr bool operator==(
class Traits (line 973) | class Traits
function nssv_constexpr (line 974) | nssv_constexpr bool operator==(
class Traits (line 981) | class Traits
function nssv_constexpr (line 982) | nssv_constexpr bool operator!= (
class Traits (line 987) | class Traits
function nssv_constexpr (line 988) | nssv_constexpr bool operator!= (
class Traits (line 995) | class Traits
function nssv_constexpr (line 996) | nssv_constexpr bool operator< (
class Traits (line 1001) | class Traits
function nssv_constexpr (line 1002) | nssv_constexpr bool operator< (
class Traits (line 1009) | class Traits
function nssv_constexpr (line 1010) | nssv_constexpr bool operator<= (
class Traits (line 1015) | class Traits
function nssv_constexpr (line 1016) | nssv_constexpr bool operator<= (
class Traits (line 1023) | class Traits
function nssv_constexpr (line 1024) | nssv_constexpr bool operator> (
class Traits (line 1029) | class Traits
function nssv_constexpr (line 1030) | nssv_constexpr bool operator> (
class Traits (line 1037) | class Traits
function nssv_constexpr (
Condensed preview — 224 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (3,028K chars).
[
{
"path": ".gitignore",
"chars": 304,
"preview": "# Prerequisites\n*.d\n\n# Compiled Object files\n*.slo\n*.lo\n*.o\n*.obj\n\n# Precompiled Headers\n*.gch\n*.pch\n\n# Compiled Dynamic"
},
{
"path": "CMakeLists.txt",
"chars": 3037,
"preview": "cmake_minimum_required(VERSION 3.9)\n\nproject(da4qi4)\n\n#set(_DAQI_TARGET_TYPE_ \"DEMO_SERVER\")\n#set(_DAQI_TARGET_TYPE_ \"ST"
},
{
"path": "LICENSE",
"chars": 10260,
"preview": "Apache License\nVersion 2.0, January 2004\nhttp://www.apache.org/licenses/\n\nTERMS AND CONDITIONS FOR USE, REPRODUCTION, AN"
},
{
"path": "README.md",
"chars": 24341,
"preview": "- [零、几个原则](#零几个原则)\n * [0.1 自己的狗粮自己吃](#01-自己的狗粮自己吃)\n * [0.2 站在巨人的肩膀上](#02-站在巨人的肩膀上)\n * [0.3 易用优于性能](#03-易用优于性能)\n * [0"
},
{
"path": "cmake_install.cmake",
"chars": 1696,
"preview": "# Install script for directory: /home/zhuangyan/Projects/CPP/da4qi4\n\n# Set the install prefix\nif(NOT DEFINED CMAKE_INSTA"
},
{
"path": "da4qi4.astylerc",
"chars": 598,
"preview": "# Allman Coding Style Options\r\n# Based on an old AStyle release.\r\n\r\n# braces and indent\r\nstyle=allman\r\nindent=spaces\r\n\r\n"
},
{
"path": "include/daqi/application.hpp",
"chars": 15784,
"preview": "#ifndef DAQI_APPLICATION_HPP\n#define DAQI_APPLICATION_HPP\n\n#include <set>\n#include <map>\n#include <memory>\n\n#include \"da"
},
{
"path": "include/daqi/client/connection_client.hpp",
"chars": 7671,
"preview": "#ifndef DAQI_CLIENT_CONNECTION_HPP\n#define DAQI_CLIENT_CONNECTION_HPP\n\n#include <memory>\n#include <boost/asio/ssl/stream"
},
{
"path": "include/daqi/connection.hpp",
"chars": 5819,
"preview": "#ifndef DAQI_CONNECTION_HPP\n#define DAQI_CONNECTION_HPP\n\n#include <memory>\n#include <string>\n\n#include \"llhttp/llhttp.h\""
},
{
"path": "include/daqi/context.hpp",
"chars": 12706,
"preview": "#ifndef DAQI_CONTEXT_HPP\n#define DAQI_CONTEXT_HPP\n\n#include <memory>\n#include <functional>\n#include <list>\n\n#include \"da"
},
{
"path": "include/daqi/cookie.hpp",
"chars": 4574,
"preview": "#ifndef DAQI_COOKIE_HPP\n#define DAQI_COOKIE_HPP\n\n#include <ctime>\n\n#include <iostream>\n#include <string>\n#include <limit"
},
{
"path": "include/daqi/da4qi4.hpp",
"chars": 195,
"preview": "#ifndef DAQI_DA4QI4_HPP\n#define DAQI_DA4QI4_HPP\n\n#include \"daqi/def/log_def.hpp\"\n\n#include \"daqi/server.hpp\"\n#include \"d"
},
{
"path": "include/daqi/def/asio_def.hpp",
"chars": 628,
"preview": "#ifndef DAQI_ASIO_DEF_HPP\n#define DAQI_ASIO_DEF_HPP\n\n#include <boost/asio.hpp>\n#include <boost/asio/ssl.hpp>\n\nnamespace "
},
{
"path": "include/daqi/def/boost_def.hpp",
"chars": 662,
"preview": "#ifndef DAQI_BOOST_DEF_HPP\n#define DAQI_BOOST_DEF_HPP\n\n#include <string>\n\n#include <boost/optional.hpp>\n#include <boost/"
},
{
"path": "include/daqi/def/debug_def.hpp",
"chars": 105,
"preview": "#ifndef DAQI_DEBUG_DEF_HPP\n#define DAQI_DEBUG_DEF_HPP\n\n#include <iostream>\n\n#endif // DAQI_DEBUG_DEF_HPP\n"
},
{
"path": "include/daqi/def/def.hpp",
"chars": 705,
"preview": "#ifndef DAQI_DEF_HPP\n#define DAQI_DEF_HPP\n\n#include <string>\n#include <map>\n#include <functional>\n#include <memory>\n#inc"
},
{
"path": "include/daqi/def/inja_def.hpp",
"chars": 225,
"preview": "#ifndef DAQI_INJA_DEF_HPP\n#define DAQI_INJA_DEF_HPP\n\n#include <memory>\n\n#include \"inja/inja.hpp\"\n\nnamespace da4qi4\n{\n\nus"
},
{
"path": "include/daqi/def/json_def.hpp",
"chars": 2134,
"preview": "#ifndef DAQI_JSON_DEF_HPP\n#define DAQI_JSON_DEF_HPP\n\n#include \"nlohmann/json.hpp\"\n\n#include <ctime>\n\nnamespace da4qi4\n{\n"
},
{
"path": "include/daqi/def/log_def.hpp",
"chars": 1369,
"preview": "#ifndef DAQI_LOG_DEF_HPP\n#define DAQI_LOG_DEF_HPP\n\n#include <memory>\n\n#include \"spdlog/spdlog.h\"\n#include \"spdlog/sinks/"
},
{
"path": "include/daqi/def/redis_def.hpp",
"chars": 238,
"preview": "#ifndef DAQI_REDIS_DEF_HPP\n#define DAQI_REDIS_DEF_HPP\n\nnamespace da4qi4\n{\n\nextern unsigned short int const redis_server_"
},
{
"path": "include/daqi/handler.hpp",
"chars": 1172,
"preview": "#ifndef DAQI_HANDLER_HPP\n#define DAQI_HANDLER_HPP\n\n#include \"llhttp/llhttp.h\"\n\n#include \"daqi/context.hpp\"\n\n#include <bi"
},
{
"path": "include/daqi/intercepter.hpp",
"chars": 597,
"preview": "#ifndef INTERCEPTER_HPP\n#define INTERCEPTER_HPP\n\n#include <functional>\n\n#include \"daqi/def/def.hpp\"\n#include \"daqi/def/j"
},
{
"path": "include/daqi/intercepters/session_redis.hpp",
"chars": 2324,
"preview": "#ifndef DAQI_INTERCEPTER_SESSION_REDIS_HPP\n#define DAQI_INTERCEPTER_SESSION_REDIS_HPP\n\n#include <string>\n\n#include \"daqi"
},
{
"path": "include/daqi/intercepters/static_file.hpp",
"chars": 2344,
"preview": "#ifndef DAQI_INTERCEPTER_STATIC_FILE_HPP\n#define DAQI_INTERCEPTER_STATIC_FILE_HPP\n\n#include <functional>\n#include <vecto"
},
{
"path": "include/daqi/net-detail/net_detail_client.hpp",
"chars": 3096,
"preview": "#ifndef NET_DETAIL_CLIENT_HPP\n#define NET_DETAIL_CLIENT_HPP\n\n#include \"daqi/def/boost_def.hpp\"\n#include \"daqi/def/asio_d"
},
{
"path": "include/daqi/net-detail/net_detail_server.hpp",
"chars": 3273,
"preview": "#ifndef DAQI_NET_DETAIL_SERVER_HPP\n#define DAQI_NET_DETAIL_SERVER_HPP\n\n#include <boost/asio/ssl/stream.hpp>\n\n#include \"d"
},
{
"path": "include/daqi/redis-client/redis_buffer.hpp",
"chars": 545,
"preview": "#ifndef DAQI_REDIS_BUFFER_H\n#define DAQI_REDIS_BUFFER_H\n\n#include <string>\n#include <vector>\n\nnamespace da4qi4\n{\n\nstruct"
},
{
"path": "include/daqi/redis-client/redis_client.hpp",
"chars": 3329,
"preview": "#ifndef DAQI_REDIS_CLIENT_HPP\n#define DAQI_FREDIS_CLIENT_HPP\n\n#include <string>\n#include <queue>\n#include <deque>\n\n#incl"
},
{
"path": "include/daqi/redis-client/redis_command.hpp",
"chars": 292,
"preview": "#ifndef DAQI_REDIS_COMMAND_HPP\n#define DAQI_REDIS_COMMAND_HPP\n\n#include <vector>\n#include <deque>\n\n#include \"daqi/redis-"
},
{
"path": "include/daqi/redis-client/redis_parser.hpp",
"chars": 1602,
"preview": "#ifndef DAQI_REDIS_PARSER_HPP\n#define DAQI_REDIS_PARSER_HPP\n\n#include <vector>\n#include <stack>\n\n#include <boost/variant"
},
{
"path": "include/daqi/redis-client/redis_value.hpp",
"chars": 3110,
"preview": "#ifndef DAQI_REDIS_VALUE_HPP\n#define DAQI_REDIS_VALUE_HPP\n\n#include <string>\n#include <stack>\n#include <vector>\n#include"
},
{
"path": "include/daqi/rediscli_pool.hpp",
"chars": 1134,
"preview": "#ifndef DAQI_REDIS_CLI_POOL_HPP\n#define DAQI_REDIS_CLI_POOL_HPP\n\n#include <map>\n#include <queue>\n#include <mutex>\n#inclu"
},
{
"path": "include/daqi/request.hpp",
"chars": 13263,
"preview": "#ifndef DAQI_REQUEST_HPP\n#define DAQI_REQUEST_HPP\n\n#include <string>\n#include <map>\n#include <bitset>\n#include <vector>\n"
},
{
"path": "include/daqi/response.hpp",
"chars": 10114,
"preview": "#ifndef DAQI_RESPONSE_HPP\n#define DAQI_RESPONSE_HPP\n\n#include <iostream>\n#include <functional>\n#include <vector>\n\n#inclu"
},
{
"path": "include/daqi/router.hpp",
"chars": 7249,
"preview": "#ifndef DAQI_ROUTER_HPP\n#define DAQI_ROUTER_HPP\n\n#include <map>\n#include <list>\n#include <regex>\n\n#include \"daqi/utiliti"
},
{
"path": "include/daqi/server.hpp",
"chars": 8575,
"preview": "#ifndef DAQI_SERVER_HPP\n#define DAQI_SERVER_HPP\n\n#include <atomic>\n#include <list>\n#include <string>\n#include <functiona"
},
{
"path": "include/daqi/server_engine.hpp",
"chars": 1095,
"preview": "#ifndef DAQI_SERVER_ENGINE_HPP\n#define DAQI_SERVER_ENGINE_HPP\n\n#include <memory>\n#include <thread>\n\n#include <list>\n#inc"
},
{
"path": "include/daqi/session.hpp",
"chars": 731,
"preview": "#ifndef DAQI_SESSION_HPP\n#define DAQI_SESSION_HPP\n\n#include <string>\n\n#include \"daqi/def/json_def.hpp\"\n#include \"daqi/co"
},
{
"path": "include/daqi/templates.hpp",
"chars": 3422,
"preview": "#ifndef DAQI_TEMPLATES_HPP\n#define DAQI_TEMPLATES_HPP\n\n#include <string>\n#include <mutex>\n#include <vector>\n#include <un"
},
{
"path": "include/daqi/url.hpp",
"chars": 1168,
"preview": "#ifndef DAQI_URL_HPP\n#define DAQI_URL_HPP\n\n#include <string>\n\n#include \"daqi/def/def.hpp\"\n\nnamespace da4qi4\n{\n\nstruct Ur"
},
{
"path": "include/daqi/utilities/asio_utilities.hpp",
"chars": 1214,
"preview": "#ifndef DAQI_ASIO_UTILITIES_HPP\n#define DAQI_ASIO_UTILITIES_HPP\n\n#include <string>\n#include <vector>\n#include <functiona"
},
{
"path": "include/daqi/utilities/base64_utilities.hpp",
"chars": 379,
"preview": "#ifndef DAQI_BASE64_HPP\n#define DAQI_BASE64_HPP\n\n#include <cstdint>\n#include <string>\n\nnamespace da4qi4\n{\nnamespace Util"
},
{
"path": "include/daqi/utilities/container_utilities.hpp",
"chars": 1022,
"preview": "#ifndef DAQI_CONTAINER_UTILITIES_HPP\n#define DAQI_CONTAINER_UTILITIES_HPP\n\n#include <string>\n\n#include \"daqi/def/def.hpp"
},
{
"path": "include/daqi/utilities/des3_utilities.hpp",
"chars": 361,
"preview": "#ifndef DAQI_DES3_UTILITIES_HPP\n#define DAQI_DES3_UTILITIES_HPP\n\n#include <string>\n\nnamespace da4qi4\n{\nnamespace Utiliti"
},
{
"path": "include/daqi/utilities/encoding_utilities.hpp",
"chars": 1545,
"preview": "#ifndef ENCODING_UTILITIES_HPP\n#define ENCODING_UTILITIES_HPP\n\n#include <iconv.h>\n#include <string>\n\nnamespace da4qi4\n{\n"
},
{
"path": "include/daqi/utilities/file_utilities.hpp",
"chars": 871,
"preview": "#ifndef DAQI_FILE_UTILITIES_HPP\n#define DAQI_FILE_UTILITIES_HPP\n\n#include <string>\n#include \"daqi/def/boost_def.hpp\"\n\nna"
},
{
"path": "include/daqi/utilities/hmac_sha1_utilities.hpp",
"chars": 752,
"preview": "#ifndef DAQI_HMAC_SHA1_UTILITIES_HPP\n#define DAQI_HMAC_SHA1_UTILITIES_HPP\n\n#include <cstdint>\n#include <vector>\n#include"
},
{
"path": "include/daqi/utilities/html_utilities.hpp",
"chars": 336,
"preview": "#ifndef DAQI_HTML_UTILITIES_HPP\n#define DAQI_HTML_UTILITIES_HPP\n\n#include <string>\n#include <map>\n#include <unordered_ma"
},
{
"path": "include/daqi/utilities/http_utilities.hpp",
"chars": 572,
"preview": "#ifndef DAQI_HTTP_UTILITIES_HPP\n#define DAQI_HTTP_UTILITIES_HPP\n\n#include <string>\n#include <map>\n\nnamespace da4qi4\n{\nna"
},
{
"path": "include/daqi/utilities/md5_utilities.hpp",
"chars": 345,
"preview": "#ifndef DAQI_MD5_UTILITIES_HPP\n#define DAQI_MD5_UTILITIES_HPP\n\n#include <string>\n\nnamespace da4qi4\n{\nnamespace Utilities"
},
{
"path": "include/daqi/utilities/string_utilities.hpp",
"chars": 2305,
"preview": "#ifndef DAQI_STRING_UTILITIES_HPP\n#define DAQI_STRING_UTILITIES_HPP\n\n#include <ctime>\n#include <string>\n#include <vector"
},
{
"path": "include/daqi/websocket/connection_websocket.hpp",
"chars": 4846,
"preview": "#ifndef DAQI_CONNECTION_WEBSOCKET_HPP\n#define DAQI_CONNECTION_WEBSOCKET_HPP\n\n#include <memory>\n#include <string>\n#includ"
},
{
"path": "include/daqi/websocket/context_websocket.hpp",
"chars": 5762,
"preview": "#ifndef CONTEXT_WEBSOCKET_HPP\n#define CONTEXT_WEBSOCKET_HPP\n\n#include <functional>\n\n#include \"daqi/def/log_def.hpp\"\n#inc"
},
{
"path": "include/daqi/websocket/frame_websocket.hpp",
"chars": 4927,
"preview": "//MIT\n//copyright: https://github.com/akzi/xwebsocket\n//author: https://github.com/akzi (fuwq, 82018309@qq.com, bei"
},
{
"path": "include/daqi/websocket/handler_websocket.hpp",
"chars": 2035,
"preview": "#ifndef HANDLER_WEBSOCKET_HPP\n#define HANDLER_WEBSOCKET_HPP\n\n#include <functional>\n#include <memory>\n\nnamespace da4qi4\n{"
},
{
"path": "include/daqi/websocket/websocket.hpp",
"chars": 166,
"preview": "#ifndef WEBSOCKET_HPP\n#define WEBSOCKET_HPP\n\n#include \"daqi/websocket/handler_websocket.hpp\"\n#include \"daqi/websocket/co"
},
{
"path": "inja/bytecode.hpp",
"chars": 3020,
"preview": "// Copyright (c) 2019 Pantor. All rights reserved.\n\n#ifndef INCLUDE_INJA_BYTECODE_HPP_\n#define INCLUDE_INJA_BYTECODE_HPP"
},
{
"path": "inja/config.hpp",
"chars": 1369,
"preview": "// Copyright (c) 2019 Pantor. All rights reserved.\n\n#ifndef INCLUDE_INJA_CONFIG_HPP_\n#define INCLUDE_INJA_CONFIG_HPP_\n\n#"
},
{
"path": "inja/environment.hpp",
"chars": 6126,
"preview": "// Copyright (c) 2019 Pantor. All rights reserved.\n\n#ifndef INCLUDE_INJA_ENVIRONMENT_HPP_\n#define INCLUDE_INJA_ENVIRONME"
},
{
"path": "inja/function_storage.hpp",
"chars": 2071,
"preview": "// Copyright (c) 2019 Pantor. All rights reserved.\n\n#ifndef INCLUDE_INJA_FUNCTION_STORAGE_HPP_\n#define INCLUDE_INJA_FUNC"
},
{
"path": "inja/inja.hpp",
"chars": 436,
"preview": "// Copyright (c) 2019 Pantor. All rights reserved.\n\n#ifndef INCLUDE_INJA_INJA_HPP_\n#define INCLUDE_INJA_INJA_HPP_\n\n#incl"
},
{
"path": "inja/lexer.hpp",
"chars": 8723,
"preview": "// Copyright (c) 2019 Pantor. All rights reserved.\n\n#ifndef INCLUDE_INJA_LEXER_HPP_\n#define INCLUDE_INJA_LEXER_HPP_\n\n#in"
},
{
"path": "inja/parser.hpp",
"chars": 19684,
"preview": "// Copyright (c) 2019 Pantor. All rights reserved.\n\n#ifndef INCLUDE_INJA_PARSER_HPP_\n#define INCLUDE_INJA_PARSER_HPP_\n\n#"
},
{
"path": "inja/polyfill.hpp",
"chars": 1088,
"preview": "// Copyright (c) 2019 Pantor. All rights reserved.\n\n#ifndef INCLUDE_INJA_POLYFILL_HPP_\n#define INCLUDE_INJA_POLYFILL_HPP"
},
{
"path": "inja/renderer.hpp",
"chars": 18543,
"preview": "// Copyright (c) 2019 Pantor. All rights reserved.\n\n#ifndef INCLUDE_INJA_RENDERER_HPP_\n#define INCLUDE_INJA_RENDERER_HPP"
},
{
"path": "inja/string_view.hpp",
"chars": 39124,
"preview": "// Copyright 2017-2019 by Martin Moene\n//\n// string-view lite, a C++17-like string_view for C++98 and later.\n// For more"
},
{
"path": "inja/template.hpp",
"chars": 459,
"preview": "// Copyright (c) 2019 Pantor. All rights reserved.\n\n#ifndef INCLUDE_INJA_TEMPLATE_HPP_\n#define INCLUDE_INJA_TEMPLATE_HPP"
},
{
"path": "inja/token.hpp",
"chars": 1591,
"preview": "// Copyright (c) 2019 Pantor. All rights reserved.\n\n#ifndef INCLUDE_INJA_TOKEN_HPP_\n#define INCLUDE_INJA_TOKEN_HPP_\n\n#in"
},
{
"path": "inja/utils.hpp",
"chars": 1664,
"preview": "// Copyright (c) 2019 Pantor. All rights reserved.\n\n#ifndef INCLUDE_INJA_UTILS_HPP_\n#define INCLUDE_INJA_UTILS_HPP_\n\n#in"
},
{
"path": "llhttp/CMakeLists.txt",
"chars": 381,
"preview": "project(llhttp)\n\naux_source_directory(. LLHTTP_SRC_FILES)\naux_source_directory(helper/ LLHTTP_SRC_FILES)\n\ninclude_direct"
},
{
"path": "llhttp/LICENSE-MIT",
"chars": 1105,
"preview": "This software is licensed under the MIT License.\n\nCopyright Fedor Indutny, 2018.\n\nPermission is hereby granted, free of "
},
{
"path": "llhttp/README.md",
"chars": 4630,
"preview": "# llhttp\n\n[](http://travis-ci.org/nodejs/llhttp)\n\nPort of"
},
{
"path": "llhttp/api.c",
"chars": 5145,
"preview": "#include <stdlib.h>\n#include <stdio.h>\n#include <string.h>\n\n#include \"llhttp.h\"\n\n#define CALLBACK_MAYBE(PARSER, NAME, .."
},
{
"path": "llhttp/helper/http_status_def.h",
"chars": 5012,
"preview": "#ifndef HTTP_STATUS_DEF_H\n#define HTTP_STATUS_DEF_H\n\n/* Status Codes */\n#define HTTP_STATUS_MAP(XX) "
},
{
"path": "llhttp/helper/http_url_def.c",
"chars": 17282,
"preview": "#include \"http_url_def.h\"\n\n#include <assert.h>\n#include <stddef.h>\n#include <ctype.h>\n#include <string.h>\n#include <limi"
},
{
"path": "llhttp/helper/http_url_def.h",
"chars": 1421,
"preview": "#ifndef HTTP_URL_DEF_H\n#define HTTP_URL_DEF_H\n\n#include <stddef.h>\n#include <inttypes.h>\n\n#ifdef __cplusplus\nextern \"C\" "
},
{
"path": "llhttp/http.c",
"chars": 3473,
"preview": "#include <stdio.h>\n#ifndef LLHTTP__TEST\n# include \"llhttp.h\"\n#else\n# define llhttp_t llparse_t\n#endif /* */\n\nint llhttp"
},
{
"path": "llhttp/llhttp.c",
"chars": 187381,
"preview": "#include <stdlib.h>\n#include <stdint.h>\n#include <string.h>\n\n#ifdef __SSE4_2__\n #ifdef _MSC_VER\n #include <nmmintrin.h>"
},
{
"path": "llhttp/llhttp.h",
"chars": 10998,
"preview": "#ifndef INCLUDE_LLHTTP_H_\n#define INCLUDE_LLHTTP_H_\n\n#define LLHTTP_VERSION_MAJOR 2\n#define LLHTTP_VERSION_MINOR 0\n#defi"
},
{
"path": "multipart-parser/.gitignore",
"chars": 4,
"preview": "*.o\n"
},
{
"path": "multipart-parser/CMakeLists.txt",
"chars": 328,
"preview": "project(multipart_parser)\n\naux_source_directory(. MMPART_PARSER_SRC_FILES)\n\ninclude_directories(.)\n\nif(_DAQI_TARGET_TYPE"
},
{
"path": "multipart-parser/README.md",
"chars": 3300,
"preview": "## Multipart form data parser\n\n### Features\n* No dependencies\n* Works with chunks of a data - no need to buffer the whol"
},
{
"path": "multipart-parser/multipart_parser.c",
"chars": 7978,
"preview": "/* Based on node-formidable by Felix Geisendörfer \n * Igor Afonov - afonov@gmail.com - 2012\n * MIT License - http://www."
},
{
"path": "multipart-parser/multipart_parser.h",
"chars": 1352,
"preview": "/* Based on node-formidable by Felix Geisendörfer \n * Igor Afonov - afonov@gmail.com - 2012\n * MIT License - http://www."
},
{
"path": "nlohmann_json/.github/CONTRIBUTING.md",
"chars": 7733,
"preview": "[](http://issuestats.com/github/nlohmann/j"
},
{
"path": "nlohmann_json/.github/ISSUE_TEMPLATE/Bug_report.md",
"chars": 665,
"preview": "---\r\nname: Bug report\r\nabout: Create a report to help us improve\r\n\r\n---\r\n\r\n- What is the issue you have?\r\n\r\n- Please des"
},
{
"path": "nlohmann_json/.github/ISSUE_TEMPLATE/Feature_request.md",
"chars": 178,
"preview": "---\r\nname: Feature request\r\nabout: Suggest an idea for this project\r\n\r\n---\r\n\r\n- Describe the feature in as much detail a"
},
{
"path": "nlohmann_json/.github/PULL_REQUEST_TEMPLATE.md",
"chars": 2462,
"preview": "[Describe your pull request here. Please read the text below the line, and make sure you follow the checklist.]\n\n* * *\n\n"
},
{
"path": "nlohmann_json/.github/config.yml",
"chars": 1123,
"preview": "# Configuration for sentiment-bot - https://github.com/behaviorbot/sentiment-bot\n\n# *Required* toxicity threshold betwee"
},
{
"path": "nlohmann_json/.github/stale.yml",
"chars": 691,
"preview": "# Number of days of inactivity before an issue becomes stale\ndaysUntilStale: 30\n# Number of days of inactivity before a "
},
{
"path": "nlohmann_json/.travis.yml",
"chars": 8033,
"preview": "#########################\n# project configuration #\n#########################\n\n# C++ project\nlanguage: cpp\n\ndist: trusty"
},
{
"path": "nlohmann_json/CMakeLists.txt",
"chars": 3736,
"preview": "cmake_minimum_required(VERSION 3.8)\n\n##\n## PROJECT\n## name and version\n##\nproject(nlohmann_json VERSION 3.5.0 LANGUAGES "
},
{
"path": "nlohmann_json/CODE_OF_CONDUCT.md",
"chars": 3213,
"preview": "# Contributor Covenant Code of Conduct\n\n## Our Pledge\n\nIn the interest of fostering an open and welcoming environment, w"
},
{
"path": "nlohmann_json/ChangeLog.md",
"chars": 140272,
"preview": "# Change Log\nAll notable changes to this project will be documented in this file. This project adheres to [Semantic Vers"
},
{
"path": "nlohmann_json/LICENSE.MIT",
"chars": 1076,
"preview": "MIT License \n\nCopyright (c) 2013-2018 Niels Lohmann\n\nPermission is hereby granted, free of charge, to any person obtaini"
},
{
"path": "nlohmann_json/Makefile",
"chars": 24869,
"preview": "# CMAKE generated file: DO NOT EDIT!\n# Generated by \"Unix Makefiles\" Generator, CMake Version 3.10\n\n# Default target exe"
},
{
"path": "nlohmann_json/README.md",
"chars": 69621,
"preview": "[](https://github.com/nlohman"
},
{
"path": "nlohmann_json/appveyor.yml",
"chars": 1737,
"preview": "version: '{build}'\n\nenvironment:\n matrix:\n - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015\n COMPILER: mingw\n "
},
{
"path": "nlohmann_json/cmake/config.cmake.in",
"chars": 710,
"preview": "include(FindPackageHandleStandardArgs)\nset(${CMAKE_FIND_PACKAGE_NAME}_CONFIG ${CMAKE_CURRENT_LIST_FILE})\nfind_package_ha"
},
{
"path": "nlohmann_json/include/nlohmann/adl_serializer.hpp",
"chars": 1505,
"preview": "#pragma once\n\n#include <utility>\n\n#include <nlohmann/detail/conversions/from_json.hpp>\n#include <nlohmann/detail/convers"
},
{
"path": "nlohmann_json/include/nlohmann/detail/conversions/from_json.hpp",
"chars": 13609,
"preview": "#pragma once\n\n#include <algorithm> // transform\n#include <array> // array\n#include <ciso646> // and, not\n#include <forwa"
},
{
"path": "nlohmann_json/include/nlohmann/detail/conversions/to_chars.hpp",
"chars": 36758,
"preview": "#pragma once\n\n#include <cassert> // assert\n#include <ciso646> // or, and, not\n#include <cmath> // signbit, isfinite\n#i"
},
{
"path": "nlohmann_json/include/nlohmann/detail/conversions/to_json.hpp",
"chars": 11375,
"preview": "#pragma once\n\n#include <ciso646> // or, and, not\n#include <iterator> // begin, end\n#include <tuple> // tuple, get\n#inclu"
},
{
"path": "nlohmann_json/include/nlohmann/detail/exceptions.hpp",
"chars": 20968,
"preview": "#pragma once\n\n#include <exception> // exception\n#include <stdexcept> // runtime_error\n#include <string> // to_string\n\n#i"
},
{
"path": "nlohmann_json/include/nlohmann/detail/input/binary_reader.hpp",
"chars": 60047,
"preview": "#pragma once\n\n#include <algorithm> // generate_n\n#include <array> // array\n#include <cassert> // assert\n#include <cmath>"
},
{
"path": "nlohmann_json/include/nlohmann/detail/input/input_adapters.hpp",
"chars": 14507,
"preview": "#pragma once\n\n#include <cassert> // assert\n#include <cstddef> // size_t\n#include <cstring> // strlen\n#include <istream> "
},
{
"path": "nlohmann_json/include/nlohmann/detail/input/json_sax.hpp",
"chars": 20170,
"preview": "#pragma once\n\n#include <cstddef>\n#include <string>\n#include <vector>\n\n#include <nlohmann/detail/input/parser.hpp>\n#inclu"
},
{
"path": "nlohmann_json/include/nlohmann/detail/input/lexer.hpp",
"chars": 48812,
"preview": "#pragma once\n\n#include <clocale> // localeconv\n#include <cstddef> // size_t\n#include <cstdlib> // strtof, strtod, strtol"
},
{
"path": "nlohmann_json/include/nlohmann/detail/input/parser.hpp",
"chars": 19070,
"preview": "#pragma once\n\n#include <cassert> // assert\n#include <cmath> // isfinite\n#include <cstdint> // uint8_t\n#include <function"
},
{
"path": "nlohmann_json/include/nlohmann/detail/input/position_t.hpp",
"chars": 563,
"preview": "#pragma once\n\n#include <cstddef> // size_t\n\nnamespace nlohmann\n{\nnamespace detail\n{\n/// struct to capture the start posi"
},
{
"path": "nlohmann_json/include/nlohmann/detail/iterators/internal_iterator.hpp",
"chars": 720,
"preview": "#pragma once\n\n#include <nlohmann/detail/iterators/primitive_iterator.hpp>\n\nnamespace nlohmann\n{\nnamespace detail\n{\n/*!\n@"
},
{
"path": "nlohmann_json/include/nlohmann/detail/iterators/iter_impl.hpp",
"chars": 17751,
"preview": "#pragma once\n\n#include <ciso646> // not\n#include <iterator> // iterator, random_access_iterator_tag, bidirectional_itera"
},
{
"path": "nlohmann_json/include/nlohmann/detail/iterators/iteration_proxy.hpp",
"chars": 4941,
"preview": "#pragma once\n\n#include <cstddef> // size_t\n#include <string> // string, to_string\n#include <iterator> // input_iterator_"
},
{
"path": "nlohmann_json/include/nlohmann/detail/iterators/iterator_traits.hpp",
"chars": 1337,
"preview": "#pragma once\n\n#include <iterator> // random_access_iterator_tag\n\n#include <nlohmann/detail/meta/void_t.hpp>\n#include <nl"
},
{
"path": "nlohmann_json/include/nlohmann/detail/iterators/json_reverse_iterator.hpp",
"chars": 3467,
"preview": "#pragma once\n\n#include <cstddef> // ptrdiff_t\n#include <iterator> // reverse_iterator\n#include <utility> // declval\n\nnam"
},
{
"path": "nlohmann_json/include/nlohmann/detail/iterators/primitive_iterator.hpp",
"chars": 2802,
"preview": "#pragma once\n\n#include <cstddef> // ptrdiff_t\n#include <limits> // numeric_limits\n\nnamespace nlohmann\n{\nnamespace detai"
},
{
"path": "nlohmann_json/include/nlohmann/detail/json_pointer.hpp",
"chars": 25364,
"preview": "#pragma once\n\n#include <cassert> // assert\n#include <numeric> // accumulate\n#include <string> // string\n#include <vector"
},
{
"path": "nlohmann_json/include/nlohmann/detail/json_ref.hpp",
"chars": 1673,
"preview": "#pragma once\n\n#include <initializer_list>\n#include <utility>\n\n#include <nlohmann/detail/meta/type_traits.hpp>\n\nnamespace"
},
{
"path": "nlohmann_json/include/nlohmann/detail/macro_scope.hpp",
"chars": 6492,
"preview": "#pragma once\n\n// This file contains all internal macro definitions\n// You MUST include macro_unscope.hpp at the end of j"
},
{
"path": "nlohmann_json/include/nlohmann/detail/macro_unscope.hpp",
"chars": 494,
"preview": "#pragma once\n\n// restore GCC/clang diagnostic settings\n#if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__)\n"
},
{
"path": "nlohmann_json/include/nlohmann/detail/meta/cpp_future.hpp",
"chars": 1862,
"preview": "#pragma once\n\n#include <ciso646> // not\n#include <cstddef> // size_t\n#include <type_traits> // conditional, enable_if, f"
},
{
"path": "nlohmann_json/include/nlohmann/detail/meta/detected.hpp",
"chars": 1626,
"preview": "#pragma once\n\n#include <type_traits>\n\n#include <nlohmann/detail/meta/void_t.hpp>\n\n// http://en.cppreference.com/w/cpp/ex"
},
{
"path": "nlohmann_json/include/nlohmann/detail/meta/is_sax.hpp",
"chars": 6094,
"preview": "#pragma once\n\n#include <cstdint> // size_t\n#include <utility> // declval\n\n#include <nlohmann/detail/meta/detected.hpp>\n#"
},
{
"path": "nlohmann_json/include/nlohmann/detail/meta/type_traits.hpp",
"chars": 13233,
"preview": "#pragma once\n\n#include <ciso646> // not\n#include <limits> // numeric_limits\n#include <type_traits> // false_type, is_con"
},
{
"path": "nlohmann_json/include/nlohmann/detail/meta/void_t.hpp",
"chars": 246,
"preview": "#pragma once\n\nnamespace nlohmann\n{\nnamespace detail\n{\ntemplate <typename ...Ts> struct make_void\n{\n using type = void"
},
{
"path": "nlohmann_json/include/nlohmann/detail/output/binary_writer.hpp",
"chars": 48215,
"preview": "#pragma once\n\n#include <algorithm> // reverse\n#include <array> // array\n#include <cstdint> // uint8_t, uint16_t, uint32_"
},
{
"path": "nlohmann_json/include/nlohmann/detail/output/output_adapters.hpp",
"chars": 2976,
"preview": "#pragma once\n\n#include <algorithm> // copy\n#include <cstddef> // size_t\n#include <ios> // streamsize\n#include <iterator>"
},
{
"path": "nlohmann_json/include/nlohmann/detail/output/serializer.hpp",
"chars": 28878,
"preview": "#pragma once\n\n#include <algorithm> // reverse, remove, fill, find, none_of\n#include <array> // array\n#include <cassert> "
},
{
"path": "nlohmann_json/include/nlohmann/detail/value_t.hpp",
"chars": 2790,
"preview": "#pragma once\n\n#include <array> // array\n#include <ciso646> // and\n#include <cstddef> // size_t\n#include <cstdint> // uin"
},
{
"path": "nlohmann_json/include/nlohmann/json.hpp",
"chars": 289798,
"preview": "/*\n __ _____ _____ _____\n __| | __| | | | JSON for Modern C++\n| | |__ | | | | | | version 3.5.0\n|___"
},
{
"path": "nlohmann_json/include/nlohmann/json_fwd.hpp",
"chars": 1780,
"preview": "#ifndef NLOHMANN_JSON_FWD_HPP\n#define NLOHMANN_JSON_FWD_HPP\n\n#include <cstdint> // int64_t, uint64_t\n#include <map> // m"
},
{
"path": "nlohmann_json/meson.build",
"chars": 517,
"preview": "project('nlohmann_json',\n 'cpp',\n version : '3.5.0',\n license : 'MIT',\n)\n\nnlohmann_json_dep = declare_dependenc"
},
{
"path": "nlohmann_json/nlohmann_json.natvis",
"chars": 2004,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<AutoVisualizer xmlns=\"http://schemas.microsoft.com/vstudio/debugger/natvis/2010\""
},
{
"path": "nlohmann_json/single_include/nlohmann/json.hpp",
"chars": 709995,
"preview": "/*\n __ _____ _____ _____\n __| | __| | | | JSON for Modern C++\n| | |__ | | | | | | version 3.5.0\n|___"
},
{
"path": "spdlog/async_logger.h",
"chars": 2894,
"preview": "//\n// Copyright(c) 2015 Gabi Melman.\n// Distributed under the MIT License (http://opensource.org/licenses/MIT)\n//\n\n#prag"
},
{
"path": "spdlog/common.h",
"chars": 5698,
"preview": "//\n// Copyright(c) 2015 Gabi Melman.\n// Distributed under the MIT License (http://opensource.org/licenses/MIT)\n//\n\n#prag"
},
{
"path": "spdlog/contrib/README.md",
"chars": 94,
"preview": "Please put here your contribs. Popular contribs will be moved to main tree after stablization\n"
},
{
"path": "spdlog/contrib/sinks/.gitignore",
"chars": 1,
"preview": "\n"
},
{
"path": "spdlog/contrib/sinks/step_file_sink.h",
"chars": 7285,
"preview": "#pragma once\n\n#include \"../../details/file_helper.h\"\n#include \"../../details/null_mutex.h\"\n#include \"../../fmt/fmt.h\"\n#i"
},
{
"path": "spdlog/details/async_log_helper.h",
"chars": 9246,
"preview": "//\n// Copyright(c) 2015 Gabi Melman.\n// Distributed under the MIT License (http://opensource.org/licenses/MIT)\n//\n\n// as"
},
{
"path": "spdlog/details/async_logger_impl.h",
"chars": 3242,
"preview": "//\n// Copyright(c) 2015 Gabi Melman.\n// Distributed under the MIT License (http://opensource.org/licenses/MIT)\n//\n\n#prag"
},
{
"path": "spdlog/details/file_helper.h",
"chars": 3881,
"preview": "//\n// Copyright(c) 2015 Gabi Melman.\n// Distributed under the MIT License (http://opensource.org/licenses/MIT)\n//\n\n#prag"
},
{
"path": "spdlog/details/log_msg.h",
"chars": 1066,
"preview": "//\n// Copyright(c) 2015 Gabi Melman.\n// Distributed under the MIT License (http://opensource.org/licenses/MIT)\n//\n\n#prag"
},
{
"path": "spdlog/details/logger_impl.h",
"chars": 8333,
"preview": "//\n// Copyright(c) 2015 Gabi Melman.\n// Distributed under the MIT License (http://opensource.org/licenses/MIT)\n//\n\n#prag"
},
{
"path": "spdlog/details/mpmc_blocking_q.h",
"chars": 2233,
"preview": "#pragma once\n\n//\n// Copyright(c) 2018 Gabi Melman.\n// Distributed under the MIT License (http://opensource.org/licenses/"
},
{
"path": "spdlog/details/null_mutex.h",
"chars": 683,
"preview": "//\n// Copyright(c) 2015 Gabi Melman.\n// Distributed under the MIT License (http://opensource.org/licenses/MIT)\n//\n\n#prag"
},
{
"path": "spdlog/details/os.h",
"chars": 10973,
"preview": "//\n// Copyright(c) 2015 Gabi Melman.\n// Distributed under the MIT License (http://opensource.org/licenses/MIT)\n//\n#pragm"
},
{
"path": "spdlog/details/pattern_formatter_impl.h",
"chars": 19567,
"preview": "//\n// Copyright(c) 2015 Gabi Melman.\n// Distributed under the MIT License (http://opensource.org/licenses/MIT)\n//\n\n#prag"
},
{
"path": "spdlog/details/registry.h",
"chars": 8082,
"preview": "//\n// Copyright(c) 2015 Gabi Melman.\n// Distributed under the MIT License (http://opensource.org/licenses/MIT)\n//\n\n#prag"
},
{
"path": "spdlog/details/spdlog_impl.h",
"chars": 10341,
"preview": "//\n// Copyright(c) 2015 Gabi Melman.\n// Distributed under the MIT License (http://opensource.org/licenses/MIT)\n//\n\n#prag"
},
{
"path": "spdlog/fmt/bundled/LICENSE.rst",
"chars": 1310,
"preview": "Copyright (c) 2012 - 2016, Victor Zverovich\n\nAll rights reserved.\n\nRedistribution and use in source and binary forms, wi"
},
{
"path": "spdlog/fmt/bundled/format.cc",
"chars": 15958,
"preview": "/*\n Formatting library for C++\n\n Copyright (c) 2012 - 2016, Victor Zverovich\n All rights reserved.\n\n Redistribution and "
},
{
"path": "spdlog/fmt/bundled/format.h",
"chars": 153344,
"preview": "/*\n Formatting library for C++\n\n Copyright (c) 2012 - 2016, Victor Zverovich\n All rights reserved.\n\n Redistribution and "
},
{
"path": "spdlog/fmt/bundled/ostream.cc",
"chars": 893,
"preview": "/*\n Formatting library for C++ - std::ostream support\n\n Copyright (c) 2012 - 2016, Victor Zverovich\n All rights reserved"
},
{
"path": "spdlog/fmt/bundled/ostream.h",
"chars": 3078,
"preview": "/*\n Formatting library for C++ - std::ostream support\n\n Copyright (c) 2012 - 2016, Victor Zverovich\n All rights reserved"
},
{
"path": "spdlog/fmt/bundled/posix.cc",
"chars": 6818,
"preview": "/*\n A C++ interface to POSIX functions.\n\n Copyright (c) 2012 - 2016, Victor Zverovich\n All rights reserved.\n\n For the li"
},
{
"path": "spdlog/fmt/bundled/posix.h",
"chars": 10599,
"preview": "/*\n A C++ interface to POSIX functions.\n\n Copyright (c) 2012 - 2016, Victor Zverovich\n All rights reserved.\n\n For the li"
},
{
"path": "spdlog/fmt/bundled/printf.cc",
"chars": 752,
"preview": "/*\n Formatting library for C++\n\n Copyright (c) 2012 - 2016, Victor Zverovich\n All rights reserved.\n\n For the license inf"
},
{
"path": "spdlog/fmt/bundled/printf.h",
"chars": 18852,
"preview": "/*\n Formatting library for C++\n\n Copyright (c) 2012 - 2016, Victor Zverovich\n All rights reserved.\n\n For the license inf"
},
{
"path": "spdlog/fmt/bundled/time.h",
"chars": 4378,
"preview": "/*\n Formatting library for C++ - time formatting\n\n Copyright (c) 2012 - 2016, Victor Zverovich\n All rights reserved.\n\n F"
},
{
"path": "spdlog/fmt/fmt.h",
"chars": 613,
"preview": "//\n// Copyright(c) 2016 Gabi Melman.\n// Distributed under the MIT License (http://opensource.org/licenses/MIT)\n//\n\n#prag"
},
{
"path": "spdlog/fmt/ostr.h",
"chars": 371,
"preview": "//\n// Copyright(c) 2016 Gabi Melman.\n// Distributed under the MIT License (http://opensource.org/licenses/MIT)\n//\n\n#prag"
},
{
"path": "spdlog/formatter.h",
"chars": 1205,
"preview": "//\n// Copyright(c) 2015 Gabi Melman.\n// Distributed under the MIT License (http://opensource.org/licenses/MIT)\n//\n\n#prag"
},
{
"path": "spdlog/logger.h",
"chars": 4729,
"preview": "//\n// Copyright(c) 2015 Gabi Melman.\n// Distributed under the MIT License (http://opensource.org/licenses/MIT)\n//\n\n#prag"
},
{
"path": "spdlog/sinks/android_sink.h",
"chars": 2277,
"preview": "//\n// Copyright(c) 2015 Gabi Melman.\n// Distributed under the MIT License (http://opensource.org/licenses/MIT)\n//\n\n#prag"
},
{
"path": "spdlog/sinks/ansicolor_sink.h",
"chars": 4415,
"preview": "//\n// Copyright(c) 2017 spdlog authors.\n// Distributed under the MIT License (http://opensource.org/licenses/MIT)\n//\n\n#p"
},
{
"path": "spdlog/sinks/base_sink.h",
"chars": 1112,
"preview": "//\n// Copyright(c) 2015 Gabi Melman.\n// Distributed under the MIT License (http://opensource.org/licenses/MIT)\n//\n\n#prag"
},
{
"path": "spdlog/sinks/dist_sink.h",
"chars": 1714,
"preview": "//\n// Copyright (c) 2015 David Schury, Gabi Melman\n// Distributed under the MIT License (http://opensource.org/licenses/"
},
{
"path": "spdlog/sinks/file_sinks.h",
"chars": 7782,
"preview": "//\n// Copyright(c) 2015 Gabi Melman.\n// Distributed under the MIT License (http://opensource.org/licenses/MIT)\n//\n\n#prag"
},
{
"path": "spdlog/sinks/msvc_sink.h",
"chars": 782,
"preview": "//\n// Copyright(c) 2016 Alexander Dalshov.\n// Distributed under the MIT License (http://opensource.org/licenses/MIT)\n//\n"
},
{
"path": "spdlog/sinks/null_sink.h",
"chars": 562,
"preview": "//\n// Copyright(c) 2015 Gabi Melman.\n// Distributed under the MIT License (http://opensource.org/licenses/MIT)\n//\n\n#prag"
},
{
"path": "spdlog/sinks/ostream_sink.h",
"chars": 1068,
"preview": "//\n// Copyright(c) 2015 Gabi Melman.\n// Distributed under the MIT License (http://opensource.org/licenses/MIT)\n//\n\n#prag"
},
{
"path": "spdlog/sinks/sink.h",
"chars": 936,
"preview": "//\n// Copyright(c) 2015 Gabi Melman.\n// Distributed under the MIT License (http://opensource.org/licenses/MIT)\n//\n\n#prag"
},
{
"path": "spdlog/sinks/stdout_sinks.h",
"chars": 1689,
"preview": "//\n// Copyright(c) 2015 Gabi Melman.\n// Distributed under the MIT License (http://opensource.org/licenses/MIT)\n//\n\n#prag"
},
{
"path": "spdlog/sinks/syslog_sink.h",
"chars": 2059,
"preview": "//\n// Copyright(c) 2015 Gabi Melman.\n// Distributed under the MIT License (http://opensource.org/licenses/MIT)\n//\n\n#prag"
},
{
"path": "spdlog/sinks/wincolor_sink.h",
"chars": 4373,
"preview": "//\n// Copyright(c) 2016 spdlog\n// Distributed under the MIT License (http://opensource.org/licenses/MIT)\n//\n\n#pragma onc"
},
{
"path": "spdlog/sinks/windebug_sink.h",
"chars": 498,
"preview": "//\n// Copyright(c) 2017 Alexander Dalshov.\n// Distributed under the MIT License (http://opensource.org/licenses/MIT)\n//\n"
},
{
"path": "spdlog/spdlog.h",
"chars": 8155,
"preview": "//\n// Copyright(c) 2015 Gabi Melman.\n// Distributed under the MIT License (http://opensource.org/licenses/MIT)\n//\n// spd"
},
{
"path": "spdlog/tweakme.h",
"chars": 6732,
"preview": "//\n// Copyright(c) 2015 Gabi Melman.\n// Distributed under the MIT License (http://opensource.org/licenses/MIT)\n//\n\n#prag"
},
{
"path": "src/application.cpp",
"chars": 23789,
"preview": "#include \"daqi/application.hpp\"\n\n#include <iostream>\n\nnamespace da4qi4\n{\n\nstatic char const* default_app_name = \"DAQI-AP"
},
{
"path": "src/client/connection_client.cpp",
"chars": 16182,
"preview": "#include \"daqi/client/connection_client.hpp\"\n\n#include \"daqi/utilities/asio_utilities.hpp\"\n\n#include <iostream>\n#include"
},
{
"path": "src/connection.cpp",
"chars": 22083,
"preview": "#include \"daqi/connection.hpp\"\n\n#include <ctime>\n#include <ostream>\n\n#include \"daqi/utilities/string_utilities.hpp\"\n\n#in"
},
{
"path": "src/context.cpp",
"chars": 15338,
"preview": "#include \"daqi/context.hpp\"\n\n#include <iterator>\n\n#include \"daqi/def/log_def.hpp\"\n#include \"daqi/connection.hpp\"\n#includ"
},
{
"path": "src/cookie.cpp",
"chars": 2833,
"preview": "#include \"daqi/cookie.hpp\"\n\n#include \"nlohmann/json.hpp\"\n#include \"daqi/utilities/string_utilities.hpp\"\n\nnamespace da4qi"
},
{
"path": "src/def/boost_def.cpp",
"chars": 114,
"preview": "#include \"daqi/def/boost_def.hpp\"\n\nnamespace da4qi4\n{\nboost::none_t NoneObject = boost::none;\n}//namsepace da4qi4\n"
},
{
"path": "src/def/def.cpp",
"chars": 160,
"preview": "#include \"daqi/def/def.hpp\"\n\nnamespace da4qi4\n{\n\nchar const* const the_daqi_name = \"da4qi4\";\nchar const* const the_daqi_"
},
{
"path": "src/def/json_def.cpp",
"chars": 10919,
"preview": "#include \"daqi/def/json_def.hpp\"\n\n#include <string>\n#include <vector>\n\nnamespace da4qi4\n{\n\nJson const theNullJson;\n\nname"
},
{
"path": "src/def/log_def.cpp",
"chars": 3872,
"preview": "#include \"daqi/def/log_def.hpp\"\n\n#include <iostream>\n\n#include \"spdlog/sinks/null_sink.h\"\n\n#include \"daqi/def/def.hpp\"\n#"
},
{
"path": "src/def/redis_def.cpp",
"chars": 215,
"preview": "#include \"daqi/def/redis_def.hpp\"\n\n#include <string>\n\nnamespace da4qi4\n{\n\nchar const* const redis_server_default_host = "
},
{
"path": "src/handler.cpp",
"chars": 2751,
"preview": "#include \"daqi/handler.hpp\"\n\nnamespace da4qi4\n{\n\nHandler theEmptyHandler;\n\nHandlerMethod _DELETE_ = HandlerMethod::DELET"
},
{
"path": "src/intercepter.cpp",
"chars": 114,
"preview": "#include \"daqi/intercepter.hpp\"\n\nnamespace da4qi4\n{\nnamespace Intercepter\n{\n\n} //Intercepter\n} //namespace da4qi4\n"
},
{
"path": "src/intercepters/session_redis.cpp",
"chars": 4389,
"preview": "#include \"daqi/intercepters/session_redis.hpp\"\n\n#include <ctime>\n#include <string>\n\n#include <boost/uuid/uuid_generators"
},
{
"path": "src/intercepters/static_file.cpp",
"chars": 5999,
"preview": "#include \"daqi/intercepters/static_file.hpp\"\n\n#include <fstream>\n\n#include \"daqi/application.hpp\"\n#include \"daqi/utiliti"
},
{
"path": "src/main_demo.cpp",
"chars": 2224,
"preview": "#include <iostream>\n\n#include \"daqi/da4qi4.hpp\"\n\n#include \"daqi/intercepters/static_file.hpp\"\n#include \"daqi/intercepter"
},
{
"path": "src/net-detail/net_detail_client.cpp",
"chars": 3715,
"preview": "#include \"daqi/net-detail/net_detail_client.hpp\"\n\nnamespace da4qi4\n{\nnamespace Client\n{\n\nnamespace net_detail\n{\n\nSocketB"
},
{
"path": "src/net-detail/net_detail_server.cpp",
"chars": 578,
"preview": "#include \"daqi/net-detail/net_detail_server.hpp\"\n\nnamespace da4qi4\n{\nnamespace net_detail\n{\n\nSocketInterface::~SocketInt"
},
{
"path": "src/redis-client/redis_buffer.cpp",
"chars": 483,
"preview": "#include \"daqi/redis-client/redis_buffer.hpp\"\n\nnamespace da4qi4\n{\n\nRedisBuffer::RedisBuffer(const char* ptr, size_t data"
},
{
"path": "src/redis-client/redis_client.cpp",
"chars": 13061,
"preview": "#include \"daqi/redis-client/redis_client.hpp\"\n\n#include <iostream>\n#include <functional>\n\n#include <boost/date_time/posi"
},
{
"path": "src/redis-client/redis_command.cpp",
"chars": 1432,
"preview": "#include \"daqi/redis-client/redis_command.hpp\"\n\n#include <cstring>\n#include <string>\n\n#include <boost/variant.hpp>\n\nname"
},
{
"path": "src/redis-client/redis_parser.cpp",
"chars": 12134,
"preview": "#include \"daqi/redis-client/redis_parser.hpp\"\n\n#include <cassert>\n#include <sstream>\n\nnamespace da4qi4\n{\n\nRedisParser::R"
}
]
// ... and 24 more files (download for full content)
About this extraction
This page contains the full source code of the d2school/da4qi4 GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 224 files (2.8 MB), approximately 734.1k tokens, and a symbol index with 2932 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.