dconf Paths

dconf Paths — utility functions to validate dconf paths

Functions

Description

Various places in the dconf API speak of "paths", "keys", "dirs" and relative versions of each of these. This file contains functions to check if a given string is a valid member of each of these classes and to report errors when a string is not.

See each function in this section for a precise description of what makes a string a valid member of a given class.

Functions

dconf_is_dir ()

gboolean
dconf_is_dir (const gchar *string,
              GError **error);

Checks if string is a valid dconf dir. dconf dirs must start and end with '/' and not contain '//'.

A dconf dir refers to a subtree of the database that can contain other dirs or keys. If string is a dir, then it will be a prefix of any key or dir contained within it.

"/", "/a/" and "/a/b/" are examples of dirs. "", "a/", "a/b/", "//a/b/", "/a//b/" and "/a" are examples of strings that are not dirs.

Parameters

string

a string

 

error

a pointer to a GError, or NULL, set when FALSE is returned

 

Returns

TRUE if string is a dir


dconf_is_key ()

gboolean
dconf_is_key (const gchar *string,
              GError **error);

Checks if string is a valid dconf key. dconf keys must start with '/', not contain '//' and not end with '/'.

A dconf key is the potential location of a single value within the database.

"/a", "/a/b" and "/a/b/c" are examples of keys. "", "/", "a", "a/b", "//a/b", "/a//b", and "/a/" are examples of strings that are not keys.

Parameters

string

a string

 

error

a pointer to a GError, or NULL, set when FALSE is returned

 

Returns

TRUE if string is a key


dconf_is_path ()

gboolean
dconf_is_path (const gchar *string,
               GError **error);

Checks if string is a valid dconf path. dconf keys must start with '/' and not contain '//'.

A dconf path may be either a key or a dir. See dconf_is_key() and dconf_is_dir() for examples of each.

Parameters

string

a string

 

error

a pointer to a GError, or NULL, set when FALSE is returned

 

Returns

TRUE if string is a path


dconf_is_rel_path ()

gboolean
dconf_is_rel_path (const gchar *string,
                   GError **error);

Checks if string is a valid dconf relative path. A relative path is a string that, when concatenated to a dir, forms a valid dconf path. This means that a rel must not start with a '/' or contain '//'.

A dconf rel may be either a relative key or a relative dir. See dconf_is_rel_key() and dconf_is_rel_dir() for examples of each.

Parameters

string

a string

 

error

a pointer to a GError, or NULL, set when FALSE is returned

 

Returns

TRUE if string is a relative path


dconf_is_rel_dir ()

gboolean
dconf_is_rel_dir (const gchar *string,
                  GError **error);

Checks if string is a valid dconf relative dir. A relative dir is a string that, when appended to a dir, forms a valid dconf dir. This means that a relative dir must not start with a '/' or contain '//' and must end with a '/' except in the case that it is the empty string (in which case the path specified by appending the rel to a directory is the original directory).

"", "a/" and "a/b/" are examples of relative dirs. "/", "/a/", "/a/b/", "//a/b/", "a//b/" and "a" are examples of strings that are not relative dirs.

Parameters

string

a string

 

error

a pointer to a GError, or NULL, set when FALSE is returned

 

Returns

TRUE if string is a relative dir


dconf_is_rel_key ()

gboolean
dconf_is_rel_key (const gchar *string,
                  GError **error);

Checks if string is a valid dconf relative key. A relative key is a string that, when concatenated to a dir, forms a valid dconf key. This means that a relative key must not start or end with a '/' or contain '//'.

"a", "a/b" and "a/b/c" are examples of relative keys. "", "/", "/a", "/a/b", "//a/b", "/a//b", and "a/" are examples of strings that are not relative keys.

Parameters

string

a string

 

error

a pointer to a GError, or NULL, set when FALSE is returned

 

Returns

TRUE if string is a relative key