NeoMutt  2024-10-02-37-gfa9146
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 <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 *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.c.

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
@ ENC_CONDITION
Index of Condition Node.
@ ENC_FALSE
Index of False Node.
@ ENC_TRUE
Index of True Node.
#define ASSERT(COND)
Definition: signal2.h:58
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:91
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: