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

Expando Node for Padding. More...

#include "definition.h"
+ Include dependency graph for node_padding.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  NodePaddingPrivate
 Private data for a Padding Node. More...
 

Enumerations

enum  ExpandoPadType { EPT_FILL_EOL , EPT_HARD_FILL , EPT_SOFT_FILL }
 Padding type. More...
 
enum  ENPad { ENP_LEFT , ENP_RIGHT }
 Names for the Padding's children. More...
 

Functions

struct ExpandoNodenode_padding_parse (const char *s, const char **parsed_until, int did, int uid, ExpandoParserFlags flags, struct ExpandoParseError *error)
 Parse a Padding Expando - Implements ExpandoDefinition::parse() -.
 
void node_padding_repad (struct ExpandoNode **parent)
 Rearrange Padding in a tree of ExpandoNodes.
 

Detailed Description

Expando Node for Padding.

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_padding.h.

Enumeration Type Documentation

◆ ExpandoPadType

Padding type.

Padding occurs between two sides, left and right. The type of Padding, soft or hard, refers to how the left-hand-side will react if there's too little space.

Hard padding: The left-hand-side will fixed and the right-hand-side will be truncated. Soft padding: The right-hand-side will be fixed and the left-hand-side will be truncated.

Enumerator
EPT_FILL_EOL 

Fill to the end-of-line.

EPT_HARD_FILL 

Hard-fill: left-hand-side will be truncated.

EPT_SOFT_FILL 

Soft-fill: right-hand-side will be truncated.

Definition at line 42 of file node_padding.h.

43{
47};
@ EPT_FILL_EOL
Fill to the end-of-line.
Definition: node_padding.h:44
@ EPT_SOFT_FILL
Soft-fill: right-hand-side will be truncated.
Definition: node_padding.h:46
@ EPT_HARD_FILL
Hard-fill: left-hand-side will be truncated.
Definition: node_padding.h:45

◆ ENPad

enum ENPad

Names for the Padding's children.

Padding has two children: Left and Right.

Enumerator
ENP_LEFT 

Index of Left-Hand Nodes.

ENP_RIGHT 

Index of Right-Hand Nodes.

Definition at line 54 of file node_padding.h.

55{
56 ENP_LEFT,
57 ENP_RIGHT,
58};
@ ENP_LEFT
Index of Left-Hand Nodes.
Definition: node_padding.h:56
@ ENP_RIGHT
Index of Right-Hand Nodes.
Definition: node_padding.h:57

Function Documentation

◆ node_padding_repad()

void node_padding_repad ( struct ExpandoNode **  parent)

Rearrange Padding in a tree of ExpandoNodes.

Parameters
parentParent Node

Definition at line 275 of file node_padding.c.

276{
277 if (!parent || !*parent)
278 return;
279
280 struct ExpandoNode *node = *parent;
281 struct ExpandoNode *prev = NULL;
282 for (; node; prev = node, node = node->next)
283 {
284 if (node->type == ENT_PADDING)
285 {
286 if (node != *parent)
287 ARRAY_SET(&node->children, ENP_LEFT, *parent); // First sibling
288
289 ARRAY_SET(&node->children, ENP_RIGHT, node->next); // Sibling after Padding
290
291 if (prev)
292 prev->next = NULL;
293 node->next = NULL;
294 *parent = node;
295 return;
296 }
297
298 if (node->type == ENT_CONDITION)
299 {
300 struct ExpandoNode **ptr = NULL;
301
302 ptr = ARRAY_GET(&node->children, ENC_TRUE);
304
305 ptr = ARRAY_GET(&node->children, ENC_FALSE);
307 }
308 }
309}
#define ARRAY_SET(head, idx, elem)
Set an element in the array.
Definition: array.h:123
#define ARRAY_GET(head, idx)
Return the element at index.
Definition: array.h:109
@ ENT_CONDITION
True/False condition.
Definition: node.h:40
@ ENT_PADDING
Padding: soft, hard, EOL.
Definition: node.h:39
@ ENC_FALSE
Index of False Node.
@ ENC_TRUE
Index of True Node.
void node_padding_repad(struct ExpandoNode **parent)
Rearrange Padding in a tree of ExpandoNodes.
Definition: node_padding.c:275
Basic Expando Node.
Definition: node.h:67
struct ExpandoNode * next
Linked list.
Definition: node.h:69
+ Here is the call graph for this function:
+ Here is the caller graph for this function: