feat/support_fiber #6

Merged
tqcq merged 52 commits from feat/support_fiber into master 2024-08-11 13:03:04 +08:00
11 changed files with 0 additions and 14677 deletions
Showing only changes of commit 0e93d0b1f3 - Show all commits

View File

@ -1,5 +0,0 @@
/build
/build_xcode
/build64
mustache
mustache14

View File

@ -1,26 +0,0 @@
language: cpp
sudo: required
dist: trusty
matrix:
include:
- os: linux
compiler: gcc
- os: linux
compiler: clang
- os: osx
compiler: clang
script:
- make coverage
after_success:
# Use "-X gcov" to disable Codecov from running gcov. We already run this
# command in "make coverage" and then delete unwanted coverage files that
# contribute falsely to the coverage report, such as catch.hpp
# Only send Linux (GCC) code coverage as the clang ones seem to be buggy and
# report curly braces as unexecuted lines.
- if [ "${TRAVIS_OS_NAME}" == "linux" ]; then bash <(curl -s https://codecov.io/bash) -X gcov; fi

View File

@ -1,19 +0,0 @@
cmake_minimum_required(VERSION 2.8)
project(mustache)
if (UNIX)
add_definitions(
-Wall
-Wextra
-Werror
-std=c++11
)
elseif (MSVC)
add_definitions(
/W3
/WX
)
endif()
add_executable(mustache
mustache.hpp # to show in IDE
tests.cpp
)

View File

@ -1,25 +0,0 @@
Boost Software License - Version 1.0
Copyright 2015-2020 Kevin Wojniak
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.

View File

@ -1,31 +0,0 @@
default:
g++ -O3 -Wall -Wextra -Werror -std=c++11 -o mustache tests.cpp
./mustache
mac:
clang++ -O3 -Wall -Wextra -Werror -std=c++11 -stdlib=libc++ -o mustache tests.cpp
./mustache
mac14:
clang++ -O3 -Wall -Wextra -Werror -std=c++14 -stdlib=libc++ -o mustache14 tests.cpp
./mustache14
clang:
clang++ -O3 -Wall -Wextra -Werror -std=c++11 -o mustache tests.cpp
# https://gcc.gnu.org/onlinedocs/gcc/Invoking-Gcov.html
coverage:
g++ -std=c++11 -coverage -O0 -o mustache tests.cpp
./mustache
gcov -l tests.cpp
# We only want coverage for mustache.hpp and tests.cpp, so delete all the other *.gcov files
find . -type f -name 'tests.cpp*.gcov' ! -name 'tests.cpp.gcov' ! -name 'tests.cpp##mustache.hpp.gcov' -delete
xcode:
mkdir -p build_xcode
cd build_xcode && cmake -GXcode ..
open build_xcode/*.xcodeproj
clean:
rm -rf mustache mustache14 build build_xcode
rm -rf *.gcov *.gcda *.gcno # coverage artifacts

View File

@ -1,125 +0,0 @@
# About
* [Mustache](http://mustache.github.io) implementation for modern C++ (requires C++11)
* Header only
* Zero dependencies
* Templated string type for compatibility with any STL-like string (std::string, std::wstring, etc)
* Boost license
[![travis](https://travis-ci.org/kainjow/Mustache.svg?branch=master)](https://travis-ci.org/kainjow/Mustache) [![appveyor](https://ci.appveyor.com/api/projects/status/6uh5d5weajrffkyw?svg=true)](https://ci.appveyor.com/project/kainjow/mustache) [![codecov](https://codecov.io/gh/kainjow/Mustache/branch/master/graph/badge.svg)](https://codecov.io/gh/kainjow/Mustache)
## Example usage
All examples assume `using namespace kainjow::mustache`. Additional examples and usage can be found in the `tests.cpp` file.
### Example 1 - Hello World
````cpp
mustache tmpl{"Hello {{what}}!"};
std::cout << tmpl.render({"what", "World"}) << std::endl;
// Hello World!
````
### Example 2 - Lists
````cpp
mustache tmpl{"{{#employees}}{{name}}, {{/employees}}"};
data employees{data::type::list};
employees << data{"name", "Steve"} << data{"name", "Bill"};
tmpl.render({"employees", employees}, std::cout);
// Steve, Bill,
````
### Example 3 - Custom Render Handler
````cpp
mustache tmpl("Hello {{what}}!");
std::stringstream ss;
tmpl.render({"what", "World"}, [&ss](const std::string& str) {
ss << str;
});
// ss.str() == "Hello World!"
````
## Supported Features
This library supports all current Mustache features:
- Variables
- HTML escaping
- Sections
- Inverted Sections
- True/False
- Lists
- Lambdas
- Partials
- Comments
- Set Delimiter
Additional features:
- Custom escape function for use outside of HTML
## Run Tests
For *nix:
make
For macOS:
make mac
For Visual Studio 2013 (CMake 2.8+ required):
build.bat
For Visual Studio 2015 (CMake 3.1+ required):
build.bat 14
## Release Notes
#### 4.1 - April 18, 2020
* Fixed incorrect results when using lambda renderers
#### 4.0 - October 28, 2019
* Lines with sections that result in an empty line are removed, per the Mustache spec.
#### 3.2.1 - July 22, 2018
* Add an overload to render() that accepts a context and a stream (thanks Kitsune Ral)
* Added checks for empty objects (thanks Snafuuz)
* Refactored parser in preparation for future changes
#### 3.2 - February 24, 2018
* Added ability to provide a custom escape function (thanks to Kitsune Ral)
* Allow `data.set()` to override an existing value
#### 3.1 - July 22, 2017
* Added a new lambda type (innovatively called `lambda2`) that takes an additional render function. It will not render its result but allows the user to call the `render` argument to render the section text, or any other text.
#### 3.0 - July 8, 2017
* Performance improvements - about 45% faster than version 2
* Even simpler API. Not backwards compatible but upgrading should be straightforward:
* Namespace, classes, and methods are now in snake case to match the STL. For example, `Kainjow::Mustache` is now `kainjow::mustache`
* Classes and aliases are now under a `mustache` namespace, instead of being under the mustache class
* Removed `Data::List()` - use `data{data::type::list}` instead
* Removed `Data::type()` - use the various `is_xxx` methods to identity the type
#### 2.0 - June 11, 2016
* New simpler API (not backwards compatible)
* std::wstring support
* Bug fixes (thanks to Shen-Ta Hsieh)
* Automated tests on OS X
* 100% test coverage
#### 1.0 - April 19, 2015
* All current Mustache features are implemented.

View File

@ -1,18 +0,0 @@
branches:
only:
- master
environment:
matrix:
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
CMAKE_GENERATOR: Visual Studio 12 Win64
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
CMAKE_GENERATOR: Visual Studio 14 Win64
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
CMAKE_GENERATOR: Visual Studio 15 Win64
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
CMAKE_GENERATOR: Visual Studio 16 2019
platform: x64
build_script:
- cmake -G "%CMAKE_GENERATOR%" .
- cmake --build . --config Release
- Release\mustache.exe

View File

@ -1,50 +0,0 @@
:: don't output commands
@echo off
:: get version from input args
:: default value is 12
:: only 12 and 14 are supported
set vers=%1
if "%vers%" == "" set vers=12
if "%vers%" neq "12" (
if "%vers%" neq "14" (
echo Invalid version "%vers%" - expected 12 or 14.
exit /b 1
)
)
:: make build directory
if not exist build mkdir build
pushd build
:: run CMake
cmake -G "Visual Studio %vers%" ..
if %errorlevel% neq 0 popd & exit /b %errorlevel%
:: build with CMake
cmake --build . --config Release
if %errorlevel% neq 0 popd & exit /b %errorlevel%
:: run tests
Release\mustache.exe
if %errorlevel% neq 0 popd & exit /b %errorlevel%
popd
:: make build64 directory
if not exist build64 mkdir build64
pushd build64
:: run CMake
cmake -G "Visual Studio %vers% Win64" ..
if %errorlevel% neq 0 popd & exit /b %errorlevel%
:: build with CMake
cmake --build . --config Release
if %errorlevel% neq 0 popd & exit /b %errorlevel%
:: run tests
Release\mustache.exe
if %errorlevel% neq 0 popd & exit /b %errorlevel%
popd

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff