Skip to content

Commit 7d2bbef

Browse files
Add [[nodiscard]] attributes
1 parent 3c9f663 commit 7d2bbef

739 files changed

Lines changed: 6619 additions & 798 deletions

File tree

Some content is hidden

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

ActiveRecord/include/Poco/ActiveRecord/ActiveRecord.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ class ActiveRecordLib_API ActiveRecordBase: public Poco::RefCountedObject
3636
public:
3737
using Ptr = Poco::AutoPtr<ActiveRecordBase>;
3838

39+
[[nodiscard]]
3940
virtual std::string toString() const = 0;
4041
/// Returns a string representation of the object for
4142
/// debugging purposes. The default implementation returns the ID.
@@ -60,14 +61,17 @@ class ActiveRecordLib_API ActiveRecordBase: public Poco::RefCountedObject
6061
void detach();
6162
/// Detaches the object from its Context.
6263

64+
[[nodiscard]]
6365
Context::Ptr context() const;
6466
/// Returns the Context this object is attached to,
6567
/// or a null pointer if the object has not been
6668
/// attached to a Context.
6769

70+
[[nodiscard]]
6871
virtual bool isValid() const;
6972
/// Returns true iff the object is valid ID, otherwise false.
7073

74+
[[nodiscard]]
7175
bool isAttached() const;
7276
/// Returns true iff the object has been attached to a Context, otherwise false.
7377

ActiveRecord/include/Poco/ActiveRecord/Context.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,11 @@ class ActiveRecordLib_API Context: public Poco::RefCountedObject
4242
~Context() = default;
4343
/// Destroys the Context.
4444

45+
[[nodiscard]]
4546
Poco::Data::Session& session();
4647
/// Returns the database session.
4748

49+
[[nodiscard]]
4850
StatementPlaceholderProvider::Ptr statementPlaceholderProvider() const;
4951
/// Returns a new StatementPlaceholderProvider.
5052

ActiveRecord/include/Poco/ActiveRecord/IDTraits.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,13 @@ class IDTraits<Poco::UInt64>
4040
public:
4141
static constexpr Poco::UInt64 INVALID_ID = std::numeric_limits<Poco::UInt64>::max();
4242

43+
[[nodiscard]]
4344
static bool isValid(Poco::UInt64 id)
4445
{
4546
return id != INVALID_ID;
4647
}
4748

