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

Expando Node for a Conditional Date. More...

#include "config.h"
#include <assert.h>
#include <ctype.h>
#include <limits.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include "mutt/lib.h"
#include "node_conddate.h"
#include "helpers.h"
#include "node.h"
#include "parse.h"
#include "render.h"
+ Include dependency graph for node_conddate.c:

Go to the source code of this file.

Functions

struct NodeCondDatePrivatenode_conddate_private_new (int count, char period)
 Create new CondDate private data.
 
void node_conddate_private_free (void **ptr)
 Free CondDate private data - Implements ExpandoNode::ndata_free()
 
int node_conddate_render (const struct ExpandoNode *node, const struct ExpandoRenderData *rdata, struct Buffer *buf, int max_cols, void *data, MuttFormatFlags flags)
 Render a CondDate Node - Implements ExpandoNode::render() -.
 
struct ExpandoNodenode_conddate_new (int count, char period, int did, int uid)
 Create a new CondDate ExpandoNode.
 
struct ExpandoNodenode_conddate_parse (const char *str, const char **parsed_until, int did, int uid, struct ExpandoParseError *error)
 Parse a CondDate format string - Implements ExpandoDefinition::parse() -.
 

Detailed Description

Expando Node for a Conditional Date.

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

Function Documentation

◆ node_conddate_private_new()

struct NodeCondDatePrivate * node_conddate_private_new ( int  count,
char  period 
)

Create new CondDate private data.

Parameters
countNumber of 'units' to count
periodUnits, e.g. 'd' Day or 'm' Month
Return values
ptrNew CondDate private data

Definition at line 50 of file node_conddate.c.

51{
52 struct NodeCondDatePrivate *priv = mutt_mem_calloc(1, sizeof(struct NodeCondDatePrivate));
53
54 priv->count = count;
55 priv->period = period;
56
57 return priv;
58}
void * mutt_mem_calloc(size_t nmemb, size_t size)
Allocate zeroed memory on the heap.
Definition: memory.c:50
Private data for a Conditional Date.
Definition: node_conddate.h:33
int count
Number of 'units' to count.
Definition: node_conddate.h:34
char period
Units, e.g. 'd' Day or 'm' Month.
Definition: node_conddate.h:35
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ node_conddate_private_free()

void node_conddate_private_free ( void **  ptr)

Free CondDate private data - Implements ExpandoNode::ndata_free()

Parameters
ptrData to free

Definition at line 64 of file node_conddate.c.

65{
66 if (!ptr || !*ptr)
67 return;
68
69 FREE(ptr);
70}
#define FREE(x)
Definition: memory.h:45
+ Here is the caller graph for this function:

◆ node_conddate_new()

struct ExpandoNode * node_conddate_new ( int  count,
char  period,
int  did,
int  uid 
)

Create a new CondDate ExpandoNode.

Parameters
countNumber of 'units' to count
periodUnits, e.g. 'd' Day or 'm' Month
didDomain ID
uidUnique ID
Return values
ptrNew CondDate ExpandoNode

Definition at line 132 of file node_conddate.c.

133{
134 struct ExpandoNode *node = node_new();
135 node->type = ENT_CONDDATE;
136 node->did = did;
137 node->uid = uid;
139
140 node->ndata = node_conddate_private_new(count, period);
142
143 return node;
144}
int node_conddate_render(const struct ExpandoNode *node, const struct ExpandoRenderData *rdata, struct Buffer *buf, int max_cols, void *data, MuttFormatFlags flags)
Render a CondDate Node - Implements ExpandoNode::render() -.
Definition: node_conddate.c:75
struct ExpandoNode * node_new(void)
Create a new empty ExpandoNode.
Definition: node.c:39
@ ENT_CONDDATE
True/False date condition.
Definition: node.h:43
struct NodeCondDatePrivate * node_conddate_private_new(int count, char period)
Create new CondDate private data.
Definition: node_conddate.c:50
void node_conddate_private_free(void **ptr)
Free CondDate private data - Implements ExpandoNode::ndata_free()
Definition: node_conddate.c:64
Basic Expando Node.
Definition: node.h:69
int uid
Unique ID, e.g. ED_EMA_SIZE.
Definition: node.h:73
int(* render)(const struct ExpandoNode *node, const struct ExpandoRenderData *rdata, struct Buffer *buf, int max_cols, void *data, MuttFormatFlags flags)
Definition: node.h:96
void * ndata
Private node data.
Definition: node.h:82
int did
Domain ID, e.g. ED_EMAIL.
Definition: node.h:72
enum ExpandoNodeType type
Type of Node, e.g. ENT_EXPANDO.
Definition: node.h:70
void(* ndata_free)(void **ptr)
Function to free the private node data.
Definition: node.h:83
+ Here is the call graph for this function:
+ Here is the caller graph for this function: