@@ -134,7 +134,8 @@ constexpr std::string_view strSubscription { "subscription"sv };
134
134
} // namespace keywords
135
135
136
136
// Resolvers may be called in multiple different Operation contexts.
137
- enum class [[nodiscard]] ResolverContext {
137
+ enum class [[nodiscard]] ResolverContext
138
+ {
138
139
// Resolving a Query operation.
139
140
Query,
140
141
@@ -197,7 +198,7 @@ class [[nodiscard]] await_async final
197
198
template <class T >
198
199
struct [[nodiscard]] Model : Concept
199
200
{
200
- Model (std::shared_ptr<T>&& pimpl)
201
+ explicit Model (std::shared_ptr<T> pimpl) noexcept
201
202
: _pimpl { std::move (pimpl) }
202
203
{
203
204
}
@@ -226,7 +227,7 @@ class [[nodiscard]] await_async final
226
227
public:
227
228
// Type-erased explicit constructor for a custom awaitable.
228
229
template <class T >
229
- explicit await_async (std::shared_ptr<T> pimpl)
230
+ explicit await_async (std::shared_ptr<T> pimpl) noexcept
230
231
: _pimpl { std::make_shared<Model<T>>(std::move (pimpl)) }
231
232
{
232
233
}
@@ -586,7 +587,8 @@ using ResolverMap = internal::string_view_map<Resolver>;
586
587
// GraphQL types are nullable by default, but they may be wrapped with non-null or list types.
587
588
// Since nullability is a more special case in C++, we invert the default and apply that modifier
588
589
// instead when the non-null wrapper is not present in that part of the wrapper chain.
589
- enum class [[nodiscard]] TypeModifier {
590
+ enum class [[nodiscard]] TypeModifier
591
+ {
590
592
None,
591
593
Nullable,
592
594
List,
@@ -598,11 +600,13 @@ concept OnlyNoneModifiers = (... && (Other == TypeModifier::None));
598
600
599
601
// Test if the next modifier is Nullable.
600
602
template <TypeModifier Modifier>
601
- concept NullableModifier = Modifier == TypeModifier::Nullable;
603
+ concept NullableModifier = Modifier ==
604
+ TypeModifier::Nullable;
602
605
603
606
// Test if the next modifier is List.
604
607
template <TypeModifier Modifier>
605
- concept ListModifier = Modifier == TypeModifier::List;
608
+ concept ListModifier = Modifier ==
609
+ TypeModifier::List;
606
610
607
611
// Convert arguments and input types with a non-templated static method.
608
612
template <typename Type>
@@ -634,12 +638,13 @@ namespace {
634
638
635
639
// These types are used as scalar arguments even though they are represented with a class.
636
640
template <typename Type>
637
- concept ScalarArgumentClass = std::is_same_v<Type, std::string> || std::is_same_v<Type,
638
- response::IdType> || std::is_same_v<Type, response::Value>;
641
+ concept ScalarArgumentClass = std::is_same_v<Type, std::string>
642
+ || std::is_same_v<Type, response::IdType> || std::is_same_v<Type, response::Value>;
639
643
640
644
// Any non-scalar class used in an argument is a generated INPUT_OBJECT type.
641
645
template <typename Type>
642
- concept InputArgumentClass = std::is_class_v<Type> && !ScalarArgumentClass<Type>;
646
+ concept InputArgumentClass = std::is_class_v<Type> && !
647
+ ScalarArgumentClass<Type>;
643
648
644
649
// Special-case an innermost nullable INPUT_OBJECT type.
645
650
template <typename Type, TypeModifier... Other>
@@ -710,8 +715,8 @@ struct ModifiedArgument
710
715
711
716
// Peel off the none modifier. If it's included, it should always be last in the list.
712
717
template <TypeModifier Modifier = TypeModifier::None, TypeModifier... Other>
713
- [[nodiscard]] static Type require (std::string_view name,
714
- const response::Value& arguments) requires OnlyNoneModifiers<Modifier, Other...>
718
+ [[nodiscard]] static Type require (std::string_view name, const response::Value& arguments)
719
+ requires OnlyNoneModifiers<Modifier, Other...>
715
720
{
716
721
static_assert (sizeof ...(Other) == 0 , " None modifier should always be last" );
717
722
@@ -722,7 +727,8 @@ struct ModifiedArgument
722
727
// Peel off nullable modifiers.
723
728
template <TypeModifier Modifier, TypeModifier... Other>
724
729
[[nodiscard]] static typename ArgumentTraits<Type, Modifier, Other...>::type require (
725
- std::string_view name, const response::Value& arguments) requires NullableModifier<Modifier>
730
+ std::string_view name, const response::Value& arguments)
731
+ requires NullableModifier<Modifier>
726
732
{
727
733
const auto & valueItr = arguments.find (name);
728
734
@@ -747,7 +753,8 @@ struct ModifiedArgument
747
753
// Peel off list modifiers.
748
754
template <TypeModifier Modifier, TypeModifier... Other>
749
755
[[nodiscard]] static typename ArgumentTraits<Type, Modifier, Other...>::type require (
750
- std::string_view name, const response::Value& arguments) requires ListModifier<Modifier>
756
+ std::string_view name, const response::Value& arguments)
757
+ requires ListModifier<Modifier>
751
758
{
752
759
const auto & values = arguments[name];
753
760
typename ArgumentTraits<Type, Modifier, Other...>::type result (values.size ());
@@ -784,8 +791,8 @@ struct ModifiedArgument
784
791
785
792
// Peel off the none modifier. If it's included, it should always be last in the list.
786
793
template <TypeModifier Modifier = TypeModifier::None, TypeModifier... Other>
787
- [[nodiscard]] static Type duplicate (
788
- const Type& value) requires OnlyNoneModifiers<Modifier, Other...>
794
+ [[nodiscard]] static Type duplicate (const Type& value)
795
+ requires OnlyNoneModifiers<Modifier, Other...>
789
796
{
790
797
// Just copy the value.
791
798
return Type { value };
@@ -794,8 +801,8 @@ struct ModifiedArgument
794
801
// Peel off nullable modifiers.
795
802
template <TypeModifier Modifier, TypeModifier... Other>
796
803
[[nodiscard]] static typename ArgumentTraits<Type, Modifier, Other...>::type duplicate (
797
- const typename ArgumentTraits<Type, Modifier, Other...>::type& nullableValue) requires
798
- NullableModifier<Modifier>
804
+ const typename ArgumentTraits<Type, Modifier, Other...>::type& nullableValue)
805
+ requires NullableModifier<Modifier>
799
806
{
800
807
typename ArgumentTraits<Type, Modifier, Other...>::type result {};
801
808
@@ -818,8 +825,8 @@ struct ModifiedArgument
818
825
// Peel off list modifiers.
819
826
template <TypeModifier Modifier, TypeModifier... Other>
820
827
[[nodiscard]] static typename ArgumentTraits<Type, Modifier, Other...>::type duplicate (
821
- const typename ArgumentTraits<Type, Modifier, Other...>::type& listValue) requires
822
- ListModifier<Modifier>
828
+ const typename ArgumentTraits<Type, Modifier, Other...>::type& listValue)
829
+ requires ListModifier<Modifier>
823
830
{
824
831
typename ArgumentTraits<Type, Modifier, Other...>::type result (listValue.size ());
825
832
@@ -943,7 +950,8 @@ concept ObjectType = std::is_same_v<Object, Type>;
943
950
944
951
// Test if this Type inherits from Object but is not Object itself.
945
952
template <typename Type>
946
- concept ObjectDerivedType = ObjectBaseType<Type> && !ObjectType<Type>;
953
+ concept ObjectDerivedType = ObjectBaseType<Type> && !
954
+ ObjectType<Type>;
947
955
948
956
// Test if a nullable type is std::shared_ptr<Type> or std::optional<T>.
949
957
template <typename Type, TypeModifier... Other>
@@ -957,7 +965,8 @@ concept NoneObjectDerivedType = OnlyNoneModifiers<Modifier> && ObjectDerivedType
957
965
// Test all other result types to see if they should call the specialized convert method without
958
966
// template parameters.
959
967
template <typename Type, TypeModifier Modifier>
960
- concept NoneScalarOrObjectType = OnlyNoneModifiers<Modifier> && !ObjectDerivedType<Type>;
968
+ concept NoneScalarOrObjectType = OnlyNoneModifiers<Modifier> && !
969
+ ObjectDerivedType<Type>;
961
970
962
971
// Test if this method should return a nullable std::shared_ptr<Type>
963
972
template <typename Type, TypeModifier Modifier, TypeModifier... Other>
@@ -1001,8 +1010,8 @@ struct ModifiedResult
1001
1010
// Peel off the none modifier. If it's included, it should always be last in the list.
1002
1011
template <TypeModifier Modifier = TypeModifier::None, TypeModifier... Other>
1003
1012
[[nodiscard]] static AwaitableResolver convert (
1004
- AwaitableObject<typename ResultTraits<Type>::type> result,
1005
- ResolverParams params) requires NoneObjectDerivedType<Type, Modifier>
1013
+ AwaitableObject<typename ResultTraits<Type>::type> result, ResolverParams params)
1014
+ requires NoneObjectDerivedType<Type, Modifier>
1006
1015
{
1007
1016
// Call through to the Object specialization with a static_pointer_cast for subclasses of
1008
1017
// Object.
@@ -1021,8 +1030,9 @@ struct ModifiedResult
1021
1030
1022
1031
// Peel off the none modifier. If it's included, it should always be last in the list.
1023
1032
template <TypeModifier Modifier = TypeModifier::None, TypeModifier... Other>
1024
- [[nodiscard]] static AwaitableResolver convert (typename ResultTraits<Type>::future_type result,
1025
- ResolverParams params) requires NoneScalarOrObjectType<Type, Modifier>
1033
+ [[nodiscard]] static AwaitableResolver convert (
1034
+ typename ResultTraits<Type>::future_type result, ResolverParams params)
1035
+ requires NoneScalarOrObjectType<Type, Modifier>
1026
1036
{
1027
1037
static_assert (sizeof ...(Other) == 0 , " None modifier should always be last" );
1028
1038
@@ -1033,8 +1043,8 @@ struct ModifiedResult
1033
1043
// Peel off final nullable modifiers for std::shared_ptr of Object and subclasses of Object.
1034
1044
template <TypeModifier Modifier, TypeModifier... Other>
1035
1045
[[nodiscard]] static AwaitableResolver convert (
1036
- typename ResultTraits<Type, Modifier, Other...>::future_type result,
1037
- ResolverParams params) requires NullableResultSharedPtr<Type, Modifier, Other...>
1046
+ typename ResultTraits<Type, Modifier, Other...>::future_type result, ResolverParams params)
1047
+ requires NullableResultSharedPtr<Type, Modifier, Other...>
1038
1048
{
1039
1049
co_await params.launch ;
1040
1050
@@ -1054,8 +1064,8 @@ struct ModifiedResult
1054
1064
// Peel off nullable modifiers for anything else, which should all be std::optional.
1055
1065
template <TypeModifier Modifier, TypeModifier... Other>
1056
1066
[[nodiscard]] static AwaitableResolver convert (
1057
- typename ResultTraits<Type, Modifier, Other...>::future_type result,
1058
- ResolverParams params) requires NullableResultOptional<Type, Modifier, Other...>
1067
+ typename ResultTraits<Type, Modifier, Other...>::future_type result, ResolverParams params)
1068
+ requires NullableResultOptional<Type, Modifier, Other...>
1059
1069
{
1060
1070
static_assert (std::is_same_v<std::optional<typename ResultTraits<Type, Other...>::type>,
1061
1071
typename ResultTraits<Type, Modifier, Other...>::type>,
@@ -1091,8 +1101,8 @@ struct ModifiedResult
1091
1101
// Peel off list modifiers.
1092
1102
template <TypeModifier Modifier, TypeModifier... Other>
1093
1103
[[nodiscard]] static AwaitableResolver convert (
1094
- typename ResultTraits<Type, Modifier, Other...>::future_type result,
1095
- ResolverParams params) requires ListModifier<Modifier>
1104
+ typename ResultTraits<Type, Modifier, Other...>::future_type result, ResolverParams params)
1105
+ requires ListModifier<Modifier>
1096
1106
{
1097
1107
if constexpr (!ObjectBaseType<Type>)
1098
1108
{
@@ -1192,8 +1202,8 @@ struct ModifiedResult
1192
1202
1193
1203
// Peel off the none modifier. If it's included, it should always be last in the list.
1194
1204
template <TypeModifier Modifier = TypeModifier::None, TypeModifier... Other>
1195
- static void validateScalar (
1196
- const response::Value& value) requires OnlyNoneModifiers<Modifier, Other...>
1205
+ static void validateScalar (const response::Value& value)
1206
+ requires OnlyNoneModifiers<Modifier, Other...>
1197
1207
{
1198
1208
static_assert (sizeof ...(Other) == 0 , " None modifier should always be last" );
1199
1209
@@ -1203,7 +1213,8 @@ struct ModifiedResult
1203
1213
1204
1214
// Peel off nullable modifiers.
1205
1215
template <TypeModifier Modifier, TypeModifier... Other>
1206
- static void validateScalar (const response::Value& value) requires NullableModifier<Modifier>
1216
+ static void validateScalar (const response::Value& value)
1217
+ requires NullableModifier<Modifier>
1207
1218
{
1208
1219
if (value.type () != response::Type::Null)
1209
1220
{
@@ -1213,7 +1224,8 @@ struct ModifiedResult
1213
1224
1214
1225
// Peel off list modifiers.
1215
1226
template <TypeModifier Modifier, TypeModifier... Other>
1216
- static void validateScalar (const response::Value& value) requires ListModifier<Modifier>
1227
+ static void validateScalar (const response::Value& value)
1228
+ requires ListModifier<Modifier>
1217
1229
{
1218
1230
if (value.type () != response::Type::List)
1219
1231
{
0 commit comments