mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-04 09:44:10 +00:00
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:
@@ -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));
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user