FSTR::Map< KeyType, ContentType, Pair > Class Template Reference
Class template to access an associative map. More...
#include <Map.hpp>
Inheritance diagram for FSTR::Map< KeyType, ContentType, Pair >:
Collaboration diagram for FSTR::Map< KeyType, ContentType, Pair >:
Public Member Functions | |
const 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 | 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 | indexOf (const TRefKey &key, bool ignoreCase=true) const |
Lookup a String key and return the index. More... | |
template<typename TRefKey > | |
const Pair | operator[] (const TRefKey &key) const |
Lookup a key and return the entry, if found. More... | |
MapPrinter< Map > | printer () const |
Returns a printer object for this array. More... | |
size_t | printTo (Print &p) const |
Public Member Functions inherited from FSTR::Object< Map< KeyType, ContentType >, MapPair< KeyType, ContentType > > | |
Object () | |
Creates a null object. More... | |
Object (const Object &obj) | |
Copy constructor. More... | |
Iterator | begin () const |
Iterator | end () const |
constexpr const size_t | length () const |
Get the length of the content in elements. More... | |
int | indexOf (const ValueType &value) const |
MapPair< KeyType, ContentType > | valueAt (unsigned index) const |
MapPair< KeyType, ContentType > | operator[] (unsigned index) const |
Array operator[]. More... | |
size_t | elementSize () const |
DataPtrType | data () const |
size_t | read (size_t index, MapPair< KeyType, ContentType > *buffer, size_t count) const |
Read content into RAM. More... | |
size_t | readFlash (size_t index, MapPair< KeyType, ContentType > *buffer, size_t count) const |
Read content into RAM,using flashmem_read() More... | |
MapPair< KeyType, ContentType > | unsafeValueAt (const DataPtrType dataptr, unsigned index) const |
Public Member Functions inherited from FSTR::ObjectBase | |
constexpr FSTR_NOINLINE const size_t | length () const |
Get the length of the object data in bytes. More... | |
constexpr const size_t | size () const |
Get the object data size in bytes. More... | |
bool | operator== (const ObjectBase &other) const |
template<class ObjectType > | |
constexpr const ObjectType & | as () const |
Cast to a different object type. More... | |
const uint8_t * | data () const |
Get a pointer to the flash data. More... | |
size_t | read (size_t offset, void *buffer, size_t count) const |
Read contents of a String into RAM. More... | |
size_t | readFlash (size_t offset, void *buffer, size_t count) const |
Read contents of a String into RAM, using flashread() More... | |
constexpr const bool | isCopy () const |
constexpr const bool | isNull () const |
Indicates an invalid String, used for return value from lookups, etc. More... | |
Additional Inherited Members | |
Public Types inherited from FSTR::Object< Map< KeyType, ContentType >, MapPair< KeyType, ContentType > > | |
using | DataPtrType = const MapPair< KeyType, ContentType > * |
using | Iterator = ObjectIterator< Map< KeyType, ContentType >, MapPair< KeyType, ContentType > > |
Static Public Member Functions inherited from FSTR::Object< Map< KeyType, ContentType >, MapPair< KeyType, ContentType > > | |
static constexpr const Map< KeyType, ContentType > & | empty () |
Return an empty object which evaluates to null. More... | |
Public Attributes inherited from FSTR::ObjectBase | |
const uint32_t | flashLength_ |
Static Protected Attributes inherited from FSTR::ObjectBase | |
static const ObjectBase | empty_ |
static constexpr uint32_t | copyBit = 0x80000000U |
Set to indicate copy. More... | |
static constexpr uint32_t | lengthInvalid = copyBit | 0 |
Indicates null string in a copy. More... | |
Detailed Description
template<typename KeyType, class ContentType, class Pair = MapPair<KeyType, ContentType>>
class FSTR::Map< KeyType, ContentType, Pair >
Class template to access an associative map.
- Template Parameters
-
KeyType ContentType
Member 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()
The documentation for this class was generated from the following file: