NeoMutt  2024-10-02-7-gd3e66a
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 *node_true, struct ExpandoNode *node_false)
 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 node_true,
struct ExpandoNode node_false 
)

Create a new Condition Expando Node.

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

Definition at line 72 of file node_condition.c.

75{
76 ASSERT(condition);
77
78 struct ExpandoNode *node = node_new();
79
80 node->type = ENT_CONDITION;
82
83 ARRAY_SET(&node->children, ENC_CONDITION, condition);
84 ARRAY_SET(&node->children, ENC_TRUE, node_true);
85 ARRAY_SET(&node->children, ENC_FALSE, node_false);
86
87 return node;
88}
#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:41
#define ASSERT(COND)
Definition: signal2.h:58
Basic Expando Node.
Definition: node.h:69
int(* render)(const struct ExpandoNode *node, const struct ExpandoRenderData *rdata, struct Buffer *buf, int max_cols, void *data, MuttFormatFlags flags)
Definition: node.h:96
enum ExpandoNodeType type
Type of Node, e.g. ENT_EXPANDO.
Definition: node.h:70
struct ExpandoNodeArray children
Children nodes.
Definition: node.h:77
+ Here is the call graph for this function:
+ Here is the caller graph for this function: