Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
---
Checks: >
clang-diagnostic-*,
clang-analyzer-*,
misc-include-cleaner
CheckOptions:
misc-include-cleaner.MissingIncludes: false
SystemHeaders: false
HeaderFilterRegex: '^(?!.*(boost|_deps)).*$'
HeaderFilterRegex: "^(?!.*(boost|_deps)).*$"
FormatStyle: none
93 changes: 45 additions & 48 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ cmake_minimum_required(VERSION 3.29)
include(cmake/CPM.cmake)

# Add cpp-library for set version
# [DEPENDENCY] https://github.com/stlab/cpp-library
# CPMAddPackage(
# NAME cpp-library
# SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../cpp-library"
# )
CPMAddPackage("gh:stlab/cpp-library@5.2.0")
CPMAddPackage("gh:stlab/cpp-library@5.4.1")
include(${cpp-library_SOURCE_DIR}/cpp-library.cmake)

project(adobe-source-libraries CXX)
Expand All @@ -18,7 +19,7 @@ cpp_library_set_version()
include(FindGit)
include(CMakeParseArguments)

if (PROJECT_IS_TOP_LEVEL)
if(PROJECT_IS_TOP_LEVEL)
include(CTest)
endif()

Expand All @@ -30,7 +31,7 @@ endif()
# Dependencies

# https://github.com/stlab/copy-on-write/releases
CPMAddPackage("gh:stlab/copy-on-write@1.1.0")
CPMAddPackage("gh:stlab/copy-on-write@1.1.1")

