NeoMutt  2024-10-02-37-gfa9146
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
quad.h File Reference

Type representing a quad-option. More...

+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Enumerations

enum  QuadOption {
  MUTT_ABORT = -1 , MUTT_NO , MUTT_YES , MUTT_ASKNO ,
  MUTT_ASKYES
}
 Possible values for a quad-option. More...
 

Functions

int quad_he_toggle (struct ConfigSubset *sub, struct HashElem *he, struct Buffer *err)
 Toggle the value of a quad.
 

Variables

const char * QuadValues []
 Valid strings for creating a QuadValue.
 

Detailed Description

Type representing a quad-option.

Authors
  • 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 quad.h.

Enumeration Type Documentation

◆ QuadOption

enum QuadOption

Possible values for a quad-option.

Enumerator
MUTT_ABORT 

User aborted the question (with Ctrl-G)

MUTT_NO 

User answered 'No', or assume 'No'.

MUTT_YES 

User answered 'Yes', or assume 'Yes'.

MUTT_ASKNO 

Ask the user, defaulting to 'No'.

MUTT_ASKYES 

Ask the user, defaulting to 'Yes'.

Definition at line 35 of file quad.h.

36{
37 MUTT_ABORT = -1,
38 MUTT_NO,
39 MUTT_YES,
42};
@ MUTT_ABORT
User aborted the question (with Ctrl-G)
Definition: quad.h:37
@ MUTT_ASKNO
Ask the user, defaulting to 'No'.
Definition: quad.h:40
@ MUTT_NO
User answered 'No', or assume 'No'.
Definition: quad.h:38
@ MUTT_ASKYES
Ask the user, defaulting to 'Yes'.
Definition: quad.h:41
@ MUTT_YES
User answered 'Yes', or assume 'Yes'.
Definition: quad.h:39

Function Documentation

◆ quad_he_toggle()

int quad_he_toggle ( struct ConfigSubset sub,
struct HashElem he,
struct Buffer err 
)

Toggle the value of a quad.

Parameters
subConfig subset
heHashElem representing config item
errBuffer for error messages
Return values
numResult, e.g. CSR_SUCCESS
See also
quad_toggle()

Definition at line 217 of file quad.c.

218{
219 if (!sub || !he || !he->data)
220 return CSR_ERR_CODE;
221
222 struct HashElem *he_base = cs_get_base(he);
223 if (DTYPE(he_base->type) != DT_QUAD)
224 return CSR_ERR_CODE;
225
226 intptr_t value = cs_he_native_get(sub->cs, he, err);
227 if (value == INT_MIN)
228 return CSR_ERR_CODE;
229
230 value = quad_toggle(value);
231 int rc = cs_he_native_set(sub->cs, he, value, err);
232
233 if ((CSR_RESULT(rc) == CSR_SUCCESS) && !(rc & CSR_SUC_NO_CHANGE))
235
236 return rc;
237}
struct HashElem * cs_get_base(struct HashElem *he)
Find the root Config Item.
Definition: set.c:160
int cs_he_native_set(const struct ConfigSet *cs, struct HashElem *he, intptr_t value, struct Buffer *err)
Natively set the value of a HashElem config item.
Definition: set.c:708
intptr_t cs_he_native_get(const struct ConfigSet *cs, struct HashElem *he, struct Buffer *err)
Natively get the value of a HashElem config item.
Definition: set.c:813
#define CSR_SUC_NO_CHANGE
The value hasn't changed.
Definition: set.h:44
#define CSR_ERR_CODE
Problem with the code.
Definition: set.h:36
#define CSR_RESULT(x)
Definition: set.h:52
#define CSR_SUCCESS
Action completed successfully.
Definition: set.h:35
static int quad_toggle(int opt)
Toggle (invert) the value of a quad option.
Definition: quad.c:203
struct ConfigSet * cs
Parent ConfigSet.
Definition: subset.h:51
The item stored in a Hash Table.
Definition: hash.h:43
int type
Type of data stored in Hash Table, e.g. DT_STRING.
Definition: hash.h:44
void * data
User-supplied data.
Definition: hash.h:46
void cs_subset_notify_observers(const struct ConfigSubset *sub, struct HashElem *he, enum NotifyConfig ev)
Notify all observers of an event.
Definition: subset.c:237
@ NT_CONFIG_SET
Config item has been set.
Definition: subset.h:62
#define DTYPE(t)
Definition: types.h:50
@ DT_QUAD
quad-option (no/yes/ask-no/ask-yes)
Definition: types.h:41
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ QuadValues

const char* QuadValues[]
extern

Valid strings for creating a QuadValue.

These strings are case-insensitive.

Definition at line 53 of file quad.c.