13#pragma warning(disable : 4237)
22 return strcmp(p_key0, p_key1) > 0;
59 for (it =
m_map.begin(); it !=
m_map.end(); it++) {
61 const char*
const& key = (*it).first;
62 delete[]
const_cast<char*
>(key);
92 T*
Get(
const char* p_name)
102 if (it !=
m_map.end()) {
103 value = (*it).second;
115 void Add(
const char* p_name, T* p_value)
124 if (it !=
m_map.end()) {
125 name =
const_cast<char*
>((*it).first);
132 name =
new char[strlen(p_name) + 1];
133 strcpy(name, p_name);
136 m_map[name] = p_value;
Template alias for a map from C-string keys to object pointers, using LegoContainerInfoComparator for...
Template container associating string names with object pointers, optional lifetime management.
LegoContainer()
Default constructor, sets this container to own its elements.
void SetOwnership(LegoBool p_ownership)
Set whether this container owns/deletes its objects (and name strings) on removal/destruction.
void Clear()
Remove and delete all mapped objects; preserves key strings.
LegoContainerInfo< T > m_map
Underlying map from name strings to objects. [AI].
virtual ~LegoContainer()
Destructor.
T * Get(const char *p_name)
Retrieve the element mapped to the given name, or nullptr if missing.
LegoBool m_ownership
If TRUE, container owns objects and keys; else no cleanup on destruction. [AI].
void Add(const char *p_name, T *p_value)
Add an element mapped to the given name, replacing existing item if present.
Specialized LegoContainer handling LegoTextureInfo objects and their DirectDraw/Direct3D caching.
LegoCachedTextureList m_cached
List of cached temporary texture objects, pairing texture info with a cache/in-use flag....
void EraseCached(LegoTextureInfo *p_textureInfo)
Mark a cached texture as unused and release its Direct3D/DirectDraw resources if its reference count ...
LegoTextureInfo * GetCached(LegoTextureInfo *p_textureInfo)
Attempt to find and return a cached LegoTextureInfo with the same properties as p_textureInfo,...
~LegoTextureContainer() override
Destructor.
[AI] Contains DirectDraw and Direct3DRM handles and metadata for a texture used in the LEGO Island re...
list< LegoCachedTexture > LegoCachedTextureList
List of cached textures, each with a pointer and a cache state.
pair< LegoTextureInfo *, BOOL > LegoCachedTexture
Pair associating a LegoTextureInfo pointer with a cache state (BOOL).
[AI] Defines basic fixed-width data types and platform-neutral constants for LEGO Island codebase.
#define NULL
[AI] Null pointer value (C/C++ semantics).
LegoU8 LegoBool
[AI] Boolean value used throughout the codebase.
#define map
[AI] Macro alias for Map<K, T, Pr>, replacing std::map<T>.
[AI] STL compatibility layer header to provide consistent STL (Standard Template Library) types and a...
Comparator used to order keys in LegoContainerInfo maps; compares C-strings lexicographically.
LegoBool operator()(const char *const &p_key0, const char *const &p_key1) const