Skip to content

Commit

Permalink
1.3.5 (#126)
Browse files Browse the repository at this point in the history
* Add common_iterator

* Update variant.hpp

* init common_view

* Update variant.hpp

* Add LOGXD

* Create memory.hpp

* Update logger.hpp

* Fix common_iterator

* Fix common_iterator

* Update common_iterator.hpp

* Add ranges::common_view, views::common

* Add ranges::rbegin

* Update rbegin

* Update rbegin.hpp

* Update rbegin.hpp

* Add is_class_or_enum

* Update not_incomplete_array.hpp

* Add ranges::rend

* Add ranges::reverse_view

* Update reverse_view.hpp

* Add is_subrange

* Add views::reverse

* Update ranges_test.cpp

* Update ranges_test.cpp

* Add ranges::join_with_view, views::join_with

* Fix error

* Update join_with_view.hpp

* Add concat_view

* Add concat_view

* Update concat_view.hpp

* Update concat_view.hpp

* Update ranges_test.cpp

* Update ranges_test.cpp

* Fix views::split

* Update concepts.hpp

* Update concat_view.hpp

* Update non_propagating_cache.hpp

* Add drop_while_view, drop_while

* Update drop_while_view.hpp

* Update concat

* Add tuple algorithm

* Update concat_view.hpp

* Update concat_view.hpp

* Fix common_reference

* Fix common_type

* Move maybe_const

* Update tuple_like.hpp

* Add key, value

* Add ranges:: lexicographical_compare

* Fix hard error of indirectly_readable

* Update basic_const_iterator.hpp

* Support ranges for type_support

* Fix unnecessary forwarding

* Add pointer_traits

* Add ranges::set_intersection

* Add ranges::set_intersection (#122)

* Create construct_at.hpp

* Create destroy_at.hpp

* Create destroy.hpp

* Update memory.hpp

* Create bad_expected_access.hpp

* Create unexpect.hpp

* Create global_stream_wrapper_settings.hpp

* Update stream_wrapper

* Update iomanip.hpp

* Update log_test.cpp

* Add ExpandArray iomanipulator

* Update stream_wrapper.hpp

* Update distance.hpp

* Update stream_wrapper.hpp

* Fix join_with

* Add different_from_this

* Update log_test.cpp

* Create range_adaptor.hpp

* Update drop.hpp

* Update drop_while.hpp

* Update filter.hpp

* Update filter_view.hpp

* Update iota_view.hpp

* Update join_with.hpp

* Update split.hpp

* Update take.hpp

* Update transform.hpp

* Update tuple_fold.hpp

* Move simple_view

* Add views::take_while

* Create as_const_pointer.hpp

* Create possibly_const_range.hpp

* Update possibly_const_range.hpp

* Create crbegin.hpp

* Add crend

* Add cdata

* Add output_range

* Fix cbegin

* Fix cend

* Create test-android.yml

* Update test-android.yml

* Add android test

* Update test-android.yml

* Update test-android.yml

* Update bad_expected_access.hpp

* Add expected

* Fix constexpr specifier

* Update expected.hpp

* Add comparison operator for expected

* Create test-emscripten.yml

* Fix cmake flags for Emscripten

* Update expected_test.cpp

* Update README.md
  • Loading branch information
lackhole authored Mar 29, 2024
1 parent 480bddd commit d4dbbdd
Show file tree
Hide file tree
Showing 65 changed files with 3,311 additions and 386 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/test-android.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Android

on:
push:
branches:
- '**'
- '!releases'

jobs:
build:
runs-on: [ self-hosted, linux, android-ndk ]
strategy:
matrix:
BUILD_TYPE: [Release, Debug]
fail-fast: false

steps:
- uses: actions/checkout@v2

- name: Configure CMake
run: >
cmake -B build
-DCMAKE_TOOLCHAIN_FILE=$ANDROID_HOME/ndk/21.1.6352462/build/cmake/android.toolchain.cmake
-DCMAKE_BUILD_TYPE=${{ matrix.BUILD_TYPE }}
-DVCCC_USE_OPENCV_FEATURES=OFF
-DVCCC_RUN_TEST=ON
- name: Build
run: cmake --build build --config ${{ matrix.BUILD_TYPE }} -- -j

# CTest not available
42 changes: 42 additions & 0 deletions .github/workflows/test-emscripten.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: WebAssembly

on:
push:
branches:
- '**'
- '!releases'

env:
BUILD_TYPE: Release
EMSDK_VERSION: 3.1.34

jobs:
build:
runs-on: [ self-hosted, unix ]

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16

- name: Install Emscripten
run: |
git clone https://github.com/emscripten-core/emsdk.git
cd emsdk
./emsdk install ${{ env.EMSDK_VERSION }}
./emsdk activate ${{ env.EMSDK_VERSION }}
- name: Configure CMake
run: |
source emsdk/emsdk_env.sh
emcmake cmake -B build -DCMAKE_CROSSCOMPILING_EMULATOR=node -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DVCCC_USE_OPENCV_FEATURES=OFF -DVCCC_RUN_TEST=ON
- name: Build
run: |
source emsdk/emsdk_env.sh
emmake cmake --build build --config ${{ env.BUILD_TYPE }} -- -j 4
- name: Test
working-directory: build
run: ctest -C ${{ env.BUILD_TYPE }} --extra-verbose --output-on-failure
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ message("VCCC_USE_OPENCV_FEATURES: ${VCCC_USE_OPENCV_FEATURES}")
MACRO(VCCC_TEST_ONE name target)
add_test(NAME ${name} COMMAND ${name})
add_executable(${name} ${target})
target_link_libraries(${name} PUBLIC ${ARGN})
if (EMSCRIPTEN)
target_link_libraries(${name} PUBLIC ${ARGN} -sEXIT_RUNTIME=1 -fexceptions)
else()
target_link_libraries(${name} PUBLIC ${ARGN})
endif()
ENDMACRO()

MACRO(VCCC_TEST_ONE_CXX name target cxx)
Expand Down
17 changes: 13 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,24 @@
![develop](https://github.com/visualcamp/vccc/actions/workflows/test-macos.yml/badge.svg?branch=main)
![develop](https://github.com/visualcamp/vccc/actions/workflows/test-ubuntu.yml/badge.svg?branch=main)
![develop](https://github.com/visualcamp/vccc/actions/workflows/test-windows.yml/badge.svg?branch=main)
![develop](https://github.com/visualcamp/vccc/actions/workflows/test-android.yml/badge.svg?branch=main)
![develop](https://github.com/visualcamp/vccc/actions/workflows/test-emscripten.yml/badge.svg?branch=main)

[![Deploy](https://github.com/visualcamp/vccc/actions/workflows/deploy-docs.yml/badge.svg)](https://github.com/visualcamp/vccc/actions/workflows/deploy-docs.yml)

# VisualCamp Common C++ library
## Features
* C++14 concepts library (up to C++23 standard)
* C++14 ranges library (up to C++26 standard)
* C++14 variant, optional, span, ... (up to C++26 standard)
* Compatible with existing STL
* algorithm library implemented in C++14 (up to C++23 standard)
* concepts library implemented in C++14 (up to C++23 standard)
* ranges library implemented in C++14 (up to C++26 standard)
* utility library implemented in c++14 (up to C++26 standard)
* `expected`
* `optional`
* `span`
* `variant`
* Other ~ C++26 libraries

#### All features are compatible with existing STL

## Examples
```c++
Expand Down
63 changes: 63 additions & 0 deletions include/log/include/vccc/__log/global_stream_wrapper_settings.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
//
// Created by YongGyu Lee on 3/22/24.
//

#ifndef VCCC_LOG_GLOBAL_STREAM_WRAPPER_SETTINGS_HPP_
#define VCCC_LOG_GLOBAL_STREAM_WRAPPER_SETTINGS_HPP_

namespace vccc {

/// @addtogroup log
/// @{

class GlobalStreamWrapperSettings {
public:
GlobalStreamWrapperSettings(const GlobalStreamWrapperSettings&) = delete;
GlobalStreamWrapperSettings(GlobalStreamWrapperSettings&&) = delete;
GlobalStreamWrapperSettings& operator=(const GlobalStreamWrapperSettings&) = delete;
GlobalStreamWrapperSettings& operator=(GlobalStreamWrapperSettings&&) = delete;

// Add quotation to strings (string and string_view)
static bool quote_string() {
return GetInstance().quote_string_;
}

static void quote_string(bool new_value) {
GetInstance().quote_string_ = new_value;
}

// Expand aggregate types (non-empty aggregate types)
static bool expand_aggregate() {
return GetInstance().expand_aggregate_;
}

static void expand_aggregate(bool new_value) {
GetInstance().expand_aggregate_ = new_value;
}

static bool expand_array() {
return GetInstance().expand_array_;
}

static void expand_array(bool new_value) {
GetInstance().expand_array_ = new_value;
}

private:
GlobalStreamWrapperSettings() = default;

static GlobalStreamWrapperSettings& GetInstance() {
static auto inst = new GlobalStreamWrapperSettings();
return *inst;
}

bool quote_string_ = false;
bool expand_aggregate_ = false;
bool expand_array_ = false;
};

/// @}

} // namespace vccc

#endif // VCCC_LOG_GLOBAL_STREAM_WRAPPER_SETTINGS_HPP_
56 changes: 56 additions & 0 deletions include/log/include/vccc/__log/iomanip.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,62 @@ class Separator : public StreamManipulator {
std::string sep_;
};

/// @brief Manipulator for adding quotation to strings(only to string and string_view)
class Quoted : public StreamManipulator {
public:
Quoted() : value_(true) {}

explicit Quoted(bool value) : value_(value) {}


template<typename CharT, typename String, typename Stream>
BasicStreamWrapper<CharT, String, Stream>& operator()(BasicStreamWrapper<CharT, String, Stream>& stream) const {
stream.quote_string(value_);
return stream;
}

private:
bool value_;
};

/// @brief Manipulator for expanding aggregate types
///
/// Note: empty aggregate will not be expanded
class ExpandAggregate : public StreamManipulator {
public:
ExpandAggregate() : value_(true) {}

explicit ExpandAggregate(bool value) : value_(value) {}

template<typename CharT, typename String, typename Stream>
BasicStreamWrapper<CharT, String, Stream>& operator()(BasicStreamWrapper<CharT, String, Stream>& stream) const {
stream.expand_aggregate(value_);
return stream;
}

private:
bool value_;
};

/// @brief Expand array instead of printing its value
///
/// Note: non-default-printable array is expanded by default
class ExpandArray : public StreamManipulator {
public:
ExpandArray() : value_(true) {}

explicit ExpandArray(bool value) : value_(value) {}

template<typename CharT, typename String, typename Stream>
BasicStreamWrapper<CharT, String, Stream>& operator()(BasicStreamWrapper<CharT, String, Stream>& stream) const {
stream.expand_array(value_);
return stream;
}

private:
bool value_;
};

//! @} log

} // namespace vccc
Expand Down
Loading

0 comments on commit d4dbbdd

Please sign in to comment.