49+
[[nodiscard]]
4850
static std::string toString(Poco::UInt64 id)
4951
{
5052
return Poco::NumberFormatter::format(id);
@@ -58,11 +60,13 @@ class IDTraits<Poco::Int64>
5860
public:
5961
static constexpr Poco::Int64 INVALID_ID = std::numeric_limits<Poco::Int64>::max();
6062

63+
[[nodiscard]]
6164
static bool isValid(Poco::Int64 id)
6265
{
6366
return id != INVALID_ID;
6467
}
6568

69+
[[nodiscard]]
6670
static std::string toString(Poco::Int64 id)
6771
{
6872
return Poco::NumberFormatter::format(id);
@@ -76,11 +80,13 @@ class IDTraits<Poco::UInt32>
7680
public:
7781
static constexpr Poco::UInt32 INVALID_ID = std::numeric_limits<Poco::UInt32>::max();
7882

83+
[[nodiscard]]
7984
static bool isValid(Poco::UInt32 id)
8085
{
8186
return id != INVALID_ID;
8287
}
8388

89+
[[nodiscard]]
8490
static std::string toString(Poco::UInt32 id)
8591
{
8692
return Poco::NumberFormatter::format(id);
@@ -94,11 +100,13 @@ class IDTraits<Poco::Int32>
94100
public:
95101
static const Poco::Int32 INVALID_ID = std::numeric_limits<Poco::Int32>::max();
96102

103+
[[nodiscard]]
97104
static bool isValid(Poco::Int32 id)
98105
{
99106
return id != INVALID_ID;
100107
}
101108

109+
[[nodiscard]]
102110
static std::string toString(Poco::Int32 id)
103111
{
104112
return Poco::NumberFormatter::format(id);
@@ -112,11 +120,13 @@ class IDTraits<Poco::UInt16>
112120
public:
113121
static constexpr Poco::UInt16 INVALID_ID = std::numeric_limits<Poco::UInt16>::max();
114122

123+
[[nodiscard]]
115124
static bool isValid(Poco::UInt16 id)
116125
{
117126
return id != INVALID_ID;
118127
}
119128

129+
[[nodiscard]]
120130
static std::string toString(Poco::UInt16 id)
121131
{
122132
return Poco::NumberFormatter::format(id);
@@ -130,11 +140,13 @@ class IDTraits<Poco::Int16>
130140
public:
131141
static constexpr Poco::Int16 INVALID_ID = std::numeric_limits<Poco::Int16>::max();
132142

143+
[[nodiscard]]
133144
static bool isValid(Poco::Int16 id)
134145
{
135146
return id != INVALID_ID;
136147
}
137148

149+
[[nodiscard]]
138150
static std::string toString(Poco::Int16 id)
139151
{
140152
return Poco::NumberFormatter::format(id);
@@ -148,11 +160,13 @@ class IDTraits<std::string>
148160
public:
149161
static ActiveRecordLib_API const std::string INVALID_ID;
150162

163+
[[nodiscard]]
151164
static bool isValid(const std::string& id)
152165
{
153166
return !id.empty();
154167
}
155168

169+
[[nodiscard]]
156170
static std::string toString(const std::string& id)
157171
{
158172
return id;
@@ -166,11 +180,13 @@ class IDTraits<Poco::UUID>
166180
public:
167181
static ActiveRecordLib_API const Poco::UUID INVALID_ID;
168182

183+
[[nodiscard]]
169184
static bool isValid(const Poco::UUID& id)
170185
{
171186
return !id.isNull();
172187
}
173188

189+
[[nodiscard]]
174190
static std::string toString(const Poco::UUID& id)
175191
{
176192
return id.toString();

ActiveRecord/include/Poco/ActiveRecord/Query.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ class Query
117117
return *this;
118118
}
119119

120+
[[nodiscard]]
120121
std::vector<typename ActRec::Ptr> execute()
121122
/// Execute the query and return a vector with the
122123
/// results.
@@ -148,6 +149,7 @@ class Query
148149
return result;
149150
}
150151

152+
[[nodiscard]]
151153
std::size_t totalResults() const
152154
/// In case of a paged query, returns the total number of results
153155
/// that would be returned without paging.

ActiveRecord/include/Poco/ActiveRecord/StatementPlaceholderProvider.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ class ActiveRecordLib_API StatementPlaceholderProvider
3131
using Ptr = std::unique_ptr<StatementPlaceholderProvider>;
3232

3333
virtual void reset() = 0;
34+
35+
[[nodiscard]]
3436
virtual std::string next() = 0;
3537

3638
virtual ~StatementPlaceholderProvider();
@@ -41,6 +43,8 @@ class ActiveRecordLib_API DefaultStatementPlaceholderProvider: public StatementP
4143
{
4244
public:
4345
void reset();
46+
47+
[[nodiscard]]
4448
std::string next();
4549
};
4650

@@ -49,6 +53,8 @@ class ActiveRecordLib_API PostgresStatementPlaceholderProvider: public Statement
4953
{
5054
public:
5155
void reset();
56+
57+
[[nodiscard]]
5258
std::string next();
5359

5460
private:

ApacheConnector/include/ApacheApplication.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,11 @@ class ApacheApplication: public Poco::Util::Application
3131
/// Initializes the application if called for the first
3232
/// time; does nothing in later calls.
3333

34+
[[nodiscard]]
3435
ApacheRequestHandlerFactory& factory();
3536
/// Returns the ApacheRequestHandlerFactory.
3637

38+
[[nodiscard]]
3739
static ApacheApplication& instance();
3840
/// Returns the application instance.
3941

ApacheConnector/include/ApacheConnector.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ class ApacheRequestRec
2626
ApacheRequestRec(request_rec* _pRec);
2727
/// Creates the ApacheRequestRec;
2828

29+
[[nodiscard]]
2930
bool haveRequestBody();
3031
/// Returns true if the request contains a body.
3132

@@ -56,6 +57,7 @@ class ApacheRequestRec
5657
/// Copies the request uri and header fields from the Apache request
5758
/// to the ApacheServerRequest.
5859

60+
[[nodiscard]]
5961
bool secure();
6062
/// Returns true if the request is using a secure
6163
/// connection. Returns false if no secure connection

ApacheConnector/include/ApacheRequestHandlerFactory.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,11 @@ class ApacheRequestHandlerFactory: public Poco::Net::HTTPRequestHandlerFactory
2828
~ApacheRequestHandlerFactory();
2929
/// Destructor of the ApacheRequestHandlerFactory
3030

31+
[[nodiscard]]
3132
Poco::Net::HTTPRequestHandler* createRequestHandler(const Poco::Net::HTTPServerRequest& request);
3233
/// Creates a new request handler for the given HTTP request.
3334

35+
[[nodiscard]]
3436
bool mustHandle(const std::string& uri);
3537
/// Returns 1 if the given uri must be handled by the
3638
/// poco_mapper module, 0 otherwise.

ApacheConnector/include/ApacheServerRequest.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,29 +35,36 @@ class ApacheServerRequest: public Poco::Net::HTTPServerRequest
3535
~ApacheServerRequest();
3636
/// Destroys the ApacheServerRequest.
3737

38+
[[nodiscard]]
3839
std::istream& stream();
3940
/// Returns the input stream for reading
4041
/// the request body.
4142
///
4243
/// The stream is valid until the HTTPServerRequest
4344
/// object is destroyed.
4445

46+
[[nodiscard]]
4547
bool expectContinue() const;
4648
/// Returns true if the client expects a
4749
/// 100 Continue response.
4850

51+
[[nodiscard]]
4952
const Poco::Net::SocketAddress& clientAddress() const;
5053
/// Returns the client's address.
5154

55+
[[nodiscard]]
5256
const Poco::Net::SocketAddress& serverAddress() const;
5357
/// Returns the server's address.
5458

59+
[[nodiscard]]
5560
const Poco::Net::HTTPServerParams& serverParams() const;
5661
/// Returns a reference to the server parameters.
5762

63+
[[nodiscard]]
5864
Poco::Net::HTTPServerResponse& response() const;
5965
/// Returns a reference to the associated response
6066

67+
[[nodiscard]]
6168
bool secure() const;
6269
/// Returns true if the request is using a secure
6370
/// connection. Returns false if no secure connection

ApacheConnector/include/ApacheServerResponse.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ class ApacheServerResponse: public Poco::Net::HTTPServerResponse
9898
/// and sets the "WWW-Authenticate" header field
9999
/// according to the given realm.
100100

101+
[[nodiscard]]
101102
bool sent() const;
102103
/// Returns true if the response (header) has been sent.
103104

0 commit comments

Comments
 (0)