mupdf
Loading...
Searching...
No Matches
options.h
Go to the documentation of this file.
1// Copyright (C) 2025 Artifex Software, Inc.
2//
3// This file is part of MuPDF.
4//
5// MuPDF is free software: you can redistribute it and/or modify it under the
6// terms of the GNU Affero General Public License as published by the Free
7// Software Foundation, either version 3 of the License, or (at your option)
8// any later version.
9//
10// MuPDF is distributed in the hope that it will be useful, but WITHOUT ANY
11// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
13// details.
14//
15// You should have received a copy of the GNU Affero General Public License
16// along with MuPDF. If not, see <https://www.gnu.org/licenses/agpl-3.0.en.html>
17//
18// Alternative licensing terms are available from the licensor.
19// For commercial licensing, see <https://www.artifex.com/> or contact
20// Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
21// CA 94129, USA, for further information.
22
23#ifndef MUPDF_FITZ_OPTIONS_H
24#define MUPDF_FITZ_OPTIONS_H
25
26#include "mupdf/fitz/context.h"
27#include "mupdf/fitz/pool.h"
28
34typedef struct fz_options fz_options;
35
41fz_options *fz_new_options(fz_context *ctx, const char *option_string);
42
58void fz_parse_options(fz_context *ctx, fz_options *options, const char *option_string);
59
64
69
79int fz_lookup_option(fz_context *ctx, fz_options *options, const char *key, const char **val);
80
94int fz_lookup_option_yes(fz_context *ctx, fz_options *options, const char *key);
95
109int fz_lookup_option_boolean(fz_context *ctx, fz_options *options, const char *key, int *x);
110
125int fz_lookup_option_float(fz_context *ctx, fz_options *options, const char *key, float *x);
126int fz_lookup_option_integer(fz_context *ctx, fz_options *options, const char *key, int *x);
127int fz_lookup_option_unsigned(fz_context *ctx, fz_options *options, const char *key, unsigned int *x);
128
129typedef struct
130{
131 const char *key;
132 int val;
134
135/*
136 Check to see if an option is present. Look for it in the given fz_option_enums
137 array, which is expected to end with an entry with a NULL key.
138
139 If the option is not found, return 0.
140
141 If the option is found, and a matching entry in the list exists, then *x will
142 be set to the 'val' from that entry, the invalid flag is cleared, and we will return 1.
143
144 If the option is found, and no matching entry in the list exists, then *x will
145 be set to the 'val' from the terminating NULL entry, the invalid flag will be set,
146 and we will return -1.
147*/
148int fz_lookup_option_enum(fz_context *ctx, fz_options *options, const char *key, int *x,
149 const fz_option_enums *enum_list);
150
156void fz_validate_options(fz_context *ctx, fz_options *options, const char *prefix);
157
166void fz_warn_on_unused_options(fz_context *ctx, fz_options *options, const char *prefix);
167
176void fz_throw_on_unused_options(fz_context *ctx, fz_options *options, const char *prefix);
177
178
183
187const char *fz_get_option_by_index(fz_context *ctx, fz_options *options, int i, const char **val);
188
193
198
199typedef struct fz_option
200{
201 int flags;
202 char *key;
203 char *val;
206
212
213#endif
int fz_lookup_option_float(fz_context *ctx, fz_options *options, const char *key, float *x)
void fz_throw_on_unused_options(fz_context *ctx, fz_options *options, const char *prefix)
int fz_lookup_option_integer(fz_context *ctx, fz_options *options, const char *key, int *x)
void fz_drop_options(fz_context *ctx, fz_options *opts)
int fz_lookup_option_enum(fz_context *ctx, fz_options *options, const char *key, int *x, const fz_option_enums *enum_list)
int fz_lookup_option_boolean(fz_context *ctx, fz_options *options, const char *key, int *x)
int fz_lookup_option_yes(fz_context *ctx, fz_options *options, const char *key)
const char * fz_get_option_by_index(fz_context *ctx, fz_options *options, int i, const char **val)
int fz_lookup_option(fz_context *ctx, fz_options *options, const char *key, const char **val)
int fz_count_options(fz_context *ctx, fz_options *options)
void fz_access_option_by_index(fz_context *ctx, fz_options *options, int i)
int fz_lookup_option_unsigned(fz_context *ctx, fz_options *options, const char *key, unsigned int *x)
void fz_validate_options(fz_context *ctx, fz_options *options, const char *prefix)
void fz_warn_on_unused_options(fz_context *ctx, fz_options *options, const char *prefix)
fz_options * fz_new_options(fz_context *ctx, const char *option_string)
void fz_parse_options(fz_context *ctx, fz_options *options, const char *option_string)
fz_options * fz_keep_options(fz_context *ctx, fz_options *opts)
struct fz_pool fz_pool
Definition pool.h:34
Definition context.h:886
Definition options.h:130
const char * key
Definition options.h:131
int val
Definition options.h:132
Definition options.h:200
char * key
Definition options.h:202
int flags
Definition options.h:201
char * val
Definition options.h:203
struct fz_option * next
Definition options.h:204
Definition options.h:207
fz_pool * pool
Definition options.h:209
fz_option * head
Definition options.h:210
int refs
Definition options.h:208