tetengo 1.8.1
A multipurpose library set
Loading...
Searching...
No Matches
input.h File Reference

An input. More...

#include <stdbool.h>
#include <stddef.h>
+ Include dependency graph for input.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  tetengo_lattice_customInputDefinition_tag
 A custom input definition. More...
 

Typedefs

typedef struct tetengo_lattice_customInputDefinition_tag tetengo_lattice_customInputDefinition_t
 A custom input definition.
 

Functions

tetengo_lattice_input_t * tetengo_lattice_input_createStringInput (const char *value)
 Creates a string input.
 
tetengo_lattice_input_t * tetengo_lattice_input_createCustomInput (const tetengo_lattice_customInputDefinition_t *p_definition)
 Creates a custom input.
 
void tetengo_lattice_input_destroy (const tetengo_lattice_input_t *p_input)
 Destroys an input.
 
bool tetengo_lattice_input_equal (const tetengo_lattice_input_t *p_one, const tetengo_lattice_input_t *p_another)
 Returns true if one input is equal to another.
 
size_t tetengo_lattice_input_hashValue (const tetengo_lattice_input_t *p_input)
 Returns the hash value.
 
size_t tetengo_lattice_input_length (const tetengo_lattice_input_t *p_input)
 Returns the length.
 
tetengo_lattice_input_t * tetengo_lattice_input_clone (const tetengo_lattice_input_t *p_input)
 Clone the input.
 
tetengo_lattice_input_t * tetengo_lattice_input_createSubrange (const tetengo_lattice_input_t *p_input, size_t offset, size_t length)
 Creates a subrange.
 
bool tetengo_lattice_input_append (tetengo_lattice_input_t *p_input, tetengo_lattice_input_t *p_another)
 Appends another input.
 
const char * tetengo_lattice_stringInput_value (const tetengo_lattice_input_t *p_string_input)
 Returns the value of a string input.
 
bool tetengo_lattice_stringInput_setValue (tetengo_lattice_input_t *p_string_input, const char *value)
 Sets a value of a string input.
 
const void * tetengo_lattice_customInput_context (const tetengo_lattice_input_t *p_custom_input)
 Returns the context of a custom input.
 
bool tetengo_lattice_customInput_setContext (tetengo_lattice_input_t *p_custom_input, void *p_context)
 Sets a context of a custom input.
 

Detailed Description

An input.

Copyright (C) 2019-2023 kaoru https://www.tetengo.org/

Function Documentation

◆ tetengo_lattice_customInput_context()

const void * tetengo_lattice_customInput_context ( const tetengo_lattice_input_t *  p_custom_input)

Returns the context of a custom input.

Parameters
p_custom_inputA pointer to a custom input.
Returns
A pointer to the context. Or NULL when p_custom_input is NULL or is not a custom input.

◆ tetengo_lattice_customInput_setContext()

bool tetengo_lattice_customInput_setContext ( tetengo_lattice_input_t *  p_custom_input,
void *  p_context 
)

Sets a context of a custom input.

Parameters
p_custom_inputA pointer to a custom input.
p_contextA pointer to a context.
Return values
trueWhen the context is set.
falseOtherwise.

◆ tetengo_lattice_input_append()

bool tetengo_lattice_input_append ( tetengo_lattice_input_t *  p_input,
tetengo_lattice_input_t *  p_another 
)

Appends another input.

The ownership of the input pointed by p_another is transferred into this input. There is no need to destroy the input p_another after calling this function.

Parameters
p_inputA pointer to an input.
p_anotherA pointer to another input.
Return values
trueWhen p_another is appended to this input.
falseOtherwise.

◆ tetengo_lattice_input_clone()

tetengo_lattice_input_t * tetengo_lattice_input_clone ( const tetengo_lattice_input_t *  p_input)

Clone the input.

Parameters
p_inputA pointer to an input.
Returns
A unique pointer to a clone. Or NULL when p_input is NULL.

◆ tetengo_lattice_input_createCustomInput()

tetengo_lattice_input_t * tetengo_lattice_input_createCustomInput ( const tetengo_lattice_customInputDefinition_t p_definition)

Creates a custom input.

Parameters
p_definitionA pointer to a definition.
Returns
A pointer to a custom input. Or NULL when p_definition NULL

◆ tetengo_lattice_input_createStringInput()

tetengo_lattice_input_t * tetengo_lattice_input_createStringInput ( const char *  value)

Creates a string input.

Parameters
valueA value.
Returns
A pointer to an string input. Or NULL when value is NULL.

◆ tetengo_lattice_input_createSubrange()

tetengo_lattice_input_t * tetengo_lattice_input_createSubrange ( const tetengo_lattice_input_t *  p_input,
size_t  offset,
size_t  length 
)

Creates a subrange.

Parameters
p_inputA pointer to an input.
offsetAn offset.
lengthA length.
Returns
A pointer to a subrange. Or NULL when p_input is NULL, or offset and/or length are out of the range of the input.

◆ tetengo_lattice_input_destroy()

void tetengo_lattice_input_destroy ( const tetengo_lattice_input_t *  p_input)

Destroys an input.

Parameters
p_inputA pointer to an input.

◆ tetengo_lattice_input_equal()

bool tetengo_lattice_input_equal ( const tetengo_lattice_input_t *  p_one,
const tetengo_lattice_input_t *  p_another 
)

Returns true if one input is equal to another.

Parameters
p_oneA pointer to one input.
p_anotherA pointer to another input.
Return values
trueWhen one input is equal to another.
falseOtherwise.

◆ tetengo_lattice_input_hashValue()

size_t tetengo_lattice_input_hashValue ( const tetengo_lattice_input_t *  p_input)

Returns the hash value.

Parameters
p_inputA pointer to an input.
Returns
The hash value. Or (size_t)-1 when p_input is NULL.

◆ tetengo_lattice_input_length()

size_t tetengo_lattice_input_length ( const tetengo_lattice_input_t *  p_input)

Returns the length.

Parameters
p_inputA pointer to an input.
Returns
The length. Or (size_t)-1 when p_input is NULL.

◆ tetengo_lattice_stringInput_setValue()

bool tetengo_lattice_stringInput_setValue ( tetengo_lattice_input_t *  p_string_input,
const char *  value 
)

Sets a value of a string input.

Parameters
p_string_inputA pointer to a string input.
valueA value.
Return values
trueWhen the value is set.
falseOtherwise.

◆ tetengo_lattice_stringInput_value()

const char * tetengo_lattice_stringInput_value ( const tetengo_lattice_input_t *  p_string_input)

Returns the value of a string input.

Parameters
p_string_inputA pointer to a string input.
Returns
The value. Or NULL when p_string_input is NULL or is not a string input.