Go to the documentation of this file.
39 #define DECLARE_FSTR_VECTOR(name, ObjectType) DECLARE_FSTR_OBJECT(name, FSTR::Vector<ObjectType>)
48 #define DEFINE_FSTR_VECTOR(name, ObjectType, ...) \
49 static DEFINE_FSTR_VECTOR_DATA(FSTR_DATA_NAME(name), ObjectType, __VA_ARGS__); \
50 DEFINE_FSTR_REF_NAMED(name, FSTR::Vector<ObjectType>);
55 #define DEFINE_FSTR_VECTOR_LOCAL(name, ObjectType, ...) \
56 static DEFINE_FSTR_VECTOR_DATA(FSTR_DATA_NAME(name), ObjectType, __VA_ARGS__); \
57 static constexpr DEFINE_FSTR_REF_NAMED(name, FSTR::Vector<ObjectType>);
67 #define DEFINE_FSTR_VECTOR_SIZED(name, ObjectType, size, ...) \
68 static DEFINE_FSTR_VECTOR_DATA_SIZED(FSTR_DATA_NAME(name), ObjectType, size, __VA_ARGS__); \
69 DEFINE_FSTR_REF_NAMED(name, FSTR::Vector<ObjectType>);
74 #define DEFINE_FSTR_VECTOR_SIZED_LOCAL(name, ObjectType, size, ...) \
75 static DEFINE_FSTR_VECTOR_DATA_SIZED(FSTR_DATA_NAME(name), ObjectType, size, __VA_ARGS__); \
76 static constexpr DEFINE_FSTR_REF_NAMED(name, FSTR::Vector<ObjectType>);
85 #define DEFINE_FSTR_VECTOR_DATA(name, ObjectType, ...) \
86 DEFINE_FSTR_VECTOR_DATA_SIZED(name, ObjectType, sizeof((const void*[]){__VA_ARGS__}) / sizeof(void*), __VA_ARGS__)
96 #define DEFINE_FSTR_VECTOR_DATA_SIZED(name, ObjectType, size, ...) \
97 constexpr const struct { \
98 FSTR::ObjectBase object; \
99 const ObjectType* data[size]; \
100 } name PROGMEM = {{sizeof(name.data)}, __VA_ARGS__}; \
101 FSTR_CHECK_STRUCT(name);
109 template <
class ObjectType>
class Vector :
public Object<Vector<ObjectType>, ObjectType*>
112 template <
typename ValueType,
typename T = ObjectType>
113 typename std::enable_if<std::is_same<T, String>::value,
int>::type
indexOf(
const ValueType& value,
114 bool ignoreCase =
true)
const
120 auto len = this->
length();
121 for(
unsigned i = 0; i < len; ++i) {
122 if(
valueAt(i).equalsIgnoreCase(value)) {
132 if(index < this->
length()) {
133 auto ptr = this->
data()[index];
139 return ObjectType::empty();
describes a counted string stored in flash memory
Definition: String.hpp:173
Class to access a Vector of objects stored in flash.
Definition: Vector.hpp:109
const ObjectType & operator[](unsigned index) const
Definition: Vector.hpp:142
size_t printTo(Print &p) const
Definition: Vector.hpp:154
const ObjectType * * data() const
Definition: Object.hpp:203
Definition: Array.hpp:107
std::enable_if< std::is_same< T, String >::value, int >::type indexOf(const ValueType &value, bool ignoreCase=true) const
Definition: Vector.hpp:113
Class template to provide a simple way to print the contents of an array.
Definition: ArrayPrinter.hpp:105
Provides formatted output to stream.
Definition: Print.h:36
ObjectType
Definition: Libraries/jerryscript/src/include/Jerryscript/Types.h:44
const ObjectType & valueAt(unsigned index) const
Definition: Vector.hpp:130
size_t length() const
Get the length of the content in elements.
Definition: Object.hpp:164
Base class template for all types.
Definition: Object.hpp:120
ArrayPrinter< Vector > printer() const
Definition: Vector.hpp:149