mFrame
載入中...
搜尋中...
無符合項目
Map.h
1
8#ifndef MFRAME_EC6FEC6D_9D9D_4888_A683_6B2477CEEC38
9#define MFRAME_EC6FEC6D_9D9D_4888_A683_6B2477CEEC38
10
11/* ********************* * ufm::lan * ufm::lang::System::out().println("\n移除操作:");
12 * ufm::lang::Strings* removedValue = stringMap.remove(*keyInterface1);:System::out().println("\n替換操作:");
13 * ufm::lang::Strings newValue("Updated Second");
14 * ufm::lang::Strings* oldValue = stringMap.replace(*keyInterface2, &newValue);***************************************************************
15 * Include
16 */
17
18//----------------------------------------------------------------------------------------
19
20//----------------------------------------------------------------------------------------
21#include "./../lang/Iterable.h"
22#include "./../util/Container.h"
23
24/* ***************************************************************************************
25 * Namespace
26 */
27namespace ufm::util {
333 template <typename V>
334 struct Map;
335} // namespace ufm::util
336
337/* ***************************************************************************************
338 * Class/Interface/Struct
339 */
340
353template <typename V = void>
354struct ufm::util::Map : public ufm::util::Container {
355 /* *************************************************************************************
356 * SubClass Entry
357 */
358
364 struct Entry {
365 /* ***********************************************************************************
366 * Method
367 */
373 virtual int getKey(void) abstract;
374
380 virtual V* getValue(void) abstract;
381
388 virtual V* setValue(V* value) abstract;
389
394 virtual void remove(void) abstract;
395 };
396
397 /* *************************************************************************************
398 * Method
399 */
400
408 virtual bool containsKey(ufm::lang::Interface& key) const abstract;
409
417 virtual bool containsValue(V* value) const abstract;
418
425 virtual V* get(ufm::lang::Interface& key) const abstract;
426
434 virtual V* put(ufm::lang::Interface& key, V* value) abstract;
435
442 virtual V* remove(ufm::lang::Interface& key) abstract;
443
451 virtual V* replace(ufm::lang::Interface& key, V* value) abstract;
452};
453
454/* ***************************************************************************************
455 * End of file
456 */
457
458#endif /* MFRAME_EC6FEC6D_9D9D_4888_A683_6B2477CEEC38 */
Definition Iterable.h:28
類別共用基礎介面
Definition Interface.h:152
容器介面,定義所有集合容器的基本操作。
Definition Container.h:176
Map的條目介面,代表一個鍵值對
Definition Map.h:364
virtual V * setValue(V *value) override
設置條目的值
virtual void remove(void) override
從Map中移除該MapEntry
virtual V * getValue(void) override
獲取條目的值
virtual int getKey(void) override
獲取條目的鍵
映射表介面,定義鍵值對的容器結構。
virtual V * replace(ufm::lang::Interface &key, V *value) override
替換指定鍵的值
virtual bool containsValue(V *value) const override
檢查map是否包含指定的值
virtual V * get(ufm::lang::Interface &key) const override
獲取指定鍵對應的值
virtual V * remove(ufm::lang::Interface &key) override
從map中移除指定鍵的映射
virtual V * put(ufm::lang::Interface &key, V *value) override
將指定的值與指定的鍵相關聯
virtual bool containsKey(ufm::lang::Interface &key) const override
檢查map是否包含指定的鍵