Associative Maps
Collaboration diagram for Associative Maps:
Namespaces | |
FSTR | |
Classes | |
class | FSTR::Map< KeyType, ContentType, Pair > |
Class template to access an associative map. More... | |
class | FSTR::MapPair< KeyType, ContentType > |
describes a pair mapping key => data for a specified key type More... | |
Macros | |
#define | DECLARE_FSTR_MAP(name, KeyType, ContentType) DECLARE_FSTR_OBJECT(name, DECL((FSTR::Map<KeyType, ContentType>))) |
Declare a global Map& reference. More... | |
Functions | |
const Pair | FSTR::Map< KeyType, ContentType, Pair >::valueAt (unsigned index) const |
Get a map entry by index, if it exists. More... | |
template<typename TRefKey , typename T = KeyType> | |
std::enable_if<!std::is_class< T >::value, int >::type | FSTR::Map< KeyType, ContentType, Pair >::indexOf (const TRefKey &key) const |
Lookup an integral key and return the index. More... | |
template<typename TRefKey , typename T = KeyType> | |
std::enable_if< std::is_same< T, String >::value, int >::type | FSTR::Map< KeyType, ContentType, Pair >::indexOf (const TRefKey &key, bool ignoreCase=true) const |
Lookup a String key and return the index. More... | |
template<typename TRefKey > | |
const Pair | FSTR::Map< KeyType, ContentType, Pair >::operator[] (const TRefKey &key) const |
Lookup a key and return the entry, if found. More... | |
MapPrinter< Map > | FSTR::Map< KeyType, ContentType, Pair >::printer () const |
Returns a printer object for this array. More... | |
size_t | FSTR::Map< KeyType, ContentType, Pair >::printTo (Print &p) const |
Name of the Map& reference to define | |||||||||
Define a Map Object with global reference, specifying the number of elements
| |||||||||
#define | DEFINE_FSTR_MAP(name, KeyType, ContentType, ...) | ||||||||
#define | DEFINE_FSTR_MAP_LOCAL(name, KeyType, ContentType, ...) | ||||||||
Like DEFINE_FSTR_MAP except reference is declared static constexpr. More... | |||||||||
#define | DEFINE_FSTR_MAP_SIZED(name, KeyType, ContentType, size, ...) | ||||||||
#define | DEFINE_FSTR_MAP_SIZED_LOCAL(name, KeyType, ContentType, size, ...) | ||||||||
Like DEFINE_FSTR_MAP_SIZED except reference is declared static. More... | |||||||||
#define | DEFINE_FSTR_MAP_DATA(name, KeyType, ContentType, ...) | ||||||||
Define a Map data structure. More... | |||||||||
#define | DEFINE_FSTR_MAP_DATA_SIZED(name, KeyType, ContentType, size, ...) | ||||||||
Define a Map data structure, specifying the number of elements. More... | |||||||||
Detailed Description
Macro Definition Documentation
◆ DECLARE_FSTR_MAP
#define DECLARE_FSTR_MAP | ( | name, | |
KeyType, | |||
ContentType | |||
) | DECLARE_FSTR_OBJECT(name, DECL((FSTR::Map<KeyType, ContentType>))) |
Declare a global Map& reference.
- Parameters
-
name KeyType Integral type to use for key ContentType Object type to declare for content
- Note
- Use DEFINE_FSTR_MAP to instantiate the global object
◆ DEFINE_FSTR_MAP
#define DEFINE_FSTR_MAP | ( | name, | |
KeyType, | |||
ContentType, | |||
... | |||
) |
Value:
DEFINE_FSTR_REF_NAMED(name, DECL((FSTR::Map<KeyType, ContentType>)));
#define DECL(t)
Wrap a type declaration so it can be passed with commas in it.
Definition: Utility.hpp:58
#define DEFINE_FSTR_MAP_DATA(name, KeyType, ContentType,...)
Define a Map data structure.
Definition: Map.hpp:90
#define FSTR_DATA_NAME(name)
Provide internal name for generated flash string structures.
Definition: Object.hpp:56
Definition: WebConstants.h:60
◆ DEFINE_FSTR_MAP_DATA
#define DEFINE_FSTR_MAP_DATA | ( | name, | |
KeyType, | |||
ContentType, | |||
... | |||
) |
Value:
DEFINE_FSTR_MAP_DATA_SIZED(name, KeyType, ContentType, \
sizeof(FSTR::MapPair<KeyType, ContentType>)), \
__VA_ARGS__)
#define DEFINE_FSTR_MAP_DATA_SIZED(name, KeyType, ContentType, size,...)
Define a Map data structure, specifying the number of elements.
Definition: Map.hpp:104
describes a pair mapping key => data for a specified key type
Definition: MapPair.hpp:36
Definition: WebConstants.h:60
Define a Map data structure.
- Parameters
-
name Name of data structure KeyType Integral type to use for key ContentType Object type to declare for content ... List of MapPair definitions { key, &content }
- Note
- Size will be calculated
◆ DEFINE_FSTR_MAP_DATA_SIZED
#define DEFINE_FSTR_MAP_DATA_SIZED | ( | name, | |
KeyType, | |||
ContentType, | |||
size, | |||
... | |||
) |
Value:
constexpr const struct { \
FSTR::ObjectBase object; \
FSTR::MapPair<KeyType, ContentType> data[size]; \
FSTR_CHECK_STRUCT(name);
#define PROGMEM
Place entity into flash memory.
Definition: Arch/Esp8266/Components/libc/include/sys/pgmspace.h:29
Define a Map data structure, specifying the number of elements.
- Parameters
-
name Name of data structure KeyType Integral type to use for key ContentType Object type to declare for content size Number of elements ... List of MapPair definitions { key, &content }
◆ DEFINE_FSTR_MAP_LOCAL
#define DEFINE_FSTR_MAP_LOCAL | ( | name, | |
KeyType, | |||
ContentType, | |||
... | |||
) |
Value:
#define DECL(t)
Wrap a type declaration so it can be passed with commas in it.
Definition: Utility.hpp:58
#define DEFINE_FSTR_MAP_DATA(name, KeyType, ContentType,...)
Define a Map data structure.
Definition: Map.hpp:90
#define FSTR_DATA_NAME(name)
Provide internal name for generated flash string structures.
Definition: Object.hpp:56
Definition: WebConstants.h:60
Like DEFINE_FSTR_MAP except reference is declared static constexpr.
◆ DEFINE_FSTR_MAP_SIZED
#define DEFINE_FSTR_MAP_SIZED | ( | name, | |
KeyType, | |||
ContentType, | |||
size, | |||
... | |||
) |
Value:
DEFINE_FSTR_REF_NAMED(name, DECL((FSTR::Map<KeyType, ContentType>)));
#define DEFINE_FSTR_MAP_DATA_SIZED(name, KeyType, ContentType, size,...)
Define a Map data structure, specifying the number of elements.
Definition: Map.hpp:104
#define DECL(t)
Wrap a type declaration so it can be passed with commas in it.
Definition: Utility.hpp:58
#define FSTR_DATA_NAME(name)
Provide internal name for generated flash string structures.
Definition: Object.hpp:56
Definition: WebConstants.h:60
◆ DEFINE_FSTR_MAP_SIZED_LOCAL
#define DEFINE_FSTR_MAP_SIZED_LOCAL | ( | name, | |
KeyType, | |||
ContentType, | |||
size, | |||
... | |||
) |
Value:
#define DEFINE_FSTR_MAP_DATA_SIZED(name, KeyType, ContentType, size,...)
Define a Map data structure, specifying the number of elements.
Definition: Map.hpp:104
#define DECL(t)
Wrap a type declaration so it can be passed with commas in it.
Definition: Utility.hpp:58
#define FSTR_DATA_NAME(name)
Provide internal name for generated flash string structures.
Definition: Object.hpp:56
Definition: WebConstants.h:60
Like DEFINE_FSTR_MAP_SIZED except reference is declared static.
Function Documentation
◆ indexOf() [1/2]
template<typename KeyType , class ContentType , class Pair = MapPair<KeyType, ContentType>>
template<typename TRefKey , typename T = KeyType>
|
inline |
Lookup an integral key and return the index.
- Parameters
-
key Key to locate, must be compatible with KeyType for equality comparison
- Return values
-
int If key isn't found, return -1
◆ indexOf() [2/2]
template<typename KeyType , class ContentType , class Pair = MapPair<KeyType, ContentType>>
template<typename TRefKey , typename T = KeyType>
|
inline |
Lookup a String key and return the index.
- Parameters
-
key ignoreCase Whether search is case-sensitive (default: true)
- Return values
-
int If key isn't found, return -1
◆ operator[]()
template<typename KeyType , class ContentType , class Pair = MapPair<KeyType, ContentType>>
template<typename TRefKey >
|
inline |
Lookup a key and return the entry, if found.
- Parameters
-
key
- Note
- Result validity can be checked using if()
◆ printer()
template<typename KeyType , class ContentType , class Pair = MapPair<KeyType, ContentType>>
|
inline |
Returns a printer object for this array.
- Note
- ElementType must be supported by Print
◆ printTo()
template<typename KeyType , class ContentType , class Pair = MapPair<KeyType, ContentType>>
|
inline |
◆ valueAt()
template<typename KeyType , class ContentType , class Pair = MapPair<KeyType, ContentType>>
|
inline |
Get a map entry by index, if it exists.
- Note
- Result validity can be checked using if()