ソースを参照

Add attributes to method prototypes

Patrick-Christopher Mattulat 1 年間 前
コミット
fecee8f146

+ 2 - 2
include/ls_std/boxing/Boolean.hpp

@@ -65,7 +65,7 @@ namespace ls::std::boxing
 
       // additional functionality
 
-      bool getValue() const;
+      [[nodiscard]] bool getValue() const;
       static bool XOR(const ls::std::boxing::Boolean &_leftExpression, const ls::std::boxing::Boolean &_rightExpression);
       static bool XOR(const ls::std::boxing::Boolean &_leftExpression, bool _rightExpression);
       static bool XOR(bool _leftExpression, const ls::std::boxing::Boolean &_rightExpression);
@@ -78,7 +78,7 @@ namespace ls::std::boxing
       const ::std::string FALSE_STRING = "false";
       const ::std::string TRUE_STRING = "true";
 
-      ::std::string _toString() const;
+      [[nodiscard]] ::std::string _toString() const;
   };
 }
 

+ 1 - 1
include/ls_std/boxing/Integer.hpp

@@ -99,7 +99,7 @@ namespace ls::std::boxing
 
       // additional functionality
 
-      int getValue() const;
+      [[nodiscard]] int getValue() const;
 
     private:
 

+ 1 - 1
include/ls_std/boxing/Long.hpp

@@ -100,7 +100,7 @@ namespace ls::std::boxing
 
       // additional functionality
 
-      ls::std::core::type::long_type getValue() const;
+      [[nodiscard]] ls::std::core::type::long_type getValue() const;
 
     private:
 

+ 3 - 3
include/ls_std/core/Version.hpp

@@ -31,9 +31,9 @@ namespace ls::std::core
 
       // other functionality
 
-      ls::std::core::type::version_type getMajorVersion() const;
-      ls::std::core::type::version_type getMinorVersion() const;
-      ls::std::core::type::version_type getPatchVersion() const;
+      [[nodiscard]] ls::std::core::type::version_type getMajorVersion() const;
+      [[nodiscard]] ls::std::core::type::version_type getMinorVersion() const;
+      [[nodiscard]] ls::std::core::type::version_type getPatchVersion() const;
       static bool isValid(const ::std::string &_versionString);
       void setMajorVersion(ls::std::core::type::version_type _major);
       void setMinorVersion(ls::std::core::type::version_type _minor);

+ 1 - 1
include/ls_std/core/exception/EventNotHandledException.hpp

@@ -20,7 +20,7 @@ namespace ls::std::core
 
       EventNotHandledException() = default;
 
-      const char *what() const noexcept override
+      [[nodiscard]] const char *what() const noexcept override
       {
         return "EventNotHandledException thrown - event was not handled - nothing happened!";
       };

+ 1 - 1
include/ls_std/core/exception/EventNotSubscribedException.hpp

@@ -20,7 +20,7 @@ namespace ls::std::core
 
       EventNotSubscribedException() = default;
 
-      const char *what() const noexcept override
+      [[nodiscard]] const char *what() const noexcept override
       {
         return "EventNotSubscribedException thrown - event was not subscribed!";
       };

+ 1 - 1
include/ls_std/core/exception/FileNotFoundException.hpp

@@ -23,7 +23,7 @@ namespace ls::std::core
 
       FileNotFoundException() = default;
 
-      const char *what() const noexcept override
+      [[nodiscard]] const char *what() const noexcept override
       {
         return "FileNotFoundException thrown - file not found!";
       };

+ 1 - 1
include/ls_std/core/exception/FileOperationException.hpp

@@ -21,7 +21,7 @@ namespace ls::std::core
 
       explicit FileOperationException() = default;
 
-      const char *what() const noexcept override
+      [[nodiscard]] const char *what() const noexcept override
       {
         return "FileOperationException thrown - file operation failed!";
       }

+ 1 - 1
include/ls_std/core/exception/IllegalArgumentException.hpp

