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< MapFSTR::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

Parameters
KeyTypeIntegral type to use for key
ContentTypeObject type to declare for content
sizeNumber of elements
...List of MapPair definitions { key, &content }
#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
KeyTypeIntegral type to use for key
ContentTypeObject 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:
static DEFINE_FSTR_MAP_DATA(FSTR_DATA_NAME(name), KeyType, ContentType, __VA_ARGS__); \
DEFINE_FSTR_REF_NAMED(name, DECL((FSTR::Map<KeyType, ContentType>)));
Class template to access an associative map.
Definition: Map.hpp:119
#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:
(sizeof((const FSTR::MapPair<KeyType, ContentType>[]){__VA_ARGS__}) / \
__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
nameName of data structure
KeyTypeIntegral type to use for key
ContentTypeObject 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_PACKED FSTR_ALIGNED name PROGMEM = {{sizeof(name.data)}, {__VA_ARGS__}}; \
FSTR_CHECK_STRUCT(name);
#define FSTR_ALIGNED
Definition: config.hpp:27
#define FSTR_PACKED
Definition: config.hpp:28
#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
nameName of data structure
KeyTypeIntegral type to use for key
ContentTypeObject type to declare for content
sizeNumber of elements
...List of MapPair definitions { key, &content }

◆ DEFINE_FSTR_MAP_LOCAL

#define DEFINE_FSTR_MAP_LOCAL (   name,
  KeyType,
  ContentType,
  ... 
)
Value:
static DEFINE_FSTR_MAP_DATA(FSTR_DATA_NAME(name), KeyType, ContentType, __VA_ARGS__); \
Class template to access an associative map.
Definition: Map.hpp:119
#define DEFINE_FSTR_REF_NAMED(name, ObjectType)
Definition: Object.hpp:51
#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:
static DEFINE_FSTR_MAP_DATA_SIZED(FSTR_DATA_NAME(name), KeyType, ContentType, size, __VA_ARGS__); \
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
Class template to access an associative map.
Definition: Map.hpp:119
#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:
static DEFINE_FSTR_MAP_DATA_SIZED(FSTR_DATA_NAME(name), KeyType, ContentType, size, __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
Class template to access an associative map.
Definition: Map.hpp:119
#define DEFINE_FSTR_REF_NAMED(name, ObjectType)
Definition: Object.hpp:51
#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>
std::enable_if<!std::is_class<T>::value, int>::type FSTR::Map< KeyType, ContentType, Pair >::indexOf ( const TRefKey &  key) const
inline

Lookup an integral key and return the index.

Parameters
keyKey to locate, must be compatible with KeyType for equality comparison
Return values
intIf 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>
std::enable_if<std::is_same<T, String>::value, int>::type FSTR::Map< KeyType, ContentType, Pair >::indexOf ( const TRefKey &  key,
bool  ignoreCase = true 
) const
inline

Lookup a String key and return the index.

Parameters
key
ignoreCaseWhether search is case-sensitive (default: true)
Return values
intIf key isn't found, return -1

◆ operator[]()

template<typename KeyType , class ContentType , class Pair = MapPair<KeyType, ContentType>>
template<typename TRefKey >
const Pair FSTR::Map< KeyType, ContentType, Pair >::operator[] ( const TRefKey &  key) const
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>>
MapPrinter<Map> FSTR::Map< KeyType, ContentType, Pair >::printer ( ) const
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>>
size_t FSTR::Map< KeyType, ContentType, Pair >::printTo ( Print p) const
inline

◆ valueAt()

template<typename KeyType , class ContentType , class Pair = MapPair<KeyType, ContentType>>
const Pair FSTR::Map< KeyType, ContentType, Pair >::valueAt ( unsigned  index) const
inline

Get a map entry by index, if it exists.

Note
Result validity can be checked using if()