61template <
typename KeyType,
typename ValueType>
65 typedef std::map<KeyType, ValueType> AMap;
66 typedef typename AMap::iterator AnIterator;
85 std::pair<AnIterator, bool>
const& result = m_KeyValuePair.insert(
typename AMap::value_type(Key, aValue));
91 return result.first->second;
96 return result.first->second;
108 ValueType*
Find(
const KeyType& Key)
110 AnIterator result = m_KeyValuePair.find(Key);
112 if(result != m_KeyValuePair.end())
114 return &result->second;
126template<
typename BuildingBlock>
138 uint32_t Remove(BuildingBlock aBlock)
140 uint32_t occurences = 0;
141 typename std::vector<BuildingBlock>::iterator iterator = m_Elements.begin();
143 while (iterator != m_Elements.end())
145 if (*iterator == aBlock)
147 iterator = m_Elements.erase(iterator);
159 void Add(BuildingBlock aBlock)
161 m_Elements.push_back(aBlock);
174 FORCEINLINE int32_t
AddUnique(
const BuildingBlock& Item)
176 int32_t index =
Find(Item);
198 int32_t
Find(
const BuildingBlock& Item)
const
200 int32_t returnIndex = 0;
202 typename std::vector<BuildingBlock>::const_iterator iter = m_Elements.begin();
204 for (; iter != m_Elements.end(); iter++)
206 if (m_Elements[returnIndex] == Item)
213 if (iter != m_Elements.end())
222 bool Contains(BuildingBlock aBlock)
const
224 typename std::vector<BuildingBlock>::const_iterator iterator = m_Elements.begin();
226 while (iterator != m_Elements.end())
228 if (*iterator == aBlock)
243 return (uint32_t) m_Elements.size();
257 typename std::vector<BuildingBlock>::iterator iter = m_Elements.begin();
260 if constexpr(std::is_pointer_v<BuildingBlock>)
262 for (iter = m_Elements.begin(); iter != m_Elements.end(); iter++)
264 if (*iter !=
nullptr)
266 KR_CORE_INFO(
"Deleting UObjects");
284 void SetVectorElementByIndex(int32_t Index, BuildingBlock Value)
286 m_Elements[Index] = Value;
289 inline const std::vector<BuildingBlock>& GetElements()
const {
return m_Elements; }
290 inline std::vector<BuildingBlock>& ModifyElements() {
return m_Elements; }
292 typename std::vector<BuildingBlock>::iterator begin()
294 return m_Elements.begin();
297 typename std::vector<BuildingBlock>::iterator end()
299 return m_Elements.end();
310 KR_CORE_ASSERT(Index >= 0,
"");
311 if(Index < m_Elements.size())
313 return m_Elements.at(Index);
316 KR_CORE_ASSERT(
false,
"Shouldn't happen");
318 static BuildingBlock aBlock;
330 return Index >= 0 && Index < m_Elements.size();
335 std::vector<BuildingBlock> m_Elements;
358 std::string m_DefaultProtocol;
359 std::string m_DefaultName;
360 std::string m_DefaultHost;
361 std::string m_DefaultPortal;
362 std::string m_DefaultSaveExt;
363 int32_t m_DefaultPort;
380 std::string m_Protocol;
394 std::string m_RedirectURL;
400 std::string m_Portal;
404 static bool m_bDefaultsInitialized;
414 FURL(
const std::string& Filename =
"");
Karma's std::map wrapper.
Definition KarmaTypes.h:63
ValueType * Find(const KeyType &Key)
Definition KarmaTypes.h:108
ValueType & FindOrAdd(const KeyType &Key)
Definition KarmaTypes.h:82
Karma's std::vector wrapper.
Definition KarmaTypes.h:128
FORCEINLINE int32_t AddUnique(const BuildingBlock &Item)
Definition KarmaTypes.h:174
FORCEINLINE bool IsValidIndex(int32_t Index) const
Definition KarmaTypes.h:328
int32_t Find(const BuildingBlock &Item) const
Definition KarmaTypes.h:198
void SmartReset()
Definition KarmaTypes.h:279
FORCEINLINE BuildingBlock & IndexToObject(int32_t Index)
Definition KarmaTypes.h:308
void Reset()
Definition KarmaTypes.h:254
Definition KarmaTypes.h:11
Type
Definition KarmaTypes.h:13
@ EndPlayInEditor
Definition KarmaTypes.h:19
@ Destroyed
Definition KarmaTypes.h:15
@ RemovedFromWorld
Definition KarmaTypes.h:21
@ Quit
Definition KarmaTypes.h:23
@ LevelTransition
Definition KarmaTypes.h:17
Definition KarmaTypes.h:29
Type
Definition KarmaTypes.h:31
@ GamePreview
Definition KarmaTypes.h:48
@ None
Definition KarmaTypes.h:33
@ Editor
Definition KarmaTypes.h:39
@ Game
Definition KarmaTypes.h:36
@ PIE
Definition KarmaTypes.h:42
@ EditorPreview
Definition KarmaTypes.h:45
@ GameRPC
Definition KarmaTypes.h:51
Definition KarmaTypes.h:378
Definition KarmaTypes.h:357