refactor: add nodiscard attribute for more functions

This commit is contained in:
Stanislav Angelovič
2024-01-10 15:07:30 +01:00
parent 4b6fa20491
commit cda14c9702
9 changed files with 45 additions and 45 deletions
+3 -3
View File
@@ -55,17 +55,17 @@ namespace sdbus {
{
}
const std::string& getName() const
[[nodiscard]] const std::string& getName() const
{
return name_;
}
const std::string& getMessage() const
[[nodiscard]] const std::string& getMessage() const
{
return message_;
}
bool isValid() const
[[nodiscard]] bool isValid() const
{
return !getName().empty();
}
+7 -7
View File
@@ -74,21 +74,21 @@ namespace sdbus {
flags_.set(flag, value);
}
bool test(GeneralFlags flag) const
[[nodiscard]] bool test(GeneralFlags flag) const
{
return flags_.test(flag);
}
bool test(PropertyUpdateBehaviorFlags flag) const
[[nodiscard]] bool test(PropertyUpdateBehaviorFlags flag) const
{
return flags_.test(flag);
}
uint64_t toSdBusInterfaceFlags() const;
uint64_t toSdBusMethodFlags() const;
uint64_t toSdBusSignalFlags() const;
uint64_t toSdBusPropertyFlags() const;
uint64_t toSdBusWritablePropertyFlags() const;
[[nodiscard]] uint64_t toSdBusInterfaceFlags() const;
[[nodiscard]] uint64_t toSdBusMethodFlags() const;
[[nodiscard]] uint64_t toSdBusSignalFlags() const;
[[nodiscard]] uint64_t toSdBusPropertyFlags() const;
[[nodiscard]] uint64_t toSdBusWritablePropertyFlags() const;
private:
std::bitset<FLAG_COUNT> flags_;
+1 -1
View File
@@ -381,7 +381,7 @@ namespace sdbus {
*
* @deprecated This function has been replaced by getEventLoopPollData()
*/
[[deprecated("This function has been replaced by getEventLoopPollData()")]] PollData getProcessLoopPollData() const;
[[nodiscard]] [[deprecated("This function has been replaced by getEventLoopPollData()")]] PollData getProcessLoopPollData() const;
/*!
* @struct PollData
+1 -1
View File
@@ -488,7 +488,7 @@ namespace sdbus {
* Pending call in this context means a call whose results have not arrived, or
* have arrived and are currently being processed by the callback handler.
*/
bool isPending() const;
[[nodiscard]] bool isPending() const;
private:
friend internal::Proxy;
+2 -2
View File
@@ -256,7 +256,7 @@ namespace sdbus {
close();
}
int get() const
[[nodiscard]] int get() const
{
return fd_;
}
@@ -276,7 +276,7 @@ namespace sdbus {
return std::exchange(fd_, -1);
}
bool isValid() const
[[nodiscard]] bool isValid() const
{
return fd_ >= 0;
}