NeoMutt  2024-04-25-1-g3de005
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
node_condition.c File Reference

Expando Node for a Condition. More...

#include "config.h"
#include <assert.h>
#include <stdbool.h>
#include "mutt/lib.h"
#include "node_condition.h"
#include "node.h"
#include "render.h"
+ Include dependency graph for node_condition.c:

Go to the source code of this file.

Functions

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 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.c.

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:41
@ ENC_CONDITION
Index of Condition Node.
@ ENC_FALSE
Index of False Node.
@ ENC_TRUE
Index of True Node.
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: