27
27
#include " ObjectIterator.hpp"
28
28
29
29
/* *
30
- * @brief Declare a Map
31
- * @tparam KeyType Integral type to use for key
32
- * @param name name of the map
30
+ * @brief Declare a global Map& reference
31
+ * @param name
32
+ * @param KeyType Integral type to use for key
33
+ * @param ContentType Object type to declare for content
33
34
* @note Use `DEFINE_FSTR_MAP` to instantiate the global object
34
35
*/
35
36
#define DECLARE_FSTR_MAP (name, KeyType, ContentType ) extern const FSTR::Map<KeyType, ContentType>& name;
36
37
37
38
/* *
38
- * @brief Define a Map with reference
39
+ * @brief Define a Map Object with global reference
40
+ * @name Name of the Map& reference to define
41
+ * @param KeyType Integral type to use for key
42
+ * @param ContentType Object type to declare for content
43
+ * @param ... List of MapPair definitions { key, &content }
44
+ * @note Size will be calculated
39
45
*/
40
46
#define DEFINE_FSTR_MAP (name, KeyType, ContentType, ...) \
41
47
static DEFINE_FSTR_MAP_DATA (FSTR_DATA_NAME(name), KeyType, ContentType, __VA_ARGS__); \
42
48
DEFINE_FSTR_REF_NAMED (name, DECL((FSTR::Map<KeyType, ContentType>)));
43
49
50
+ /* *
51
+ * @brief Define a Map Object with local reference
52
+ * @name Name of the Map& reference to define
53
+ * @param KeyType Integral type to use for key
54
+ * @param ContentType Object type to declare for content
55
+ * @param ... List of MapPair definitions { key, &content }
56
+ * @note Size will be calculated
57
+ */
44
58
#define DEFINE_FSTR_MAP_LOCAL (name, KeyType, ContentType, ...) \
45
59
static DEFINE_FSTR_MAP_DATA (FSTR_DATA_NAME(name), KeyType, ContentType, __VA_ARGS__); \
46
60
static constexpr DEFINE_FSTR_REF_NAMED (name, DECL((FSTR::Map<KeyType, ContentType>)));
47
61
62
+ /* *
63
+ * @brief Define a Map Object with global reference, specifying the number of elements
64
+ * @name Name of the Map& reference to define
65
+ * @param KeyType Integral type to use for key
66
+ * @param ContentType Object type to declare for content
67
+ * @param size Number of elements
68
+ * @param ... List of MapPair definitions { key, &content }
69
+ */
48
70
#define DEFINE_FSTR_MAP_SIZED (name, KeyType, ContentType, size, ...) \
49
71
static DEFINE_FSTR_MAP_DATA_SIZED (FSTR_DATA_NAME(name), KeyType, ContentType, size, __VA_ARGS__); \
50
72
DEFINE_FSTR_REF_NAMED (name, DECL((FSTR::Map<KeyType, ContentType>)));
51
73
74
+ /* *
75
+ * @brief Define a Map Object with local reference, specifying the number of elements
76
+ * @name Name of the Map& reference to define
77
+ * @param KeyType Integral type to use for key
78
+ * @param ContentType Object type to declare for content
79
+ * @param size Number of elements
80
+ * @param ... List of MapPair definitions { key, &content }
81
+ */
52
82
#define DEFINE_FSTR_MAP_SIZED_LOCAL (name, KeyType, ContentType, size, ...) \
53
83
static DEFINE_FSTR_MAP_DATA_SIZED (FSTR_DATA_NAME(name), KeyType, ContentType, size, __VA_ARGS__); \
54
84
static constexpr DEFINE_FSTR_REF_NAMED (name, DECL((FSTR::Map<KeyType, ContentType>)));
55
85
56
86
/* *
57
- * @brief Define a structure containing map data
58
- * @param name name of the map structure
87
+ * @brief Define a Map data structure
88
+ * @param name Name of data structure
89
+ * @param KeyType Integral type to use for key
90
+ * @param ContentType Object type to declare for content
91
+ * @param ... List of MapPair definitions { key, &content }
92
+ * @note Size will be calculated
59
93
*/
60
94
#define DEFINE_FSTR_MAP_DATA (name, KeyType, ContentType, ...) \
61
95
DEFINE_FSTR_MAP_DATA_SIZED (name, KeyType, ContentType, \
64
98
__VA_ARGS__)
65
99
66
100
/* *
67
- * @brief Use in situations where the array size cannot be automatically calculated,
68
- * such as when combined with inline Strings via FS()
101
+ * @brief Define a Map data structure, specifying the number of elements
102
+ * @param name Name of data structure
103
+ * @param KeyType Integral type to use for key
104
+ * @param ContentType Object type to declare for content
105
+ * @param size Number of elements
106
+ * @param ... List of MapPair definitions { key, &content }
69
107
*/
70
108
#define DEFINE_FSTR_MAP_DATA_SIZED (name, KeyType, ContentType, size, ...) \
71
109
constexpr const struct { \
@@ -101,6 +139,7 @@ class Map : public Object<Map<KeyType, ContentType>, Pair>
101
139
102
140
/* *
103
141
* @brief Lookup an integral key and return the index
142
+ * @param key Key to locate, must be compatible with KeyType for equality comparison
104
143
* @retval int If key isn't found, return -1
105
144
*/
106
145
template <typename TRefKey, typename T = KeyType>
@@ -119,6 +158,8 @@ class Map : public Object<Map<KeyType, ContentType>, Pair>
119
158
120
159
/* *
121
160
* @brief Lookup a String key and return the index
161
+ * @param key
162
+ * @param ignoreCase Whether search is case-sensitive (default: true)
122
163
* @retval int If key isn't found, return -1
123
164
*/
124
165
template <typename TRefKey, typename T = KeyType>
@@ -142,6 +183,7 @@ class Map : public Object<Map<KeyType, ContentType>, Pair>
142
183
143
184
/* *
144
185
* @brief Lookup a key and return the entry, if found
186
+ * @param key
145
187
* @note Result validity can be checked using if()
146
188
*/
147
189
template <typename TRefKey> const Pair operator [](const TRefKey& key) const
0 commit comments