FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
cppgraphqlgen/samples/validation/schema/PetObject.h at main · gitmodimo/cppgraphqlgen · GitHub
gitmodimo
cppgraphqlgen
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
cppgraphqlgen
/
samples
/
validation
/
schema
/
PetObject.h
Copy path
More file actions
More file actions
Latest commit
History
History
History
81 lines (61 loc) · 1.98 KB
Breadcrumbs
cppgraphqlgen
/
samples
/
validation
/
schema
/
PetObject.h
Copy path
File metadata and controls
81 lines (61 loc) · 1.98 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
//
Copyright (c) Microsoft Corporation. All rights reserved.
//
Licensed under the MIT License.
//
WARNING! Do not edit this file manually, your changes will be overwritten.
#
pragma
once
#
ifndef
PETOBJECT_H
#
define
PETOBJECT_H
#
include
"
ValidationSchema.h
"
namespace
graphql
::validation::object {
class
[[nodiscard]]
Pet
final
: public service::Object
{
private:
struct
[[nodiscard]]
Concept
{
virtual
~Concept
() =
default
;
[[nodiscard]]
virtual
service::TypeNames
getTypeNames
()
const
noexcept
=
0
;
[[nodiscard]]
virtual
service::ResolverMap
getResolvers
()
const
noexcept
=
0
;
virtual
void
beginSelectionSet
(
const
service::SelectionSetParams& params)
const
=
0
;
virtual
void
endSelectionSet
(
const
service::SelectionSetParams& params)
const
=
0
;
};
template
<
class
T
>
struct
[[nodiscard]]
Model
: Concept
{
Model
(std::shared_ptr<T>&& pimpl)
noexcept
: _pimpl {
std::move
(pimpl) }
{
}
[[nodiscard]]
service::TypeNames
getTypeNames
()
const
noexcept
final
{
return
_pimpl->
getTypeNames
();
}
[[nodiscard]]
service::ResolverMap
getResolvers
()
const
noexcept
final
{
return
_pimpl->
getResolvers
();
}
void
beginSelectionSet
(
const
service::SelectionSetParams& params)
const
final
{
_pimpl->
beginSelectionSet
(params);
}
void
endSelectionSet
(
const
service::SelectionSetParams& params)
const
final
{
_pimpl->
endSelectionSet
(params);
}
private:
const
std::shared_ptr<T> _pimpl;
};
Pet
(std::unique_ptr<
const
Concept>&& pimpl)
noexcept
;
void
beginSelectionSet
(
const
service::SelectionSetParams& params)
const
final
;
void
endSelectionSet
(
const
service::SelectionSetParams& params)
const
final
;
const
std::unique_ptr<
const
Concept> _pimpl;
public:
template
<
class
T
>
Pet
(std::shared_ptr<T> pimpl)
noexcept
: Pet { std::unique_ptr<
const
Concept> { std::make_unique<Model<T>>(
std::move
(pimpl)) } }
{
static_assert
(T::
template
implements<Pet>(),
"
Pet is not implemented
"
);
}
};
}
//
namespace graphql::validation::object
#
endif
//
PETOBJECT_H
Back
|
FazBrowse Home
|
New Git URL