Skip to content

Commit 47d196f

Browse files
committed
Add back FSTR_PTR() and FSTR_TABLE() macros so existing code doesn't need to change
1 parent 5fc3953 commit 47d196f

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

Diff for: include/FlashString/String.hpp

+27
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,33 @@ typedef const __FlashStringHelper* flash_string_t;
116116
IMPORT_FSTR_DATA(name, file) \
117117
extern "C" const FSTR::String name;
118118

119+
/**
120+
* @brief Get a pointer to the actual FlashString
121+
* @param fstr The FlashString& reference
122+
* @deprecated Not required, taking address of a references is fine so just use &
123+
*/
124+
#define FSTR_PTR(fstr) &fstr
125+
126+
/** @brief declare a table of FlashStrings
127+
* @param name name of the table
128+
* @deprecated Use a Vector or Map
129+
* @note Declares a simple table. Example:
130+
*
131+
* DEFINE_FSTR(fstr1, "Test string #1");
132+
* DEFINE_FSTR(fstr2, "Test string #2");
133+
*
134+
* FSTR_TABLE(table) = {
135+
* &fstr1,
136+
* &fstr2,
137+
* };
138+
*
139+
* Table entries may be accessed directly as they are word-aligned. Examples:
140+
* debugf("fstr1 = '%s'", String(*table[0]).c_str());
141+
* debugf("fstr2.length() = %u", table[1]->length());
142+
*
143+
*/
144+
#define FSTR_TABLE(name) const FlashString* const name[] PROGMEM
145+
119146
namespace FSTR
120147
{
121148
using WString = ::String;

0 commit comments

Comments
 (0)