iw4x-client/src/Utils/Entities.hpp

33 lines
711 B
C++
Raw Normal View History

2017-03-25 17:18:31 -04:00
#pragma once
namespace Utils
{
class Entities
{
public:
Entities() = default;
Entities(const std::string& buffer) : Entities() { this->parse(buffer); }
Entities(const char* string, std::size_t lenPlusOne) : Entities(std::string(string, lenPlusOne - 1)) {}
Entities(const Entities& obj) = default;
2017-03-25 17:18:31 -04:00
[[nodiscard]] std::string build() const;
2017-03-25 17:18:31 -04:00
std::vector<std::string> getModels();
void deleteTriggers();
void deleteWeapons(bool keepTurrets);
void convertTurrets();
private:
enum
{
PARSE_AWAIT_KEY,
PARSE_READ_KEY,
PARSE_AWAIT_VALUE,
PARSE_READ_VALUE,
};
std::vector<std::unordered_map<std::string, std::string>> entities;
2018-12-17 08:29:18 -05:00
void parse(const std::string& buffer);
2017-03-25 17:18:31 -04:00
};
}