@@ -20,7 +20,7 @@ namespace ls::std::core
 
       IllegalArgumentException() = default;
 
-      const char *what() const noexcept override
+      [[nodiscard]] const char *what() const noexcept override
       {
         return "IllegalArgumentException thrown - passed argument is not valid!";
       }

+ 10 - 10
include/ls_std/core/exception/IllegalArithmeticOperationException.hpp

@@ -3,7 +3,7 @@
  * Company:         Lynar Studios
  * E-Mail:          webmaster@lynarstudios.com
  * Created:         2020-08-07
- * Changed:         2022-07-01
+ * Changed:         2022-07-02
  *
  * */
 
@@ -14,17 +14,17 @@
 
 namespace ls::std::core
 {
-      class IllegalArithmeticOperationException : public ::std::exception
-      {
-        public:
+  class IllegalArithmeticOperationException : public ::std::exception
+  {
+    public:
 
-          IllegalArithmeticOperationException() = default;
+      IllegalArithmeticOperationException() = default;
 
-          const char *what() const noexcept override
-          {
-            return "IllegalArithmeticOperationException thrown - arithmetic operation is not allowed!";
-          }
-      };
+      [[nodiscard]] const char *what() const noexcept override
+      {
+        return "IllegalArithmeticOperationException thrown - arithmetic operation is not allowed!";
+      }
+  };
 }
 
 #endif

+ 1 - 1
include/ls_std/core/exception/IncompleteJsonException.hpp

@@ -20,7 +20,7 @@ namespace ls::std::core
 
       explicit IncompleteJsonException() = default;
 
-      const char *what() const noexcept override
+      [[nodiscard]] const char *what() const noexcept override
       {
         return "IncompleteJsonException thrown - this JSON string is incomplete.";
       }

+ 1 - 1
include/ls_std/core/exception/NullPointerException.hpp

@@ -20,7 +20,7 @@ namespace ls::std::core
 
       explicit NullPointerException() = default;
 
-      const char *what() const noexcept override
+      [[nodiscard]] const char *what() const noexcept override
       {
         return "NullPointerException thrown - reference is null!";
       }

+ 1 - 1
include/ls_std/logic/StateConnection.hpp

@@ -26,7 +26,7 @@ namespace ls::std::logic
 
       ls::std::core::type::state_connection_id getConnectionId();
       ls::std::core::type::state_id getStateId();
-      bool isPassable() const;
+      [[nodiscard]] bool isPassable() const;
       void setConnectionId(const ls::std::core::type::state_connection_id &_connectionId);
       void setStateId(const ls::std::core::type::state_id &_stateId);
       void updatePassCondition(bool _condition);

+ 3 - 3
include/ls_std/time/Date.hpp

@@ -32,14 +32,14 @@ namespace ls::std::time
 
       // additional functionality
 
-      bool after(const ls::std::time::Date &_foreignDate) const;
-      bool before(const ls::std::time::Date &_foreignDate) const;
+      [[nodiscard]] bool after(const ls::std::time::Date &_foreignDate) const;
+      [[nodiscard]] bool before(const ls::std::time::Date &_foreignDate) const;
       int getDay();
       int getHour();
       int getMinute();
       int getMonth();
       int getSecond();
-      time_t getTime() const;
+      [[nodiscard]] time_t getTime() const;
       int getYear();
       void setTime(time_t _timestamp);
       ::std::string toString();

+ 2 - 2
test/classes/event/Colour.hpp

@@ -3,7 +3,7 @@
  * Company:         Lynar Studios
  * E-Mail:          webmaster@lynarstudios.com
  * Created:         2022-05-14
- * Changed:         2022-05-14
+ * Changed:         2022-07-02
  *
  * */
 
@@ -21,7 +21,7 @@ namespace ls_std_event_test
       explicit Colour(const ::std::string &_value);
       ~Colour() override = default;
 
-      ::std::string getValue() const;
+      [[nodiscard]] ::std::string getValue() const;
 
     private: