72 char expando[128] = { 0 };
73 const int expando_len = expando_end - format_end;
82 return def->
parse(str, def->
did, def->
uid, flags, parsed_until, err);
86 *parsed_until = expando_end;
96 snprintf(err->
message,
sizeof(err->
message),
_(
"Unknown expando: %%%.*s"),
97 expando_len, format_end);
113 const long num = rd_match->
get_number(node, data, flags);
122 const size_t len =
buf_len(buf_str);
size_t buf_len(const struct Buffer *buf)
Calculate the length of a Buffer.
Define an Expando format string.
uint8_t ExpandoParserFlags
Flags for expando_parse(), e.g. EP_CONDITIONAL.
const char * skip_classic_expando(const char *str, const struct ExpandoDefinition *defs)
Skip over the text of an Expando.
const char * skip_until_classic_expando(const char *start)
Search through string until we reach an Expando character.
const struct ExpandoRenderData * find_get_number(const struct ExpandoRenderData *rdata, int did, int uid)
Find a get_number() callback function.
const struct ExpandoRenderData * find_get_string(const struct ExpandoRenderData *rdata, int did, int uid)
Find a get_string() callback function.
struct ExpandoNode * node_condbool_parse(const char *str, const struct ExpandoDefinition *defs, ExpandoParserFlags flags, const char **parsed_until, struct ExpandoParseError *err)
Parse a CondBool format string - Implements ExpandoDefinition::parse() -.
int node_condbool_render(const struct ExpandoNode *node, const struct ExpandoRenderData *rdata, struct Buffer *buf, int max_cols, void *data, MuttFormatFlags flags)
Callback for every bool node - Implements ExpandoNode::render() -.
Convenience wrapper for the library headers.
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
char * mutt_strn_copy(char *dest, const char *src, size_t len, size_t dsize)
Copy a sub-string into a buffer.
struct ExpandoNode * node_new(void)
Create a new empty ExpandoNode.
@ ENT_CONDBOOL
True/False boolean condition.
struct ExpandoNode * node_condbool_new(const char *start, const char *end, int did, int uid)
Create a new CondBool ExpandoNode.
Expando Node for a Conditional Boolean.
struct Buffer * buf_pool_get(void)
Get a Buffer from the pool.
void buf_pool_release(struct Buffer **ptr)
Return a Buffer to the pool.
Render Expandos using Data.
uint8_t MuttFormatFlags
Flags for expando_render(), e.g. MUTT_FORMAT_FORCESUBJ.
String manipulation buffer.
char * data
Pointer to data.
Definition of a format string.
short uid
Unique ID in domain.
struct ExpandoNode *(* parse)(const char *str, int did, int uid, ExpandoParserFlags flags, const char **parsed_until, struct ExpandoParseError *err)
const char * short_name
Short Expando name, e.g. "n".
int uid
Unique ID, e.g. ED_EMA_SIZE.
int(* render)(const struct ExpandoNode *node, const struct ExpandoRenderData *rdata, struct Buffer *buf, int max_cols, void *data, MuttFormatFlags flags)
int did
Domain ID, e.g. ED_EMAIL.
enum ExpandoNodeType type
Type of Node, e.g. ENT_EXPANDO.
Buffer for parsing errors.
const char * position
Position of error in original string.
char message[256]
Error message.
long(* get_number)(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
void(* get_string)(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, struct Buffer *buf)