# https://github.com/stlab/enum-ops/releases
CPMAddPackage(gh:stlab/enum-ops@1.2.0)
Expand All @@ -50,9 +51,9 @@ set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
# https://github.com/boostorg/boost/releases
CPMAddPackage(
NAME Boost
VERSION 1.90.0
URL https://github.com/boostorg/boost/releases/download/boost-1.90.0/boost-1.90.0-cmake.7z
URL_HASH SHA256=218e74c4aa362a994b7b7a23b2920f455a00205c656405fcf262cf60b8871921
VERSION 1.91.0-1
URL https://github.com/boostorg/boost/releases/download/boost-1.91.0-1/boost-1.91.0-1-cmake.7z
URL_HASH SHA256=29c7d4f4ac36ad853b6765d03571ea60d90286775df026b4efd9f3281131972b
OPTIONS
"BOOST_ENABLE_CMAKE ON"
"CMAKE_CXX_CLANG_TIDY ;"
Expand Down Expand Up @@ -85,45 +86,41 @@ option(BUILD_DOCS "Build documentation" OFF)

if(BUILD_DOCS)
find_package(Doxygen REQUIRED)

if(DOXYGEN_FOUND)
# Download doxygen-awesome-css theme via CPM
# https://github.com/jothepro/doxygen-awesome-css
CPMAddPackage(
URI gh:jothepro/doxygen-awesome-css@2.4.1
DOWNLOAD_ONLY YES
)
set(AWESOME_CSS_DIR ${doxygen-awesome-css_SOURCE_DIR})

# Configure Doxyfile
set(DOXYFILE_IN ${CMAKE_CURRENT_SOURCE_DIR}/documentation/doxyfile.in)
set(DOXYFILE_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)

# Set variables for Doxyfile template
set(PROJECT_NAME "Adobe Source Libraries")
set(PROJECT_BRIEF "A collection of C++ libraries.")
set(PROJECT_VERSION ${PROJECT_VERSION})
set(INPUT_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
set(OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}")
set(AWESOME_CSS_PATH "${AWESOME_CSS_DIR}")
set(CMAKE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")

configure_file(${DOXYFILE_IN} ${DOXYFILE_OUT} @ONLY)

# Add custom target for documentation
add_custom_target(docs
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYFILE_OUT}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating API documentation with Doxygen"
VERBATIM
)

# Ensure the output directory exists
file(MAKE_DIRECTORY ${OUTPUT_DIR})

message(STATUS "Documentation target 'docs' configured")
message(STATUS "Run 'cmake --build . --target docs' to generate documentation")
else()
message(WARNING "Doxygen not found. Documentation will not be built.")
endif()
endif()

# Download doxygen-awesome-css theme via CPM
# https://github.com/jothepro/doxygen-awesome-css
CPMAddPackage(
URI gh:jothepro/doxygen-awesome-css@2.4.2
DOWNLOAD_ONLY YES
)
set(AWESOME_CSS_DIR ${doxygen-awesome-css_SOURCE_DIR})

# Configure Doxyfile
set(DOXYFILE_IN ${CMAKE_CURRENT_SOURCE_DIR}/documentation/doxyfile.in)
set(DOXYFILE_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)

# Set variables for Doxyfile template
set(PROJECT_NAME "Adobe Source Libraries")
set(PROJECT_BRIEF "A collection of C++ libraries.")
set(PROJECT_VERSION ${PROJECT_VERSION})
set(INPUT_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
set(OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}")
set(AWESOME_CSS_PATH "${AWESOME_CSS_DIR}")
set(CMAKE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")

configure_file(${DOXYFILE_IN} ${DOXYFILE_OUT} @ONLY)

# Add custom target for documentation
add_custom_target(docs
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYFILE_OUT}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating API documentation with Doxygen"
VERBATIM
)

# Ensure the output directory exists
file(MAKE_DIRECTORY ${OUTPUT_DIR})

message(STATUS "Documentation target 'docs' configured")
message(STATUS "Run 'cmake --build . --target docs' to generate documentation")
endif()
4 changes: 2 additions & 2 deletions adobe/algorithm/equal_range.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,8 @@ equal_range(I& r, const T& x) {
template <typename I, // I models ForwardRange
typename T> // T == result_type(P)
inline std::pair<typename boost::range_const_iterator<I>::type,
typename boost::range_const_iterator<I>::type>
equal_range(const I& r, const T& x) {
typename boost::range_const_iterator<I>::type> equal_range(const I& r,
const T& x) {
return std::equal_range(boost::begin(r), boost::end(r), x);
}

Expand Down
4 changes: 0 additions & 4 deletions adobe/algorithm/exists.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@
#ifndef ADOBE_ALGORITHM_EXISTS_HPP
#define ADOBE_ALGORITHM_EXISTS_HPP

#include <adobe/config.hpp>

#include <algorithm>

/**************************************************************************************************/

namespace adobe {
Expand Down
2 changes: 0 additions & 2 deletions adobe/algorithm/fill.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
#ifndef ADOBE_ALGORITHM_FILL_HPP
#define ADOBE_ALGORITHM_FILL_HPP

#include <adobe/config.hpp>

#include <boost/range/begin.hpp>
#include <boost/range/end.hpp>

Expand Down
7 changes: 3 additions & 4 deletions adobe/algorithm/filter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,9 @@
#ifndef ADOBE_ALGORITHM_FILTER_HPP
#define ADOBE_ALGORITHM_FILTER_HPP

#include <adobe/config.hpp>

#include <boost/range/begin.hpp>
#include <boost/range/end.hpp>

#include <algorithm>
#include <functional>

/**************************************************************************************************/
Expand All @@ -25,7 +22,9 @@ namespace adobe {
\defgroup filter filter
\ingroup mutating_algorithm

Filter is similar to \c std::tranform. The \c op function is passed an instance of an [output_iterator](https://www.boost.org/sgi/stl/output_iterator.html) and can generate more than (or fewer than) a single result.
Filter is similar to \c std::transform. The \c op function is passed an instance of an
[output_iterator](https://www.boost.org/sgi/stl/output_iterator.html) and can generate more than (or
fewer than) a single result.

The \c op function is called once for each item in the range <code>[first, last)</code>. The \c
result parameter is passed into the first call to \c op, the result of \c op is passed to subsequent
Expand Down
75 changes: 1 addition & 74 deletions adobe/algorithm/find.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ namespace adobe {
- [STL documentation for find_if](https://www.boost.org/sgi/stl/find_if.html)
- [STL documentation for find_end](https://www.boost.org/sgi/stl/find_end.html)
- [STL documentation for find_first_of](https://www.boost.org/sgi/stl/find_first_of.html)
- find_first_of is a quadratic algorithm. Use find_if with is_member instead.
- [STL documentation for adjacent_find](https://www.boost.org/sgi/stl/adjacent_find.html)
*/

Expand Down Expand Up @@ -276,80 +277,6 @@ find_end(const ForwardRange1& range1, const ForwardRange2& range2, BinaryPredica
boost::end(range2), comp);
}

#if 0

// find_first_of is a bad algorithm. Use find_first_of_set until we provide a better predicate.

/*!
\ingroup find

\brief find implementation
*/
template <class InputRange, class ForwardRange>
inline typename boost::range_iterator<InputRange>::type
find_first_of(InputRange& range1, const ForwardRange& range2)
{
return std::find_first_of(boost::begin(range1), boost::end(range1),
boost::begin(range2), boost::end(range2));
}

/*!
\ingroup find

\brief find implementation
*/
template <class InputRange, class ForwardRange>
inline typename boost::range_const_iterator<InputRange>::type
find_first_of(const InputRange& range1, const ForwardRange& range2)
{
return std::find_first_of(boost::begin(range1), boost::end(range1),
boost::begin(range2), boost::end(range2));
}

/*!
\ingroup find

\brief find implementation
*/
template <class InputIterator, class ForwardIterator, class BinaryPredicate>
inline InputIterator find_first_of(InputIterator first1, InputIterator last1,
ForwardIterator first2, ForwardIterator last2,
BinaryPredicate comp)

{
return std::find_first_of(first1, last1, first2, last2, std::bind(comp, std::placeholders::_1, std::placeholders::_2));
}

/*!
\ingroup find

\brief find implementation
*/
template <class InputRange, class ForwardRange, class BinaryPredicate>
inline typename boost::range_iterator<InputRange>::type
find_first_of(InputRange& range1, const ForwardRange& range2, BinaryPredicate comp)
{
return adobe::find_first_of(boost::begin(range1), boost::end(range1),
boost::begin(range2), boost::end(range2),
comp);
}

/*!
\ingroup find

\brief find implementation
*/
template <class InputRange, class ForwardRange, class BinaryPredicate>
inline typename boost::range_const_iterator<InputRange>::type
find_first_of(const InputRange& range1, const ForwardRange& range2, BinaryPredicate comp)
{
return adobe::find_first_of(boost::begin(range1), boost::end(range1),
boost::begin(range2), boost::end(range2),
comp);
}

#endif

/*!
\ingroup find

Expand Down
2 changes: 0 additions & 2 deletions adobe/algorithm/iota.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
#include <boost/range/begin.hpp>
#include <boost/range/end.hpp>

#include <algorithm>

/**************************************************************************************************/

namespace adobe {
Expand Down
4 changes: 2 additions & 2 deletions adobe/algorithm/reduce.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@

#include <adobe/config.hpp>

#include <adobe/algorithm/find.hpp>
#include <adobe/algorithm/identity_element.hpp>
#include <adobe/algorithm/other_of.hpp>
#include <adobe/functional.hpp>
#include <adobe/iterator/type_functions.hpp>

#include <algorithm>
#include <functional>
#include <iterator>
#include <vector>

/**************************************************************************************************/
Expand Down
28 changes: 9 additions & 19 deletions adobe/algorithm/sorted.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
#include <boost/range/begin.hpp>
#include <boost/range/end.hpp>

#include <adobe/functional/operator.hpp>

/**************************************************************************************************/

namespace adobe {
Expand All @@ -34,10 +36,7 @@ template <typename I, // I models InputIterator
I sorted(I f, I l, O o) {

f = std::adjacent_find(
f, l,
[&o](const auto& first, const auto& next) {
return !std::invoke(o, first, next);
});
f, l, [&o](const auto& first, const auto& next) { return !std::invoke(o, first, next); });

if (f != l)
++f;
Expand All @@ -63,11 +62,9 @@ template <typename I, // I models InputIterator
typename O>
// O models StrictWeakOrdering on value_type(I)
inline bool is_sorted(I f, I l, O o) {
return std::adjacent_find(
f, l,
[&o](const auto& first, const auto& next) {
return !std::invoke(o, first, next);
}) == l;
return std::adjacent_find(f, l, [&o](const auto& first, const auto& next) {
return !std::invoke(o, first, next);
}) == l;
}

/**************************************************************************************************/
Expand All @@ -90,16 +87,9 @@ template <typename I, // I models ForwardIterator
typename P>
// P models UnaryFunction(value_type(I)) -> T
inline bool is_sorted(I f, I l, C c, P p) {
return std::adjacent_find(
f, l,
[&c, &p](const auto& first, const auto& next) {
return !std::invoke(
c,
std::invoke(p, first),
std::invoke(p, next)
);
}
) == l;
return std::adjacent_find(f, l, [&c, &p](const auto& first, const auto& next) {
return !std::invoke(c, std::invoke(p, first), std::invoke(p, next));
}) == l;
}

/**************************************************************************************************/
Expand Down
2 changes: 1 addition & 1 deletion adobe/array.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

#include <adobe/config.hpp>

#include <adobe/array_fwd.hpp>
#include <adobe/array_fwd.hpp> // IWYU pragma: export

#include <adobe/any_regular.hpp>

Expand Down
2 changes: 1 addition & 1 deletion adobe/dictionary.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

#include <adobe/config.hpp>

#include <adobe/dictionary_fwd.hpp>
#include <adobe/dictionary_fwd.hpp> // IWYU pragma: export

#include <stdexcept>

Expand Down
2 changes: 1 addition & 1 deletion adobe/enum_ops.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#ifndef ADOBE_ENUM_OPS_HPP
#define ADOBE_ENUM_OPS_HPP

#include <stlab/enum_ops.hpp>
#include <stlab/enum_ops.hpp> // IWYU pragma: export

/**************************************************************************************************/

Expand Down
Loading
Loading