Skip to content

Commit

Permalink
Merge branch 'main' into 41-missing-headers
Browse files Browse the repository at this point in the history
  • Loading branch information
liuzicheng1987 authored Dec 28, 2023
2 parents f031b35 + f597f5f commit 092f07f
Show file tree
Hide file tree
Showing 163 changed files with 525 additions and 482 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/code-checks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: code-checks

on: [ push, pull_request ]

jobs:
check-includes-are-relative:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- shell : bash
run: |
cd include
errors=0
for file in $(find . -name '*.hpp'); do
while read -r line; do
if [[ "$line" = "" ]]; then continue; fi
what=$(printf "$line" | sed -n 's/^.*"\(.*\)"\s*$/\1/p')
pushd $(dirname $(readlink -f "$file" )) > /dev/null
if ! [[ -e "$what" ]]; then
where=$(printf "$line" | grep -oP '^.*:[0-9]+')
echo Non-relative include of $what @ $where
((errors++))
fi
popd > /dev/null
done <<< $(grep -HnoP '#include ".*"' $file)
done
exit $errors
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,22 @@ To run the tests, do the following:
./build/tests/xml/reflect-cpp-xml-tests
```

## How to contribute

### Make sure includes are relative

In order for the library to be able to function header-only, we need internal includes to be relative and not depend on any externally set include directory.

That is, for example, if you are within any file in `rfl/internal`, prefer
```cpp
#include "to_ptr_named_tuple.hpp"
```
over
```cpp
#include "rfl/internal/to_ptr_named_tuple.hpp"
```
For further details and reasoning, please refer to [#30](https://github.com/getml/reflect-cpp/issues/30).

## Related projects

reflect-cpp was originally developed for [getml-community](https://github.com/getml/getml-community), the fastest open-source tool for feature engineering on relational data and time series. If you are interested in Data Science and/or Machine Learning, please check it out.
Expand Down
2 changes: 1 addition & 1 deletion include/rfl/AllOf.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef RFL_ALLOF_HPP_
#define RFL_ALLOF_HPP_

#include "rfl/Result.hpp"
#include "Result.hpp"

namespace rfl {

Expand Down
2 changes: 1 addition & 1 deletion include/rfl/AnyOf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <utility>
#include <vector>

#include "rfl/Result.hpp"
#include "Result.hpp"

namespace rfl {

Expand Down
4 changes: 2 additions & 2 deletions include/rfl/Attribute.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
#include <type_traits>
#include <utility>

#include "rfl/Literal.hpp"
#include "rfl/default.hpp"
#include "Literal.hpp"
#include "default.hpp"

namespace rfl {

Expand Down
6 changes: 3 additions & 3 deletions include/rfl/Field.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
#include <type_traits>
#include <utility>

#include "rfl/Literal.hpp"
#include "rfl/default.hpp"
#include "rfl/internal/StringLiteral.hpp"
#include "Literal.hpp"
#include "default.hpp"
#include "internal/StringLiteral.hpp"

namespace rfl {

Expand Down
6 changes: 3 additions & 3 deletions include/rfl/Literal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
#include <tuple>
#include <type_traits>

#include "rfl/Result.hpp"
#include "rfl/internal/StringLiteral.hpp"
#include "rfl/internal/VisitTree.hpp"
#include "Result.hpp"
#include "internal/StringLiteral.hpp"
#include "internal/VisitTree.hpp"

namespace rfl {

Expand Down
10 changes: 5 additions & 5 deletions include/rfl/NamedTuple.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
#include <type_traits>
#include <utility>

#include "rfl/Field.hpp"
#include "rfl/get.hpp"
#include "rfl/internal/StringLiteral.hpp"
#include "rfl/internal/find_index.hpp"
#include "rfl/internal/no_duplicate_field_names.hpp"
#include "Field.hpp"
#include "get.hpp"
#include "internal/StringLiteral.hpp"
#include "internal/find_index.hpp"
#include "internal/no_duplicate_field_names.hpp"

namespace rfl {

Expand Down
2 changes: 1 addition & 1 deletion include/rfl/OneOf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <utility>
#include <vector>

#include "rfl/Result.hpp"
#include "Result.hpp"

namespace rfl {

Expand Down
4 changes: 2 additions & 2 deletions include/rfl/Pattern.hpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#ifndef RFL_PATTERN_HPP_
#define RFL_PATTERN_HPP_

#include "rfl/PatternValidator.hpp"
#include "rfl/Validator.hpp"
#include "PatternValidator.hpp"
#include "Validator.hpp"

namespace rfl {

Expand Down
8 changes: 4 additions & 4 deletions include/rfl/PatternValidator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
#include <stdexcept>
#include <string>

#include "rfl/Literal.hpp"
#include "rfl/Result.hpp"
#include "rfl/internal/Memoization.hpp"
#include "rfl/internal/StringLiteral.hpp"
#include "Literal.hpp"
#include "Result.hpp"
#include "internal/Memoization.hpp"
#include "internal/StringLiteral.hpp"

namespace rfl {

Expand Down
6 changes: 3 additions & 3 deletions include/rfl/Rename.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
#include <type_traits>
#include <utility>

#include "rfl/Literal.hpp"
#include "rfl/default.hpp"
#include "rfl/internal/StringLiteral.hpp"
#include "Literal.hpp"
#include "default.hpp"
#include "internal/StringLiteral.hpp"

namespace rfl {

Expand Down
2 changes: 1 addition & 1 deletion include/rfl/Size.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef RFL_SIZE_HPP_
#define RFL_SIZE_HPP_

#include "rfl/Result.hpp"
#include "Result.hpp"

namespace rfl {

Expand Down
6 changes: 3 additions & 3 deletions include/rfl/TaggedUnion.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

#include <variant>

#include "rfl/define_literal.hpp"
#include "rfl/internal/StringLiteral.hpp"
#include "rfl/internal/tag_t.hpp"
#include "define_literal.hpp"
#include "internal/StringLiteral.hpp"
#include "internal/tag_t.hpp"

namespace rfl {

Expand Down
4 changes: 2 additions & 2 deletions include/rfl/Timestamp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
#include <stdexcept>
#include <string>

#include "rfl/Result.hpp"
#include "rfl/internal/StringLiteral.hpp"
#include "Result.hpp"
#include "internal/StringLiteral.hpp"

namespace rfl {

Expand Down
8 changes: 4 additions & 4 deletions include/rfl/Validator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
#include <type_traits>
#include <utility>

#include "rfl/AllOf.hpp"
#include "rfl/Result.hpp"
#include "rfl/internal/HasValidation.hpp"
#include "rfl/internal/StringLiteral.hpp"
#include "AllOf.hpp"
#include "Result.hpp"
#include "internal/HasValidation.hpp"
#include "internal/StringLiteral.hpp"

namespace rfl {

Expand Down
6 changes: 3 additions & 3 deletions include/rfl/as.hpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#ifndef RFL_AS_HPP_
#define RFL_AS_HPP_

#include "rfl/from_named_tuple.hpp"
#include "rfl/make_named_tuple.hpp"
#include "rfl/to_named_tuple.hpp"
#include "from_named_tuple.hpp"
#include "make_named_tuple.hpp"
#include "to_named_tuple.hpp"

namespace rfl {

Expand Down
2 changes: 1 addition & 1 deletion include/rfl/comparisons.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef RFL_COMPARISONS_HPP_
#define RFL_COMPARISONS_HPP_

#include "rfl/Result.hpp"
#include "Result.hpp"

namespace rfl {

Expand Down
4 changes: 2 additions & 2 deletions include/rfl/define_literal.hpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#ifndef RFL_DEFINELITERAL_HPP_
#define RFL_DEFINELITERAL_HPP_

#include "rfl/Literal.hpp"
#include "rfl/internal/define_literal.hpp"
#include "Literal.hpp"
#include "internal/define_literal.hpp"

namespace rfl {

Expand Down
4 changes: 2 additions & 2 deletions include/rfl/define_named_tuple.hpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#ifndef RFL_DEFINENAMEDTUPLE_HPP_
#define RFL_DEFINENAMEDTUPLE_HPP_

#include "rfl/NamedTuple.hpp"
#include "rfl/internal/define_named_tuple.hpp"
#include "NamedTuple.hpp"
#include "internal/define_named_tuple.hpp"

namespace rfl {

Expand Down
6 changes: 3 additions & 3 deletions include/rfl/define_tagged_union.hpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#ifndef RFL_DEFINETAGGEDUNION_HPP_
#define RFL_DEFINETAGGEDUNION_HPP_

#include "rfl/TaggedUnion.hpp"
#include "rfl/internal/StringLiteral.hpp"
#include "rfl/internal/define_tagged_union.hpp"
#include "TaggedUnion.hpp"
#include "internal/StringLiteral.hpp"
#include "internal/define_tagged_union.hpp"

namespace rfl {

Expand Down
2 changes: 1 addition & 1 deletion include/rfl/define_variant.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include <variant>

#include "rfl/internal/define_variant.hpp"
#include "internal/define_variant.hpp"

namespace rfl {

Expand Down
8 changes: 4 additions & 4 deletions include/rfl/extract_discriminators.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@

#include <type_traits>

#include "rfl/TaggedUnion.hpp"
#include "rfl/define_literal.hpp"
#include "rfl/field_type.hpp"
#include "rfl/internal/extract_discriminators.hpp"
#include "TaggedUnion.hpp"
#include "define_literal.hpp"
#include "field_type.hpp"
#include "internal/extract_discriminators.hpp"

namespace rfl {

Expand Down
2 changes: 1 addition & 1 deletion include/rfl/field_names_t.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <functional>
#include <type_traits>

#include "rfl/internal/get_field_names.hpp"
#include "internal/get_field_names.hpp"

namespace rfl {

Expand Down
4 changes: 2 additions & 2 deletions include/rfl/field_type.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
#include <type_traits>
#include <variant>

#include "rfl/internal/StringLiteral.hpp"
#include "rfl/internal/field_type.hpp"
#include "internal/StringLiteral.hpp"
#include "internal/field_type.hpp"

namespace rfl {

Expand Down
4 changes: 2 additions & 2 deletions include/rfl/fields.hpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#ifndef RFL_FIELDS_HPP_
#define RFL_FIELDS_HPP_

#include "rfl/internal/get_meta_fields.hpp"
#include "rfl/named_tuple_t.hpp"
#include "internal/get_meta_fields.hpp"
#include "named_tuple_t.hpp"

namespace rfl {

Expand Down
14 changes: 7 additions & 7 deletions include/rfl/flexbuf.hpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#ifndef FLEXBUF_FLEXBUF_HPP_
#define FLEXBUF_FLEXBUF_HPP_

#include "rfl/flexbuf/Parser.hpp"
#include "rfl/flexbuf/Reader.hpp"
#include "rfl/flexbuf/Writer.hpp"
#include "rfl/flexbuf/load.hpp"
#include "rfl/flexbuf/read.hpp"
#include "rfl/flexbuf/save.hpp"
#include "rfl/flexbuf/write.hpp"
#include "flexbuf/Parser.hpp"
#include "flexbuf/Reader.hpp"
#include "flexbuf/Writer.hpp"
#include "flexbuf/load.hpp"
#include "flexbuf/read.hpp"
#include "flexbuf/save.hpp"
#include "flexbuf/write.hpp"

#endif
4 changes: 2 additions & 2 deletions include/rfl/flexbuf/OutputArray.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
#include <optional>
#include <string>

#include "rfl/Ref.hpp"
#include "rfl/flexbuf/OutputVar.hpp"
#include "../Ref.hpp"
#include "OutputVar.hpp"

namespace rfl {
namespace flexbuf {
Expand Down
4 changes: 2 additions & 2 deletions include/rfl/flexbuf/OutputNull.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
#include <optional>
#include <string>

#include "rfl/Ref.hpp"
#include "rfl/flexbuf/OutputVar.hpp"
#include "../Ref.hpp"
#include "OutputVar.hpp"

namespace rfl {
namespace flexbuf {
Expand Down
4 changes: 2 additions & 2 deletions include/rfl/flexbuf/OutputObject.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
#include <string>
#include <utility>

#include "rfl/Ref.hpp"
#include "rfl/flexbuf/OutputVar.hpp"
#include "../Ref.hpp"
#include "OutputVar.hpp"

namespace rfl {
namespace flexbuf {
Expand Down
6 changes: 3 additions & 3 deletions include/rfl/flexbuf/OutputValue.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
#include <string>
#include <utility>

#include "rfl/Ref.hpp"
#include "rfl/always_false.hpp"
#include "rfl/flexbuf/OutputVar.hpp"
#include "../Ref.hpp"
#include "../always_false.hpp"
#include "OutputVar.hpp"

namespace rfl {
namespace flexbuf {
Expand Down
Loading

0 comments on commit 092f07f

Please sign in to comment.