Browse Source

Make protected SectionPairRowValue class members private

Patrick-Christopher Mattulat 11 months ago
parent
commit
ac38352e93

+ 6 - 1
include/ls-std/io/section-pair/model/SectionPairRowValue.hpp

@@ -3,7 +3,7 @@
 * Company:         Lynar Studios
 * E-Mail:          webmaster@lynarstudios.com
 * Created:         2023-02-10
-* Changed:         2023-05-18
+* Changed:         2023-05-22
 *
 * */
 
@@ -31,6 +31,11 @@ namespace ls::std::io
 
     protected:
 
+      [[nodiscard]] ::std::string _getReservedNewLine() const;
+      [[nodiscard]] ls::std::io::SectionPairRowEnumType _getType() const;
+
+    private:
+
       ::std::string reservedNewLine{};
       ls::std::io::SectionPairRowEnumType type{};
   };

+ 4 - 4
source/ls-std/io/section-pair/model/SectionPairRowListValue.cpp

@@ -3,7 +3,7 @@
 * Company:         Lynar Studios
 * E-Mail:          webmaster@lynarstudios.com
 * Created:         2023-02-10
-* Changed:         2023-05-18
+* Changed:         2023-05-22
 *
 * */
 
@@ -78,7 +78,7 @@ size_t SectionPairRowListValue::getSize() const
 
 SectionPairRowEnumType SectionPairRowListValue::getType()
 {
-  return this->type;
+  return this->_getType();
 }
 
 byte_field SectionPairRowListValue::marshal()
@@ -98,9 +98,9 @@ void SectionPairRowListValue::_createSerializable()
   SerializableSectionPairParameter parameter{};
   parameter.setValue(shared_from_this());
 
-  if (!this->reservedNewLine.empty())
+  if (!this->_getReservedNewLine().empty())
   {
-    parameter.setNewLine(this->reservedNewLine);
+    parameter.setNewLine(this->_getReservedNewLine());
   }
 
   this->serializable = make_shared<SerializableSectionPairRowListValue>(parameter);

+ 5 - 5
source/ls-std/io/section-pair/model/SectionPairRowSingleValue.cpp

@@ -3,7 +3,7 @@
 * Company:         Lynar Studios
 * E-Mail:          webmaster@lynarstudios.com
 * Created:         2023-02-10
-* Changed:         2023-05-18
+* Changed:         2023-05-22
 *
 * */
 
@@ -42,7 +42,7 @@ section_pair_row_value SectionPairRowSingleValue::get() const
 
 SectionPairRowEnumType SectionPairRowSingleValue::getType()
 {
-  return this->type;
+  return this->_getType();
 }
 
 byte_field SectionPairRowSingleValue::marshal()
@@ -67,9 +67,9 @@ void SectionPairRowSingleValue::_createSerializable()
   SerializableSectionPairParameter parameter{};
   parameter.setValue(shared_from_this());
 
-  if (!this->reservedNewLine.empty())
+  if (!this->_getReservedNewLine().empty())
   {
-    parameter.setNewLine(this->reservedNewLine);
+    parameter.setNewLine(this->_getReservedNewLine());
   }
 
   this->serializable = make_shared<SerializableSectionPairRowSingleValue>(parameter);
@@ -79,7 +79,7 @@ void SectionPairRowSingleValue::_set(const section_pair_row_value &_value)
 {
   EmptyStringArgumentEvaluator{_value}.evaluate();
   SectionPairValueArgumentEvaluator(_value).evaluate();
-  string newLine = this->reservedNewLine.empty() ? NewLine::get() : this->reservedNewLine;
+  string newLine = this->_getReservedNewLine().empty() ? NewLine::get() : this->_getReservedNewLine();
   this->value = _value;
 
   if (this->value.find(newLine) != string::npos)

+ 11 - 1
source/ls-std/io/section-pair/model/SectionPairRowValue.cpp

@@ -3,7 +3,7 @@
 * Company:         Lynar Studios
 * E-Mail:          webmaster@lynarstudios.com
 * Created:         2023-02-10
-* Changed:         2023-05-18
+* Changed:         2023-05-22
 *
 * */
 
@@ -34,3 +34,13 @@ void SectionPairRowValue::unmarshal(const byte_field &_data)
 {
   // since this class is abstract, these methods are not implemented
 }
+
+string SectionPairRowValue::_getReservedNewLine() const
+{
+  return this->reservedNewLine;
+}
+
+SectionPairRowEnumType SectionPairRowValue::_getType() const
+{
+  return this->type;
+}