|
@@ -3,7 +3,7 @@
|
|
|
* Company: Lynar Studios
|
|
|
* E-Mail: webmaster@lynarstudios.com
|
|
|
* Created: 2023-02-15
|
|
|
-* Changed: 2023-02-23
|
|
|
+* Changed: 2023-05-16
|
|
|
*
|
|
|
* */
|
|
|
|
|
@@ -33,6 +33,7 @@ using std::find_if;
|
|
|
using std::make_shared;
|
|
|
using std::reinterpret_pointer_cast;
|
|
|
using std::string;
|
|
|
+using std::string_view;
|
|
|
|
|
|
SectionPairDocument::SectionPairDocument() : Class("SectionPairDocument")
|
|
|
{}
|
|
@@ -52,7 +53,7 @@ void SectionPairDocument::clear()
|
|
|
this->sections.clear();
|
|
|
}
|
|
|
|
|
|
-section_pair_document_section_list_element SectionPairDocument::get(size_t _index)
|
|
|
+section_pair_document_section_list_element SectionPairDocument::get(size_t _index) const
|
|
|
{
|
|
|
section_pair_document_section_list_element element{};
|
|
|
IndexOutOfBoundsEvaluator{_index, this->sections.size()}.evaluate();
|
|
@@ -72,22 +73,22 @@ section_pair_document_section_list_element SectionPairDocument::get(size_t _inde
|
|
|
return element;
|
|
|
}
|
|
|
|
|
|
-section_pair_document_section_list_element SectionPairDocument::get(const section_pair_identifier &_sectionId)
|
|
|
+section_pair_document_section_list_element SectionPairDocument::get(const section_pair_identifier &_sectionId) const
|
|
|
{
|
|
|
return this->_get(_sectionId);
|
|
|
}
|
|
|
|
|
|
-size_t SectionPairDocument::getAmountOfSections()
|
|
|
+size_t SectionPairDocument::getAmountOfSections() const
|
|
|
{
|
|
|
return this->sections.size();
|
|
|
}
|
|
|
|
|
|
-string SectionPairDocument::getHeader()
|
|
|
+string SectionPairDocument::getHeader() const
|
|
|
{
|
|
|
return this->header;
|
|
|
}
|
|
|
|
|
|
-section_pair_document_section_list SectionPairDocument::getSectionList()
|
|
|
+section_pair_document_section_list SectionPairDocument::getSectionList() const
|
|
|
{
|
|
|
return this->sections;
|
|
|
}
|
|
@@ -103,7 +104,7 @@ byte_field SectionPairDocument::marshal()
|
|
|
return this->serializable->marshal();
|
|
|
}
|
|
|
|
|
|
-void SectionPairDocument::reserveNewLine(const string &_reservedNewLine)
|
|
|
+void SectionPairDocument::reserveNewLine(string_view _reservedNewLine)
|
|
|
{
|
|
|
this->reservedNewLine = _reservedNewLine;
|
|
|
}
|
|
@@ -136,13 +137,13 @@ void SectionPairDocument::_createSerializable()
|
|
|
this->serializable = make_shared<SerializableSectionPairDocument>(parameter);
|
|
|
}
|
|
|
|
|
|
-section_pair_document_section_list_element SectionPairDocument::_get(const section_pair_identifier &_sectionId)
|
|
|
+section_pair_document_section_list_element SectionPairDocument::_get(const section_pair_identifier &_sectionId) const
|
|
|
{
|
|
|
- const auto iterator = find_if(this->sections.begin(), this->sections.end(), [_sectionId](const section_pair_document_section_list_element &_section) { return _section->getSectionId() == _sectionId; });
|
|
|
+ const auto iterator = find_if(this->sections.begin(), this->sections.end(), [&_sectionId](const section_pair_document_section_list_element &_section) { return _section->getSectionId() == _sectionId; });
|
|
|
return iterator != this->sections.end() ? *iterator : nullptr;
|
|
|
}
|
|
|
|
|
|
bool SectionPairDocument::_hasSection(const section_pair_identifier &_identifier)
|
|
|
{
|
|
|
- return any_of(this->sections.begin(), this->sections.end(), [_identifier](const section_pair_document_section_list_element &_section) { return _section->getSectionId() == _identifier; });
|
|
|
+ return any_of(this->sections.begin(), this->sections.end(), [&_identifier](const section_pair_document_section_list_element &_section) { return _section->getSectionId() == _identifier; });
|
|
|
}
|