Skip to content

Commit 45574c2

Browse files
committed
Mark type-erased classes as final and hold const Concept
1 parent 044bbde commit 45574c2

File tree

140 files changed

+351
-349
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

140 files changed

+351
-349
lines changed

doc/awaitable.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ specifically a type-erased `graphql::service::await_async` class in
88
[GraphQLService.h](../include/graphqlservice/GraphQLService.h):
99
```cpp
1010
// Type-erased awaitable.
11-
class await_async : public coro::suspend_always
11+
class await_async final
1212
{
1313
private:
1414
struct Concept
@@ -31,17 +31,17 @@ public:
3131

3232
// Default to immediate synchronous execution.
3333
await_async()
34-
: _pimpl { std::static_pointer_cast<Concept>(
34+
: _pimpl { std::static_pointer_cast<const Concept>(
3535
std::make_shared<Model<coro::suspend_never>>(std::make_shared<coro::suspend_never>())) }
3636
{
3737
}
3838

3939
// Implicitly convert a std::launch parameter used with std::async to an awaitable.
4040
await_async(std::launch launch)
4141
: _pimpl { ((launch & std::launch::async) == std::launch::async)
42-
? std::static_pointer_cast<Concept>(std::make_shared<Model<await_worker_thread>>(
42+
? std::static_pointer_cast<const Concept>(std::make_shared<Model<await_worker_thread>>(
4343
std::make_shared<await_worker_thread>()))
44-
: std::static_pointer_cast<Concept>(std::make_shared<Model<coro::suspend_never>>(
44+
: std::static_pointer_cast<const Concept>(std::make_shared<Model<coro::suspend_never>>(
4545
std::make_shared<coro::suspend_never>())) }
4646
{
4747
}

doc/json.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ to some other output mechanism, without building a single string buffer for the
4646
document in memory. For example, you might use this to write directly to a buffered IPC pipe
4747
or network connection:
4848
```cpp
49-
class Writer
49+
class Writer final
5050
{
5151
private:
5252
struct Concept
@@ -71,7 +71,7 @@ private:
7171
public:
7272
template <class T>
7373
Writer(std::unique_ptr<T> writer)
74-
: _concept { std::static_pointer_cast<Concept>(
74+
: _concept { std::static_pointer_cast<const Concept>(
7575
std::make_shared<Model<T>>(std::move(writer))) }
7676
{
7777
}

include/graphqlservice/GraphQLResponse.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ GRAPHQLRESPONSE_EXPORT IdType Value::release<IdType>();
269269

270270
using AwaitableValue = internal::Awaitable<Value>;
271271

272-
class Writer
272+
class Writer final
273273
{
274274
private:
275275
struct Concept
@@ -357,7 +357,7 @@ class Writer
357357
public:
358358
template <class T>
359359
Writer(std::unique_ptr<T> writer)
360-
: _concept { std::static_pointer_cast<Concept>(
360+
: _concept { std::static_pointer_cast<const Concept>(
361361
std::make_shared<Model<T>>(std::move(writer))) }
362362
{
363363
}

include/graphqlservice/GraphQLService.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ struct await_worker_queue : coro::suspend_always
177177
};
178178

179179
// Type-erased awaitable.
180-
class await_async
180+
class await_async final
181181
{
182182
private:
183183
struct Concept

include/graphqlservice/introspection/DirectiveObject.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
namespace graphql::introspection::object {
1414

15-
class Directive
15+
class Directive final
1616
: public service::Object
1717
{
1818
private:
@@ -73,7 +73,7 @@ class Directive
7373
const std::shared_ptr<T> _pimpl;
7474
};
7575

76-
const std::unique_ptr<Concept> _pimpl;
76+
const std::unique_ptr<const Concept> _pimpl;
7777

7878
service::TypeNames getTypeNames() const noexcept;
7979
service::ResolverMap getResolvers() const noexcept;

include/graphqlservice/introspection/EnumValueObject.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
namespace graphql::introspection::object {
1414

15-
class EnumValue
15+
class EnumValue final
1616
: public service::Object
1717
{
1818
private:
@@ -66,7 +66,7 @@ class EnumValue
6666
const std::shared_ptr<T> _pimpl;
6767
};
6868

69-
const std::unique_ptr<Concept> _pimpl;
69+
const std::unique_ptr<const Concept> _pimpl;
7070

7171
service::TypeNames getTypeNames() const noexcept;
7272
service::ResolverMap getResolvers() const noexcept;

include/graphqlservice/introspection/FieldObject.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
namespace graphql::introspection::object {
1414

15-
class Field
15+
class Field final
1616
: public service::Object
1717
{
1818
private:
@@ -80,7 +80,7 @@ class Field
8080
const std::shared_ptr<T> _pimpl;
8181
};
8282

83-
const std::unique_ptr<Concept> _pimpl;
83+
const std::unique_ptr<const Concept> _pimpl;
8484

8585
service::TypeNames getTypeNames() const noexcept;
8686
service::ResolverMap getResolvers() const noexcept;

include/graphqlservice/introspection/InputValueObject.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
namespace graphql::introspection::object {
1414

15-
class InputValue
15+
class InputValue final
1616
: public service::Object
1717
{
1818
private:
@@ -66,7 +66,7 @@ class InputValue
6666
const std::shared_ptr<T> _pimpl;
6767
};
6868

69-
const std::unique_ptr<Concept> _pimpl;
69+
const std::unique_ptr<const Concept> _pimpl;
7070

7171
service::TypeNames getTypeNames() const noexcept;
7272
service::ResolverMap getResolvers() const noexcept;

include/graphqlservice/introspection/SchemaObject.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
namespace graphql::introspection::object {
1414

15-
class Schema
15+
class Schema final
1616
: public service::Object
1717
{
1818
private:
@@ -80,7 +80,7 @@ class Schema
8080
const std::shared_ptr<T> _pimpl;
8181
};
8282

83-
const std::unique_ptr<Concept> _pimpl;
83+
const std::unique_ptr<const Concept> _pimpl;
8484

8585
service::TypeNames getTypeNames() const noexcept;
8686
service::ResolverMap getResolvers() const noexcept;

include/graphqlservice/introspection/TypeObject.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
namespace graphql::introspection::object {
1414

15-
class Type
15+
class Type final
1616
: public service::Object
1717
{
1818
private:
@@ -108,7 +108,7 @@ class Type
108108
const std::shared_ptr<T> _pimpl;
109109
};
110110

111-
const std::unique_ptr<Concept> _pimpl;
111+
const std::unique_ptr<const Concept> _pimpl;
112112

113113
service::TypeNames getTypeNames() const noexcept;
114114
service::ResolverMap getResolvers() const noexcept;

0 commit comments

Comments
 (0)