Skip to main content

glib/auto/
flags.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// DO NOT EDIT
4
5use crate::{bitflags::bitflags, ffi, prelude::*, translate::*};
6
7#[cfg(feature = "v2_66")]
8bitflags! {
9    #[cfg_attr(docsrs, doc(cfg(feature = "v2_66")))]
10    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
11    #[doc(alias = "GFileSetContentsFlags")]
12    pub struct FileSetContentsFlags: u32 {
13        #[doc(alias = "G_FILE_SET_CONTENTS_NONE")]
14        const NONE = ffi::G_FILE_SET_CONTENTS_NONE as _;
15        #[doc(alias = "G_FILE_SET_CONTENTS_CONSISTENT")]
16        const CONSISTENT = ffi::G_FILE_SET_CONTENTS_CONSISTENT as _;
17        #[doc(alias = "G_FILE_SET_CONTENTS_DURABLE")]
18        const DURABLE = ffi::G_FILE_SET_CONTENTS_DURABLE as _;
19        #[doc(alias = "G_FILE_SET_CONTENTS_ONLY_EXISTING")]
20        const ONLY_EXISTING = ffi::G_FILE_SET_CONTENTS_ONLY_EXISTING as _;
21    }
22}
23
24#[cfg(feature = "v2_66")]
25#[cfg_attr(docsrs, doc(cfg(feature = "v2_66")))]
26#[doc(hidden)]
27impl IntoGlib for FileSetContentsFlags {
28    type GlibType = ffi::GFileSetContentsFlags;
29
30    #[inline]
31    fn into_glib(self) -> ffi::GFileSetContentsFlags {
32        self.bits()
33    }
34}
35
36#[cfg(feature = "v2_66")]
37#[cfg_attr(docsrs, doc(cfg(feature = "v2_66")))]
38#[doc(hidden)]
39impl FromGlib<ffi::GFileSetContentsFlags> for FileSetContentsFlags {
40    #[inline]
41    unsafe fn from_glib(value: ffi::GFileSetContentsFlags) -> Self {
42        Self::from_bits_truncate(value)
43    }
44}
45
46bitflags! {
47    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
48    #[doc(alias = "GFileTest")]
49    pub(crate) struct FileTest: u32 {
50        #[doc(alias = "G_FILE_TEST_IS_REGULAR")]
51        const IS_REGULAR = ffi::G_FILE_TEST_IS_REGULAR as _;
52        #[doc(alias = "G_FILE_TEST_IS_SYMLINK")]
53        const IS_SYMLINK = ffi::G_FILE_TEST_IS_SYMLINK as _;
54        #[doc(alias = "G_FILE_TEST_IS_DIR")]
55        const IS_DIR = ffi::G_FILE_TEST_IS_DIR as _;
56        #[doc(alias = "G_FILE_TEST_IS_EXECUTABLE")]
57        const IS_EXECUTABLE = ffi::G_FILE_TEST_IS_EXECUTABLE as _;
58        #[doc(alias = "G_FILE_TEST_EXISTS")]
59        const EXISTS = ffi::G_FILE_TEST_EXISTS as _;
60    }
61}
62
63#[doc(hidden)]
64impl IntoGlib for FileTest {
65    type GlibType = ffi::GFileTest;
66
67    #[inline]
68    fn into_glib(self) -> ffi::GFileTest {
69        self.bits()
70    }
71}
72
73#[doc(hidden)]
74impl FromGlib<ffi::GFileTest> for FileTest {
75    #[inline]
76    unsafe fn from_glib(value: ffi::GFileTest) -> Self {
77        Self::from_bits_truncate(value)
78    }
79}
80
81bitflags! {
82    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
83    #[doc(alias = "GFormatSizeFlags")]
84    pub struct FormatSizeFlags: u32 {
85        #[doc(alias = "G_FORMAT_SIZE_DEFAULT")]
86        const DEFAULT = ffi::G_FORMAT_SIZE_DEFAULT as _;
87        #[doc(alias = "G_FORMAT_SIZE_LONG_FORMAT")]
88        const LONG_FORMAT = ffi::G_FORMAT_SIZE_LONG_FORMAT as _;
89        #[doc(alias = "G_FORMAT_SIZE_IEC_UNITS")]
90        const IEC_UNITS = ffi::G_FORMAT_SIZE_IEC_UNITS as _;
91        #[doc(alias = "G_FORMAT_SIZE_BITS")]
92        const BITS = ffi::G_FORMAT_SIZE_BITS as _;
93        #[cfg(feature = "v2_74")]
94        #[cfg_attr(docsrs, doc(cfg(feature = "v2_74")))]
95        #[doc(alias = "G_FORMAT_SIZE_ONLY_VALUE")]
96        const ONLY_VALUE = ffi::G_FORMAT_SIZE_ONLY_VALUE as _;
97        #[cfg(feature = "v2_74")]
98        #[cfg_attr(docsrs, doc(cfg(feature = "v2_74")))]
99        #[doc(alias = "G_FORMAT_SIZE_ONLY_UNIT")]
100        const ONLY_UNIT = ffi::G_FORMAT_SIZE_ONLY_UNIT as _;
101    }
102}
103
104#[doc(hidden)]
105impl IntoGlib for FormatSizeFlags {
106    type GlibType = ffi::GFormatSizeFlags;
107
108    #[inline]
109    fn into_glib(self) -> ffi::GFormatSizeFlags {
110        self.bits()
111    }
112}
113
114#[doc(hidden)]
115impl FromGlib<ffi::GFormatSizeFlags> for FormatSizeFlags {
116    #[inline]
117    unsafe fn from_glib(value: ffi::GFormatSizeFlags) -> Self {
118        Self::from_bits_truncate(value)
119    }
120}
121
122bitflags! {
123    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
124    #[doc(alias = "GIOCondition")]
125    pub struct IOCondition: u32 {
126        #[doc(alias = "G_IO_IN")]
127        const IN = ffi::G_IO_IN as _;
128        #[doc(alias = "G_IO_OUT")]
129        const OUT = ffi::G_IO_OUT as _;
130        #[doc(alias = "G_IO_PRI")]
131        const PRI = ffi::G_IO_PRI as _;
132        #[doc(alias = "G_IO_ERR")]
133        const ERR = ffi::G_IO_ERR as _;
134        #[doc(alias = "G_IO_HUP")]
135        const HUP = ffi::G_IO_HUP as _;
136        #[doc(alias = "G_IO_NVAL")]
137        const NVAL = ffi::G_IO_NVAL as _;
138    }
139}
140
141#[doc(hidden)]
142impl IntoGlib for IOCondition {
143    type GlibType = ffi::GIOCondition;
144
145    #[inline]
146    fn into_glib(self) -> ffi::GIOCondition {
147        self.bits()
148    }
149}
150
151#[doc(hidden)]
152impl FromGlib<ffi::GIOCondition> for IOCondition {
153    #[inline]
154    unsafe fn from_glib(value: ffi::GIOCondition) -> Self {
155        Self::from_bits_truncate(value)
156    }
157}
158
159impl StaticType for IOCondition {
160    #[inline]
161    #[doc(alias = "g_io_condition_get_type")]
162    fn static_type() -> crate::Type {
163        unsafe { from_glib(ffi::g_io_condition_get_type()) }
164    }
165}
166
167impl crate::HasParamSpec for IOCondition {
168    type ParamSpec = crate::ParamSpecFlags;
169    type SetValue = Self;
170    type BuilderFn = fn(&str) -> crate::ParamSpecFlagsBuilder<Self>;
171
172    fn param_spec_builder() -> Self::BuilderFn {
173        Self::ParamSpec::builder
174    }
175}
176
177impl crate::value::ValueType for IOCondition {
178    type Type = Self;
179}
180
181unsafe impl<'a> crate::value::FromValue<'a> for IOCondition {
182    type Checker = crate::value::GenericValueTypeChecker<Self>;
183
184    #[inline]
185    unsafe fn from_value(value: &'a crate::Value) -> Self {
186        unsafe {
187            from_glib(crate::gobject_ffi::g_value_get_flags(
188                value.to_glib_none().0,
189            ))
190        }
191    }
192}
193
194impl ToValue for IOCondition {
195    #[inline]
196    fn to_value(&self) -> crate::Value {
197        let mut value = crate::Value::for_value_type::<Self>();
198        unsafe {
199            crate::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
200        }
201        value
202    }
203
204    #[inline]
205    fn value_type(&self) -> crate::Type {
206        Self::static_type()
207    }
208}
209
210impl From<IOCondition> for crate::Value {
211    #[inline]
212    fn from(v: IOCondition) -> Self {
213        ToValue::to_value(&v)
214    }
215}
216
217bitflags! {
218    /// Flags which influence the parsing.
219    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
220    #[doc(alias = "GKeyFileFlags")]
221    pub struct KeyFileFlags: u32 {
222        /// No flags, default behaviour
223        #[doc(alias = "G_KEY_FILE_NONE")]
224        const NONE = ffi::G_KEY_FILE_NONE as _;
225        /// Use this flag if you plan to write the
226        ///   (possibly modified) contents of the key file back to a file;
227        ///   otherwise all comments will be lost when the key file is
228        ///   written back.
229        #[doc(alias = "G_KEY_FILE_KEEP_COMMENTS")]
230        const KEEP_COMMENTS = ffi::G_KEY_FILE_KEEP_COMMENTS as _;
231        /// Use this flag if you plan to write the
232        ///   (possibly modified) contents of the key file back to a file;
233        ///   otherwise only the translations for the current language will be
234        ///   written back.
235        #[doc(alias = "G_KEY_FILE_KEEP_TRANSLATIONS")]
236        const KEEP_TRANSLATIONS = ffi::G_KEY_FILE_KEEP_TRANSLATIONS as _;
237    }
238}
239
240#[doc(hidden)]
241impl IntoGlib for KeyFileFlags {
242    type GlibType = ffi::GKeyFileFlags;
243
244    #[inline]
245    fn into_glib(self) -> ffi::GKeyFileFlags {
246        self.bits()
247    }
248}
249
250#[doc(hidden)]
251impl FromGlib<ffi::GKeyFileFlags> for KeyFileFlags {
252    #[inline]
253    unsafe fn from_glib(value: ffi::GKeyFileFlags) -> Self {
254        Self::from_bits_truncate(value)
255    }
256}
257
258bitflags! {
259    /// Flags specifying the level of log messages.
260    ///
261    /// It is possible to change how GLib treats messages of the various
262    /// levels using `log_set_handler()` and `log_set_fatal_mask()`.
263    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
264    #[doc(alias = "GLogLevelFlags")]
265    pub struct LogLevelFlags: u32 {
266        /// internal flag
267        #[doc(alias = "G_LOG_FLAG_RECURSION")]
268        const FLAG_RECURSION = ffi::G_LOG_FLAG_RECURSION as _;
269        /// internal flag
270        #[doc(alias = "G_LOG_FLAG_FATAL")]
271        const FLAG_FATAL = ffi::G_LOG_FLAG_FATAL as _;
272        /// log level for errors, see `error()`.
273        ///   This level is also used for messages produced by `assert()`.
274        #[doc(alias = "G_LOG_LEVEL_ERROR")]
275        const LEVEL_ERROR = ffi::G_LOG_LEVEL_ERROR as _;
276        /// log level for critical warning messages, see
277        ///   `critical()`. This level is also used for messages produced by
278        ///   `return_if_fail()` and `return_val_if_fail()`.
279        #[doc(alias = "G_LOG_LEVEL_CRITICAL")]
280        const LEVEL_CRITICAL = ffi::G_LOG_LEVEL_CRITICAL as _;
281        /// log level for warnings, see `warning()`
282        #[doc(alias = "G_LOG_LEVEL_WARNING")]
283        const LEVEL_WARNING = ffi::G_LOG_LEVEL_WARNING as _;
284        /// log level for messages, see `message()`
285        #[doc(alias = "G_LOG_LEVEL_MESSAGE")]
286        const LEVEL_MESSAGE = ffi::G_LOG_LEVEL_MESSAGE as _;
287        /// log level for informational messages, see `info()`
288        #[doc(alias = "G_LOG_LEVEL_INFO")]
289        const LEVEL_INFO = ffi::G_LOG_LEVEL_INFO as _;
290        /// log level for debug messages, see `debug()`
291        #[doc(alias = "G_LOG_LEVEL_DEBUG")]
292        const LEVEL_DEBUG = ffi::G_LOG_LEVEL_DEBUG as _;
293        /// a mask including all log levels
294        #[doc(alias = "G_LOG_LEVEL_MASK")]
295        const LEVEL_MASK = ffi::G_LOG_LEVEL_MASK as _;
296    }
297}
298
299#[doc(hidden)]
300impl IntoGlib for LogLevelFlags {
301    type GlibType = ffi::GLogLevelFlags;
302
303    #[inline]
304    fn into_glib(self) -> ffi::GLogLevelFlags {
305        self.bits()
306    }
307}
308
309#[doc(hidden)]
310impl FromGlib<ffi::GLogLevelFlags> for LogLevelFlags {
311    #[inline]
312    unsafe fn from_glib(value: ffi::GLogLevelFlags) -> Self {
313        Self::from_bits_truncate(value)
314    }
315}
316
317#[cfg(feature = "v2_72")]
318bitflags! {
319    /// Flags to pass to `GLib::MainContext::new_with_flags()` which affect the
320    /// behaviour of a [`MainContext`][crate::MainContext].
321    #[cfg_attr(docsrs, doc(cfg(feature = "v2_72")))]
322    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
323    #[doc(alias = "GMainContextFlags")]
324    pub struct MainContextFlags: u32 {
325        /// Default behaviour.
326        #[doc(alias = "G_MAIN_CONTEXT_FLAGS_NONE")]
327        const NONE = ffi::G_MAIN_CONTEXT_FLAGS_NONE as _;
328        /// Assume that polling for events will
329        /// free the thread to process other jobs. That's useful if you're using
330        /// `g_main_context_{prepare,query,check,dispatch}` to integrate GMainContext in
331        /// other event loops.
332        #[doc(alias = "G_MAIN_CONTEXT_FLAGS_OWNERLESS_POLLING")]
333        const OWNERLESS_POLLING = ffi::G_MAIN_CONTEXT_FLAGS_OWNERLESS_POLLING as _;
334    }
335}
336
337#[cfg(feature = "v2_72")]
338#[cfg_attr(docsrs, doc(cfg(feature = "v2_72")))]
339#[doc(hidden)]
340impl IntoGlib for MainContextFlags {
341    type GlibType = ffi::GMainContextFlags;
342
343    #[inline]
344    fn into_glib(self) -> ffi::GMainContextFlags {
345        self.bits()
346    }
347}
348
349#[cfg(feature = "v2_72")]
350#[cfg_attr(docsrs, doc(cfg(feature = "v2_72")))]
351#[doc(hidden)]
352impl FromGlib<ffi::GMainContextFlags> for MainContextFlags {
353    #[inline]
354    unsafe fn from_glib(value: ffi::GMainContextFlags) -> Self {
355        Self::from_bits_truncate(value)
356    }
357}
358
359bitflags! {
360    /// Flags which modify individual options.
361    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
362    #[doc(alias = "GOptionFlags")]
363    pub struct OptionFlags: u32 {
364        /// No flags.
365        #[doc(alias = "G_OPTION_FLAG_NONE")]
366        const NONE = ffi::G_OPTION_FLAG_NONE as _;
367        /// The option doesn't appear in `--help` output.
368        #[doc(alias = "G_OPTION_FLAG_HIDDEN")]
369        const HIDDEN = ffi::G_OPTION_FLAG_HIDDEN as _;
370        /// The option appears in the main section of the
371        ///   `--help` output, even if it is defined in a group.
372        #[doc(alias = "G_OPTION_FLAG_IN_MAIN")]
373        const IN_MAIN = ffi::G_OPTION_FLAG_IN_MAIN as _;
374        /// For options of the [`OptionArg::None`][crate::OptionArg::None] kind, this
375        ///   flag indicates that the sense of the option is reversed. i.e. [`false`] will
376        ///   be stored into the argument rather than [`true`].
377        #[doc(alias = "G_OPTION_FLAG_REVERSE")]
378        const REVERSE = ffi::G_OPTION_FLAG_REVERSE as _;
379        /// For options of the [`OptionArg::Callback`][crate::OptionArg::Callback] kind,
380        ///   this flag indicates that the callback does not take any argument
381        ///   (like a [`OptionArg::None`][crate::OptionArg::None] option). Since 2.8
382        #[doc(alias = "G_OPTION_FLAG_NO_ARG")]
383        const NO_ARG = ffi::G_OPTION_FLAG_NO_ARG as _;
384        /// For options of the [`OptionArg::Callback`][crate::OptionArg::Callback]
385        ///   kind, this flag indicates that the argument should be passed to the
386        ///   callback in the GLib filename encoding rather than UTF-8. Since 2.8
387        #[doc(alias = "G_OPTION_FLAG_FILENAME")]
388        const FILENAME = ffi::G_OPTION_FLAG_FILENAME as _;
389        /// For options of the [`OptionArg::Callback`][crate::OptionArg::Callback]
390        ///   kind, this flag indicates that the argument supply is optional.
391        ///   If no argument is given then data of `GOptionParseFunc` will be
392        ///   set to NULL. Since 2.8
393        #[doc(alias = "G_OPTION_FLAG_OPTIONAL_ARG")]
394        const OPTIONAL_ARG = ffi::G_OPTION_FLAG_OPTIONAL_ARG as _;
395        /// This flag turns off the automatic conflict
396        ///   resolution which prefixes long option names with `groupname-` if
397        ///   there is a conflict. This option should only be used in situations
398        ///   where aliasing is necessary to model some legacy commandline interface.
399        ///   It is not safe to use this option, unless all option groups are under
400        ///   your direct control. Since 2.8.
401        #[doc(alias = "G_OPTION_FLAG_NOALIAS")]
402        const NOALIAS = ffi::G_OPTION_FLAG_NOALIAS as _;
403        /// This flag marks the option as deprecated in the `--help`.
404        ///
405        /// You should update the description of the option to describe what
406        /// the user should do in response to the deprecation, for instance:
407        /// remove the option, or replace it with another one.
408        #[cfg(feature = "v2_84")]
409        #[cfg_attr(docsrs, doc(cfg(feature = "v2_84")))]
410        #[doc(alias = "G_OPTION_FLAG_DEPRECATED")]
411        const DEPRECATED = ffi::G_OPTION_FLAG_DEPRECATED as _;
412    }
413}
414
415#[doc(hidden)]
416impl IntoGlib for OptionFlags {
417    type GlibType = ffi::GOptionFlags;
418
419    #[inline]
420    fn into_glib(self) -> ffi::GOptionFlags {
421        self.bits()
422    }
423}
424
425#[doc(hidden)]
426impl FromGlib<ffi::GOptionFlags> for OptionFlags {
427    #[inline]
428    unsafe fn from_glib(value: ffi::GOptionFlags) -> Self {
429        Self::from_bits_truncate(value)
430    }
431}
432
433bitflags! {
434    /// Flags specifying compile-time options.
435    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
436    #[doc(alias = "GRegexCompileFlags")]
437    pub struct RegexCompileFlags: u32 {
438        /// No special options set. Since: 2.74
439        #[doc(alias = "G_REGEX_DEFAULT")]
440        const DEFAULT = ffi::G_REGEX_DEFAULT as _;
441        /// Letters in the pattern match both upper- and
442        ///     lowercase letters. This option can be changed within a pattern
443        ///     by a "(?i)" option setting.
444        #[doc(alias = "G_REGEX_CASELESS")]
445        const CASELESS = ffi::G_REGEX_CASELESS as _;
446        /// By default, GRegex treats the strings as consisting
447        ///     of a single line of characters (even if it actually contains
448        ///     newlines). The "start of line" metacharacter ("^") matches only
449        ///     at the start of the string, while the "end of line" metacharacter
450        ///     ("$") matches only at the end of the string, or before a terminating
451        ///     newline (unless [`DOLLAR_ENDONLY`][Self::DOLLAR_ENDONLY] is set). When
452        ///     [`MULTILINE`][Self::MULTILINE] is set, the "start of line" and "end of line"
453        ///     constructs match immediately following or immediately before any
454        ///     newline in the string, respectively, as well as at the very start
455        ///     and end. This can be changed within a pattern by a "(?m)" option
456        ///     setting.
457        #[doc(alias = "G_REGEX_MULTILINE")]
458        const MULTILINE = ffi::G_REGEX_MULTILINE as _;
459        /// A dot metacharacter (".") in the pattern matches all
460        ///     characters, including newlines. Without it, newlines are excluded.
461        ///     This option can be changed within a pattern by a ("?s") option setting.
462        #[doc(alias = "G_REGEX_DOTALL")]
463        const DOTALL = ffi::G_REGEX_DOTALL as _;
464        /// Whitespace data characters in the pattern are
465        ///     totally ignored except when escaped or inside a character class.
466        ///     Whitespace does not include the VT character (code 11). In addition,
467        ///     characters between an unescaped "#" outside a character class and
468        ///     the next newline character, inclusive, are also ignored. This can
469        ///     be changed within a pattern by a "(?x)" option setting.
470        #[doc(alias = "G_REGEX_EXTENDED")]
471        const EXTENDED = ffi::G_REGEX_EXTENDED as _;
472        /// The pattern is forced to be "anchored", that is,
473        ///     it is constrained to match only at the first matching point in the
474        ///     string that is being searched. This effect can also be achieved by
475        ///     appropriate constructs in the pattern itself such as the "^"
476        ///     metacharacter.
477        #[doc(alias = "G_REGEX_ANCHORED")]
478        const ANCHORED = ffi::G_REGEX_ANCHORED as _;
479        /// A dollar metacharacter ("$") in the pattern
480        ///     matches only at the end of the string. Without this option, a
481        ///     dollar also matches immediately before the final character if
482        ///     it is a newline (but not before any other newlines). This option
483        ///     is ignored if [`MULTILINE`][Self::MULTILINE] is set.
484        #[doc(alias = "G_REGEX_DOLLAR_ENDONLY")]
485        const DOLLAR_ENDONLY = ffi::G_REGEX_DOLLAR_ENDONLY as _;
486        /// Inverts the "greediness" of the quantifiers so that
487        ///     they are not greedy by default, but become greedy if followed by "?".
488        ///     It can also be set by a "(?U)" option setting within the pattern.
489        #[doc(alias = "G_REGEX_UNGREEDY")]
490        const UNGREEDY = ffi::G_REGEX_UNGREEDY as _;
491        /// Usually strings must be valid UTF-8 strings, using this
492        ///     flag they are considered as a raw sequence of bytes.
493        #[doc(alias = "G_REGEX_RAW")]
494        const RAW = ffi::G_REGEX_RAW as _;
495        /// Disables the use of numbered capturing
496        ///     parentheses in the pattern. Any opening parenthesis that is not
497        ///     followed by "?" behaves as if it were followed by "?:" but named
498        ///     parentheses can still be used for capturing (and they acquire numbers
499        ///     in the usual way).
500        #[doc(alias = "G_REGEX_NO_AUTO_CAPTURE")]
501        const NO_AUTO_CAPTURE = ffi::G_REGEX_NO_AUTO_CAPTURE as _;
502        /// Since 2.74 and the port to pcre2, requests JIT
503        ///     compilation, which, if the just-in-time compiler is available, further
504        ///     processes a compiled pattern into machine code that executes much
505        ///     faster. However, it comes at the cost of extra processing before the
506        ///     match is performed, so it is most beneficial to use this when the same
507        ///     compiled pattern is used for matching many times. Before 2.74 this
508        ///     option used the built-in non-JIT optimizations in pcre1.
509        #[doc(alias = "G_REGEX_OPTIMIZE")]
510        const OPTIMIZE = ffi::G_REGEX_OPTIMIZE as _;
511        /// Limits an unanchored pattern to match before (or at) the
512        ///     first newline. Since: 2.34
513        #[doc(alias = "G_REGEX_FIRSTLINE")]
514        const FIRSTLINE = ffi::G_REGEX_FIRSTLINE as _;
515        /// Names used to identify capturing subpatterns need not
516        ///     be unique. This can be helpful for certain types of pattern when it
517        ///     is known that only one instance of the named subpattern can ever be
518        ///     matched.
519        #[doc(alias = "G_REGEX_DUPNAMES")]
520        const DUPNAMES = ffi::G_REGEX_DUPNAMES as _;
521        /// Usually any newline character or character sequence is
522        ///     recognized. If this option is set, the only recognized newline character
523        ///     is '\r'.
524        #[doc(alias = "G_REGEX_NEWLINE_CR")]
525        const NEWLINE_CR = ffi::G_REGEX_NEWLINE_CR as _;
526        /// Usually any newline character or character sequence is
527        ///     recognized. If this option is set, the only recognized newline character
528        ///     is '\n'.
529        #[doc(alias = "G_REGEX_NEWLINE_LF")]
530        const NEWLINE_LF = ffi::G_REGEX_NEWLINE_LF as _;
531        #[doc(alias = "G_REGEX_NEWLINE_RESERVED1")]
532        const NEWLINE_RESERVED1 = ffi::G_REGEX_NEWLINE_RESERVED1 as _;
533    }
534}
535
536#[doc(hidden)]
537impl IntoGlib for RegexCompileFlags {
538    type GlibType = ffi::GRegexCompileFlags;
539
540    #[inline]
541    fn into_glib(self) -> ffi::GRegexCompileFlags {
542        self.bits()
543    }
544}
545
546#[doc(hidden)]
547impl FromGlib<ffi::GRegexCompileFlags> for RegexCompileFlags {
548    #[inline]
549    unsafe fn from_glib(value: ffi::GRegexCompileFlags) -> Self {
550        Self::from_bits_truncate(value)
551    }
552}
553
554bitflags! {
555    /// Flags specifying match-time options.
556    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
557    #[doc(alias = "GRegexMatchFlags")]
558    pub struct RegexMatchFlags: u32 {
559        /// No special options set. Since: 2.74
560        #[doc(alias = "G_REGEX_MATCH_DEFAULT")]
561        const DEFAULT = ffi::G_REGEX_MATCH_DEFAULT as _;
562        /// The pattern is forced to be "anchored", that is,
563        ///     it is constrained to match only at the first matching point in the
564        ///     string that is being searched. This effect can also be achieved by
565        ///     appropriate constructs in the pattern itself such as the "^"
566        ///     metacharacter.
567        #[doc(alias = "G_REGEX_MATCH_ANCHORED")]
568        const ANCHORED = ffi::G_REGEX_MATCH_ANCHORED as _;
569        /// Specifies that first character of the string is
570        ///     not the beginning of a line, so the circumflex metacharacter should
571        ///     not match before it. Setting this without [`RegexCompileFlags::MULTILINE`][crate::RegexCompileFlags::MULTILINE] (at
572        ///     compile time) causes circumflex never to match. This option affects
573        ///     only the behaviour of the circumflex metacharacter, it does not
574        ///     affect "\A".
575        #[doc(alias = "G_REGEX_MATCH_NOTBOL")]
576        const NOTBOL = ffi::G_REGEX_MATCH_NOTBOL as _;
577        /// Specifies that the end of the subject string is
578        ///     not the end of a line, so the dollar metacharacter should not match
579        ///     it nor (except in multiline mode) a newline immediately before it.
580        ///     Setting this without [`RegexCompileFlags::MULTILINE`][crate::RegexCompileFlags::MULTILINE] (at compile time) causes
581        ///     dollar never to match. This option affects only the behaviour of
582        ///     the dollar metacharacter, it does not affect "\Z" or "\z".
583        #[doc(alias = "G_REGEX_MATCH_NOTEOL")]
584        const NOTEOL = ffi::G_REGEX_MATCH_NOTEOL as _;
585        /// An empty string is not considered to be a valid
586        ///     match if this option is set. If there are alternatives in the pattern,
587        ///     they are tried. If all the alternatives match the empty string, the
588        ///     entire match fails. For example, if the pattern "a?b?" is applied to
589        ///     a string not beginning with "a" or "b", it matches the empty string
590        ///     at the start of the string. With this flag set, this match is not
591        ///     valid, so GRegex searches further into the string for occurrences
592        ///     of "a" or "b".
593        #[doc(alias = "G_REGEX_MATCH_NOTEMPTY")]
594        const NOTEMPTY = ffi::G_REGEX_MATCH_NOTEMPTY as _;
595        /// Turns on the partial matching feature, for more
596        ///     documentation on partial matching see g_match_info_is_partial_match().
597        #[doc(alias = "G_REGEX_MATCH_PARTIAL")]
598        const PARTIAL = ffi::G_REGEX_MATCH_PARTIAL as _;
599        /// Overrides the newline definition set when
600        ///     creating a new #GRegex, setting the '\r' character as line terminator.
601        #[doc(alias = "G_REGEX_MATCH_NEWLINE_CR")]
602        const NEWLINE_CR = ffi::G_REGEX_MATCH_NEWLINE_CR as _;
603        /// Overrides the newline definition set when
604        ///     creating a new #GRegex, setting the '\n' character as line terminator.
605        #[doc(alias = "G_REGEX_MATCH_NEWLINE_LF")]
606        const NEWLINE_LF = ffi::G_REGEX_MATCH_NEWLINE_LF as _;
607        /// Overrides the newline definition set when
608        ///     creating a new #GRegex, setting the '\r\n' characters sequence as line terminator.
609        #[doc(alias = "G_REGEX_MATCH_NEWLINE_CRLF")]
610        const NEWLINE_CRLF = ffi::G_REGEX_MATCH_NEWLINE_CRLF as _;
611        /// Overrides the newline definition set when
612        ///     creating a new #GRegex, any Unicode newline sequence
613        ///     is recognised as a newline. These are '\r', '\n' and '\rn', and the
614        ///     single characters U+000B LINE TABULATION, U+000C FORM FEED (FF),
615        ///     U+0085 NEXT LINE (NEL), U+2028 LINE SEPARATOR and
616        ///     U+2029 PARAGRAPH SEPARATOR.
617        #[doc(alias = "G_REGEX_MATCH_NEWLINE_ANY")]
618        const NEWLINE_ANY = ffi::G_REGEX_MATCH_NEWLINE_ANY as _;
619        /// Overrides the newline definition set when
620        ///     creating a new #GRegex; any '\r', '\n', or '\r\n' character sequence
621        ///     is recognized as a newline. Since: 2.34
622        #[doc(alias = "G_REGEX_MATCH_NEWLINE_ANYCRLF")]
623        const NEWLINE_ANYCRLF = ffi::G_REGEX_MATCH_NEWLINE_ANYCRLF as _;
624        /// Overrides the newline definition for "\R" set when
625        ///     creating a new #GRegex; only '\r', '\n', or '\r\n' character sequences
626        ///     are recognized as a newline by "\R". Since: 2.34
627        #[doc(alias = "G_REGEX_MATCH_BSR_ANYCRLF")]
628        const BSR_ANYCRLF = ffi::G_REGEX_MATCH_BSR_ANYCRLF as _;
629        /// Overrides the newline definition for "\R" set when
630        ///     creating a new #GRegex; any Unicode newline character or character sequence
631        ///     are recognized as a newline by "\R". These are '\r', '\n' and '\rn', and the
632        ///     single characters U+000B LINE TABULATION, U+000C FORM FEED (FF),
633        ///     U+0085 NEXT LINE (NEL), U+2028 LINE SEPARATOR and
634        ///     U+2029 PARAGRAPH SEPARATOR. Since: 2.34
635        #[doc(alias = "G_REGEX_MATCH_BSR_ANY")]
636        const BSR_ANY = ffi::G_REGEX_MATCH_BSR_ANY as _;
637        /// An alias for [`PARTIAL`][Self::PARTIAL]. Since: 2.34
638        #[doc(alias = "G_REGEX_MATCH_PARTIAL_SOFT")]
639        const PARTIAL_SOFT = ffi::G_REGEX_MATCH_PARTIAL_SOFT as _;
640        /// Turns on the partial matching feature. In contrast to
641        ///     to [`PARTIAL_SOFT`][Self::PARTIAL_SOFT], this stops matching as soon as a partial match
642        ///     is found, without continuing to search for a possible complete match. See
643        ///     g_match_info_is_partial_match() for more information. Since: 2.34
644        #[doc(alias = "G_REGEX_MATCH_PARTIAL_HARD")]
645        const PARTIAL_HARD = ffi::G_REGEX_MATCH_PARTIAL_HARD as _;
646        /// Like [`NOTEMPTY`][Self::NOTEMPTY], but only applied to
647        ///     the start of the matched string. For anchored
648        ///     patterns this can only happen for pattern containing "\K". Since: 2.34
649        #[doc(alias = "G_REGEX_MATCH_NOTEMPTY_ATSTART")]
650        const NOTEMPTY_ATSTART = ffi::G_REGEX_MATCH_NOTEMPTY_ATSTART as _;
651    }
652}
653
654#[doc(hidden)]
655impl IntoGlib for RegexMatchFlags {
656    type GlibType = ffi::GRegexMatchFlags;
657
658    #[inline]
659    fn into_glib(self) -> ffi::GRegexMatchFlags {
660        self.bits()
661    }
662}
663
664#[doc(hidden)]
665impl FromGlib<ffi::GRegexMatchFlags> for RegexMatchFlags {
666    #[inline]
667    unsafe fn from_glib(value: ffi::GRegexMatchFlags) -> Self {
668        Self::from_bits_truncate(value)
669    }
670}
671
672bitflags! {
673    /// Flags passed to g_spawn_sync(), g_spawn_async() and g_spawn_async_with_pipes().
674    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
675    #[doc(alias = "GSpawnFlags")]
676    pub struct SpawnFlags: u32 {
677        /// no flags, default behaviour
678        #[doc(alias = "G_SPAWN_DEFAULT")]
679        const DEFAULT = ffi::G_SPAWN_DEFAULT as _;
680        /// the parent's open file descriptors will
681        ///     be inherited by the child; otherwise all descriptors except stdin,
682        ///     stdout and stderr will be closed before calling exec() in the child.
683        #[doc(alias = "G_SPAWN_LEAVE_DESCRIPTORS_OPEN")]
684        const LEAVE_DESCRIPTORS_OPEN = ffi::G_SPAWN_LEAVE_DESCRIPTORS_OPEN as _;
685        /// the child will not be automatically reaped;
686        ///     you must use g_child_watch_add() yourself (or call waitpid() or handle
687        ///     `SIGCHLD` yourself), or the child will become a zombie.
688        #[doc(alias = "G_SPAWN_DO_NOT_REAP_CHILD")]
689        const DO_NOT_REAP_CHILD = ffi::G_SPAWN_DO_NOT_REAP_CHILD as _;
690        /// `argv[0]` need not be an absolute path, it will be
691        ///     looked for in the user's `PATH`.
692        #[doc(alias = "G_SPAWN_SEARCH_PATH")]
693        const SEARCH_PATH = ffi::G_SPAWN_SEARCH_PATH as _;
694        /// the child's standard output will be discarded,
695        ///     instead of going to the same location as the parent's standard output.
696        #[doc(alias = "G_SPAWN_STDOUT_TO_DEV_NULL")]
697        const STDOUT_TO_DEV_NULL = ffi::G_SPAWN_STDOUT_TO_DEV_NULL as _;
698        /// the child's standard error will be discarded.
699        #[doc(alias = "G_SPAWN_STDERR_TO_DEV_NULL")]
700        const STDERR_TO_DEV_NULL = ffi::G_SPAWN_STDERR_TO_DEV_NULL as _;
701        /// the child will inherit the parent's standard
702        ///     input (by default, the child's standard input is attached to `/dev/null`).
703        #[doc(alias = "G_SPAWN_CHILD_INHERITS_STDIN")]
704        const CHILD_INHERITS_STDIN = ffi::G_SPAWN_CHILD_INHERITS_STDIN as _;
705        /// the first element of `argv` is the file to
706        ///     execute, while the remaining elements are the actual argument vector
707        ///     to pass to the file. Normally g_spawn_async_with_pipes() uses `argv[0]`
708        ///     as the file to execute, and passes all of `argv` to the child.
709        #[doc(alias = "G_SPAWN_FILE_AND_ARGV_ZERO")]
710        const FILE_AND_ARGV_ZERO = ffi::G_SPAWN_FILE_AND_ARGV_ZERO as _;
711        /// if `argv[0]` is not an absolute path,
712        ///     it will be looked for in the `PATH` from the passed child environment.
713        ///     Since: 2.34
714        #[doc(alias = "G_SPAWN_SEARCH_PATH_FROM_ENVP")]
715        const SEARCH_PATH_FROM_ENVP = ffi::G_SPAWN_SEARCH_PATH_FROM_ENVP as _;
716        /// create all pipes with the `O_CLOEXEC` flag set.
717        ///     Since: 2.40
718        #[doc(alias = "G_SPAWN_CLOEXEC_PIPES")]
719        const CLOEXEC_PIPES = ffi::G_SPAWN_CLOEXEC_PIPES as _;
720        /// The child will inherit the parent's standard output.
721        #[cfg(feature = "v2_74")]
722        #[cfg_attr(docsrs, doc(cfg(feature = "v2_74")))]
723        #[doc(alias = "G_SPAWN_CHILD_INHERITS_STDOUT")]
724        const CHILD_INHERITS_STDOUT = ffi::G_SPAWN_CHILD_INHERITS_STDOUT as _;
725        /// The child will inherit the parent's standard error.
726        #[cfg(feature = "v2_74")]
727        #[cfg_attr(docsrs, doc(cfg(feature = "v2_74")))]
728        #[doc(alias = "G_SPAWN_CHILD_INHERITS_STDERR")]
729        const CHILD_INHERITS_STDERR = ffi::G_SPAWN_CHILD_INHERITS_STDERR as _;
730        /// The child's standard input is attached to `/dev/null`.
731        #[cfg(feature = "v2_74")]
732        #[cfg_attr(docsrs, doc(cfg(feature = "v2_74")))]
733        #[doc(alias = "G_SPAWN_STDIN_FROM_DEV_NULL")]
734        const STDIN_FROM_DEV_NULL = ffi::G_SPAWN_STDIN_FROM_DEV_NULL as _;
735    }
736}
737
738#[doc(hidden)]
739impl IntoGlib for SpawnFlags {
740    type GlibType = ffi::GSpawnFlags;
741
742    #[inline]
743    fn into_glib(self) -> ffi::GSpawnFlags {
744        self.bits()
745    }
746}
747
748#[doc(hidden)]
749impl FromGlib<ffi::GSpawnFlags> for SpawnFlags {
750    #[inline]
751    unsafe fn from_glib(value: ffi::GSpawnFlags) -> Self {
752        Self::from_bits_truncate(value)
753    }
754}
755
756#[cfg(feature = "v2_66")]
757bitflags! {
758    /// Flags that describe a URI.
759    ///
760    /// When parsing a URI, if you need to choose different flags based on
761    /// the type of URI, you can use g_uri_peek_scheme() on the URI string
762    /// to check the scheme first, and use that to decide what flags to
763    /// parse it with.
764    #[cfg_attr(docsrs, doc(cfg(feature = "v2_66")))]
765    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
766    #[doc(alias = "GUriFlags")]
767    pub struct UriFlags: u32 {
768        /// No flags set.
769        #[doc(alias = "G_URI_FLAGS_NONE")]
770        const NONE = ffi::G_URI_FLAGS_NONE as _;
771        /// Parse the URI more relaxedly than the
772        ///     [RFC 3986](https://tools.ietf.org/html/rfc3986) grammar specifies,
773        ///     fixing up or ignoring common mistakes in URIs coming from external
774        ///     sources. This is also needed for some obscure URI schemes where `;`
775        ///     separates the host from the path. Don’t use this flag unless you need to.
776        #[doc(alias = "G_URI_FLAGS_PARSE_RELAXED")]
777        const PARSE_RELAXED = ffi::G_URI_FLAGS_PARSE_RELAXED as _;
778        /// The userinfo field may contain a password,
779        ///     which will be separated from the username by `:`.
780        #[doc(alias = "G_URI_FLAGS_HAS_PASSWORD")]
781        const HAS_PASSWORD = ffi::G_URI_FLAGS_HAS_PASSWORD as _;
782        /// The userinfo may contain additional
783        ///     authentication-related parameters, which will be separated from
784        ///     the username and/or password by `;`.
785        #[doc(alias = "G_URI_FLAGS_HAS_AUTH_PARAMS")]
786        const HAS_AUTH_PARAMS = ffi::G_URI_FLAGS_HAS_AUTH_PARAMS as _;
787        /// When parsing a URI, this indicates that `%`-encoded
788        ///     characters in the userinfo, path, query, and fragment fields
789        ///     should not be decoded. (And likewise the host field if
790        ///     [`NON_DNS`][Self::NON_DNS] is also set.) When building a URI, it indicates
791        ///     that you have already `%`-encoded the components, and so #GUri
792        ///     should not do any encoding itself.
793        #[doc(alias = "G_URI_FLAGS_ENCODED")]
794        const ENCODED = ffi::G_URI_FLAGS_ENCODED as _;
795        /// The host component should not be assumed to be a
796        ///     DNS hostname or IP address (for example, for `smb` URIs with NetBIOS
797        ///     hostnames).
798        #[doc(alias = "G_URI_FLAGS_NON_DNS")]
799        const NON_DNS = ffi::G_URI_FLAGS_NON_DNS as _;
800        /// Same as [`ENCODED`][Self::ENCODED], for the query
801        ///     field only.
802        #[doc(alias = "G_URI_FLAGS_ENCODED_QUERY")]
803        const ENCODED_QUERY = ffi::G_URI_FLAGS_ENCODED_QUERY as _;
804        /// Same as [`ENCODED`][Self::ENCODED], for the path only.
805        #[doc(alias = "G_URI_FLAGS_ENCODED_PATH")]
806        const ENCODED_PATH = ffi::G_URI_FLAGS_ENCODED_PATH as _;
807        /// Same as [`ENCODED`][Self::ENCODED], for the
808        ///     fragment only.
809        #[doc(alias = "G_URI_FLAGS_ENCODED_FRAGMENT")]
810        const ENCODED_FRAGMENT = ffi::G_URI_FLAGS_ENCODED_FRAGMENT as _;
811        /// A scheme-based normalization will be applied.
812        ///     For example, when parsing an HTTP URI changing omitted path to `/` and
813        ///     omitted port to `80`; and when building a URI, changing empty path to `/`
814        ///     and default port `80`). This only supports a subset of known schemes. (Since: 2.68)
815        #[doc(alias = "G_URI_FLAGS_SCHEME_NORMALIZE")]
816        const SCHEME_NORMALIZE = ffi::G_URI_FLAGS_SCHEME_NORMALIZE as _;
817    }
818}
819
820#[cfg(feature = "v2_66")]
821#[cfg_attr(docsrs, doc(cfg(feature = "v2_66")))]
822#[doc(hidden)]
823impl IntoGlib for UriFlags {
824    type GlibType = ffi::GUriFlags;
825
826    #[inline]
827    fn into_glib(self) -> ffi::GUriFlags {
828        self.bits()
829    }
830}
831
832#[cfg(feature = "v2_66")]
833#[cfg_attr(docsrs, doc(cfg(feature = "v2_66")))]
834#[doc(hidden)]
835impl FromGlib<ffi::GUriFlags> for UriFlags {
836    #[inline]
837    unsafe fn from_glib(value: ffi::GUriFlags) -> Self {
838        Self::from_bits_truncate(value)
839    }
840}
841
842#[cfg(feature = "v2_66")]
843bitflags! {
844    /// Flags describing what parts of the URI to hide in
845    /// g_uri_to_string_partial(). Note that [`PASSWORD`][Self::PASSWORD] and
846    /// [`AUTH_PARAMS`][Self::AUTH_PARAMS] will only work if the #GUri was parsed with
847    /// the corresponding flags.
848    #[cfg_attr(docsrs, doc(cfg(feature = "v2_66")))]
849    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
850    #[doc(alias = "GUriHideFlags")]
851    pub struct UriHideFlags: u32 {
852        /// No flags set.
853        #[doc(alias = "G_URI_HIDE_NONE")]
854        const NONE = ffi::G_URI_HIDE_NONE as _;
855        /// Hide the userinfo.
856        #[doc(alias = "G_URI_HIDE_USERINFO")]
857        const USERINFO = ffi::G_URI_HIDE_USERINFO as _;
858        /// Hide the password.
859        #[doc(alias = "G_URI_HIDE_PASSWORD")]
860        const PASSWORD = ffi::G_URI_HIDE_PASSWORD as _;
861        /// Hide the auth_params.
862        #[doc(alias = "G_URI_HIDE_AUTH_PARAMS")]
863        const AUTH_PARAMS = ffi::G_URI_HIDE_AUTH_PARAMS as _;
864        /// Hide the query.
865        #[doc(alias = "G_URI_HIDE_QUERY")]
866        const QUERY = ffi::G_URI_HIDE_QUERY as _;
867        /// Hide the fragment.
868        #[doc(alias = "G_URI_HIDE_FRAGMENT")]
869        const FRAGMENT = ffi::G_URI_HIDE_FRAGMENT as _;
870    }
871}
872
873#[cfg(feature = "v2_66")]
874#[cfg_attr(docsrs, doc(cfg(feature = "v2_66")))]
875#[doc(hidden)]
876impl IntoGlib for UriHideFlags {
877    type GlibType = ffi::GUriHideFlags;
878
879    #[inline]
880    fn into_glib(self) -> ffi::GUriHideFlags {
881        self.bits()
882    }
883}
884
885#[cfg(feature = "v2_66")]
886#[cfg_attr(docsrs, doc(cfg(feature = "v2_66")))]
887#[doc(hidden)]
888impl FromGlib<ffi::GUriHideFlags> for UriHideFlags {
889    #[inline]
890    unsafe fn from_glib(value: ffi::GUriHideFlags) -> Self {
891        Self::from_bits_truncate(value)
892    }
893}
894
895#[cfg(feature = "v2_66")]
896bitflags! {
897    /// Flags modifying the way parameters are handled by g_uri_parse_params() and
898    /// #GUriParamsIter.
899    #[cfg_attr(docsrs, doc(cfg(feature = "v2_66")))]
900    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
901    #[doc(alias = "GUriParamsFlags")]
902    pub struct UriParamsFlags: u32 {
903        /// No flags set.
904        #[doc(alias = "G_URI_PARAMS_NONE")]
905        const NONE = ffi::G_URI_PARAMS_NONE as _;
906        /// Parameter names are case insensitive.
907        #[doc(alias = "G_URI_PARAMS_CASE_INSENSITIVE")]
908        const CASE_INSENSITIVE = ffi::G_URI_PARAMS_CASE_INSENSITIVE as _;
909        /// Replace `+` with space character. Only useful for
910        ///     URLs on the web, using the `https` or `http` schemas.
911        #[doc(alias = "G_URI_PARAMS_WWW_FORM")]
912        const WWW_FORM = ffi::G_URI_PARAMS_WWW_FORM as _;
913        /// See [`UriFlags::PARSE_RELAXED`][crate::UriFlags::PARSE_RELAXED].
914        #[doc(alias = "G_URI_PARAMS_PARSE_RELAXED")]
915        const PARSE_RELAXED = ffi::G_URI_PARAMS_PARSE_RELAXED as _;
916    }
917}
918
919#[cfg(feature = "v2_66")]
920#[cfg_attr(docsrs, doc(cfg(feature = "v2_66")))]
921#[doc(hidden)]
922impl IntoGlib for UriParamsFlags {
923    type GlibType = ffi::GUriParamsFlags;
924
925    #[inline]
926    fn into_glib(self) -> ffi::GUriParamsFlags {
927        self.bits()
928    }
929}
930
931#[cfg(feature = "v2_66")]
932#[cfg_attr(docsrs, doc(cfg(feature = "v2_66")))]
933#[doc(hidden)]
934impl FromGlib<ffi::GUriParamsFlags> for UriParamsFlags {
935    #[inline]
936    unsafe fn from_glib(value: ffi::GUriParamsFlags) -> Self {
937        Self::from_bits_truncate(value)
938    }
939}