forked from Kistler-Group/sdbus-cpp
refactor: add nodiscard attribute for more functions
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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_;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user