NeoMutt  2024-04-16-36-g75b6fb
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
node_condition.h File Reference

Expando Node for a Condition. More...

+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Enumerations

enum  ExpandoConditionStart { CON_NO_CONDITION , CON_START }
 Signals node_parse() if the parsing started in a conditional statement or not. More...
 
enum  ENCondition { ENC_CONDITION , ENC_TRUE , ENC_FALSE }
 Names for the Condition's children. More...
 

Functions

struct ExpandoNodenode_condition_new (struct ExpandoNode *condition, struct ExpandoNode *if_true_tree, struct ExpandoNode *if_false_tree)
 Create a new Condition Expando Node.
 

Detailed Description

Expando Node for a Condition.

Authors
  • Tóth János
  • Richard Russon

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Definition in file node_condition.h.

Enumeration Type Documentation

◆ ExpandoConditionStart

Signals node_parse() if the parsing started in a conditional statement or not.

Easier to read than a simple true, false.

Enumerator
CON_NO_CONDITION 

Parser is not currently in a condition.

CON_START 

Parser is working on a condition.

Definition at line 34 of file node_condition.h.

35{
38};
@ CON_NO_CONDITION
Parser is not currently in a condition.
@ CON_START
Parser is working on a condition.

◆ ENCondition

Names for the Condition's children.

A Condition has three children:

  • Expando that acts as the Condition
  • Tree of Expandos for the true case
  • Tree of Expandos for the false case
Enumerator
ENC_CONDITION 

Index of Condition Node.

ENC_TRUE 

Index of True Node.

ENC_FALSE 

Index of False Node.

Definition at line 48 of file node_condition.h.

49{
51 ENC_TRUE,
52 ENC_FALSE,
53};
@ ENC_CONDITION
Index of Condition Node.
@ ENC_FALSE
Index of False Node.
@ ENC_TRUE
Index of True Node.

Function Documentation

◆ node_condition_new()

struct ExpandoNode * node_condition_new ( struct ExpandoNode condition,
struct ExpandoNode if_true_tree,
struct ExpandoNode if_false_tree 
)

Create a new Condition Expando Node.

Parameters
conditionExpando Node that will be tested
if_true_treeNode tree for the 'true' case
if_false_treeNode tree for the 'false' case
Return values
ptrNew Condition Expando Node

Definition at line 73 of file node_condition.c.

76{
77 assert(condition);
78 assert(if_true_tree);
79
80 struct ExpandoNode *node = node_new();
81
82 node->type = ENT_CONDITION;
84
85 ARRAY_SET(&node->children, ENC_CONDITION, condition);
86 ARRAY_SET(&node->children, ENC_TRUE, if_true_tree);
87 ARRAY_SET(&node->children, ENC_FALSE, if_false_tree);
88
89 return node;
90}
#define ARRAY_SET(head, idx, elem)
Set an element in the array.
Definition: array.h:123
static int node_condition_render(const struct ExpandoNode *node, const struct ExpandoRenderData *rdata, struct Buffer *buf, int max_cols, void *data, MuttFormatFlags flags)
Render a Conditional Node - Implements ExpandoNode::render() -.
struct ExpandoNode * node_new(void)
Create a new empty ExpandoNode.
Definition: node.c:39
@ ENT_CONDITION
True/False condition.
Definition: node.h:40
Basic Expando Node.
Definition: node.h:67
int(* render)(const struct ExpandoNode *node, const struct ExpandoRenderData *rdata, struct Buffer *buf, int max_cols, void *data, MuttFormatFlags flags)
Definition: node.h:94
enum ExpandoNodeType type
Type of Node, e.g. ENT_EXPANDO.
Definition: node.h:68
struct ExpandoNodeArray children
Children nodes.
Definition: node.h:75
+ Here is the call graph for this function:
+ Here is the caller graph for this function: