#pragma once #include #include #include #include #include #include "../CK2/CKTypes.hpp" /** * @brief The X container part of LibCmo. * These classes are prefixed with X in original Virtools SDK. */ namespace LibCmo::XContainer { /** @brief Class representation of a string (an array of character ended by NULL). @remark This class now use std::string. */ using XString = std::string; /** @brief Set of bit flags. @remark This class now use specialized std::vector. */ using XBitArray = std::vector; /** @brief Class representation of an array. @tparam T Element Type. @remark This class now use std::vector. @see XClassArray, XSArray */ template using XArray = std::vector; /** @brief Class representation of an array. @tparam T Element Type. @details Equivalent to XArray becasue memory reducing is useless. @see XArray */ template using XSArray = XArray; /** @brief Class representation of an array. @tparam T Element Type. @details Equivalent to XArray because std::vector can fufill the requirements. @see XArray */ template using XClassArray = XArray; /** @brief Container class for CKObject Id's. @remark + This class use the template container XArray to contain object CK_ID's. + Supports for Check, Load, Save, Add, Remove, Find functions in the Object CK_ID array. @todo May independ this class to implement the functions introduced in remarks. @see XObjectPointerArray, CKObjectArray */ using XObjectArray = XArray; /** @brief Container class for CKObject Id's @details Equivalent to XObjectArray becasue memory reducing is useless. @see XObjectArray */ using XSObjectArray = XObjectArray; /** @brief Container class for CKObject pointers. @remark + Exactly same as XObjectArray class, but uses XArray (Pre-allocated items) for storing pointers, and not IDs (more efficient to retrieve the objects). + Supports for Check, Load, Save, Add, Remove, Find functions in the CKObject Pointer array. @todo May independ this class to implement the functions introduced in remarks. @see XObjectArray, CKObjectArray */ using XObjectPointerArray = XArray; /** @brief Container class for CKObject pointers. @details Equivalent to XObjectPointerArray becasue memory reducing is useless.s */ using XSObjectPointerArray = XObjectPointerArray; /** @brief Class representation of an Hash Table container. @tparam K The type of the key @tparam T The type of element to insert @tparam H The hash function to hash the key @tparam Eq The equal function to the key @remark This class now use std::unordered_map. */ template, class Eq = std::equal_to> using XHashTable = std::unordered_map; /** @copydoc XHashTable @details Equivalent to XHashTable @see XHashTable */ template, class Eq = std::equal_to> using XNHashTable = XHashTable; /** @copydoc XHashTable @details Equivalent to XHashTable because static allocation is useless. @see XHashTable */ template, class Eq = std::equal_to> using XSHashTable = XHashTable; }