refactor: Rewrite BehaviorMessage classes to use member initialization, preferred member naming conventions, and const-ref getters (#1456)

* Split out BehaviorMessage class changes from PR #1452

* remove <string_view> inclusion in ActionContext.h

* add the arguments nullptr check back in

* remove redundant std::string constructor calls

* Update AddStripMessage.cpp - change push_back to emplace_back
This commit is contained in:
jadebenn
2024-02-18 00:38:26 -06:00
committed by GitHub
parent c7b3d9e817
commit b6af92ef81
46 changed files with 362 additions and 341 deletions

View File

@@ -127,12 +127,12 @@ public:
/**
* Returns the Associative portion of the object
*/
[[nodiscard]] inline AMFAssociative& GetAssociative() noexcept { return this->associative; }
[[nodiscard]] inline const AMFAssociative& GetAssociative() const noexcept { return this->associative; }
/**
* Returns the dense portion of the object
*/
[[nodiscard]] inline AMFDense& GetDense() noexcept { return this->dense; }
[[nodiscard]] inline const AMFDense& GetDense() const noexcept { return this->dense; }
/**
* Inserts an AMFValue into the associative portion with the given key.
@@ -297,7 +297,7 @@ public:
if (!this->dense.empty()) Remove(this->dense.size() - 1);
}
[[nodiscard]] AMFArrayValue* GetArray(const std::string& key) {
[[nodiscard]] AMFArrayValue* GetArray(const std::string& key) const {
AMFAssociative::const_iterator it = this->associative.find(key);
if (it != this->associative.end()) {
return dynamic_cast<AMFArrayValue*>(it->second);
@@ -305,7 +305,7 @@ public:
return nullptr;
}
[[nodiscard]] AMFArrayValue* GetArray(const size_t index) {
[[nodiscard]] AMFArrayValue* GetArray(const size_t index) const {
return index >= this->dense.size() ? nullptr : dynamic_cast<AMFArrayValue*>(this->dense.at(index));
}