mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-03-03 14:42:10 +01:00
fileinfo: Add g_file_attribute_matcher_to_string()
This is to be mainly used for debugging and tests.
This commit is contained in:
parent
86d29e4e73
commit
b400127b3e
@ -370,6 +370,7 @@ g_file_attribute_matcher_matches
|
|||||||
g_file_attribute_matcher_matches_only
|
g_file_attribute_matcher_matches_only
|
||||||
g_file_attribute_matcher_enumerate_namespace
|
g_file_attribute_matcher_enumerate_namespace
|
||||||
g_file_attribute_matcher_enumerate_next
|
g_file_attribute_matcher_enumerate_next
|
||||||
|
g_file_attribute_matcher_to_string
|
||||||
<SUBSECTION Standard>
|
<SUBSECTION Standard>
|
||||||
GFileInfoClass
|
GFileInfoClass
|
||||||
G_FILE_INFO
|
G_FILE_INFO
|
||||||
|
@ -2488,3 +2488,43 @@ g_file_attribute_matcher_enumerate_next (GFileAttributeMatcher *matcher)
|
|||||||
return get_attribute_for_id (sub_matcher->id);
|
return get_attribute_for_id (sub_matcher->id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* g_file_attribute_matcher_to_string:
|
||||||
|
* @matcher: (allow-none): a #GFileAttributeMatcher.
|
||||||
|
*
|
||||||
|
* Prints what the matcher is matching against. The format will be
|
||||||
|
* equal to the format passed to g_file_attribute_matcher_new().
|
||||||
|
* The output however, might not be identical, as the matcher may
|
||||||
|
* decide to use a different order or omit needless parts.
|
||||||
|
*
|
||||||
|
* Returns: a string describing the attributes the matcher matches
|
||||||
|
* against or %NULL if @matcher was %NULL.
|
||||||
|
*
|
||||||
|
* Since: 2.32
|
||||||
|
**/
|
||||||
|
char *
|
||||||
|
g_file_attribute_matcher_to_string (GFileAttributeMatcher *matcher)
|
||||||
|
{
|
||||||
|
GString *string;
|
||||||
|
guint i;
|
||||||
|
|
||||||
|
if (matcher == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
if (matcher->all)
|
||||||
|
return g_strdup ("*");
|
||||||
|
|
||||||
|
string = g_string_new ("");
|
||||||
|
for (i = 0; i < matcher->sub_matchers->len; i++)
|
||||||
|
{
|
||||||
|
SubMatcher *submatcher = &g_array_index (matcher->sub_matchers, SubMatcher, i);
|
||||||
|
|
||||||
|
if (i > 0)
|
||||||
|
g_string_append_c (string, ',');
|
||||||
|
|
||||||
|
g_string_append (string, get_attribute_for_id (submatcher->id));
|
||||||
|
}
|
||||||
|
|
||||||
|
return g_string_free (string, FALSE);
|
||||||
|
}
|
||||||
|
@ -946,6 +946,7 @@ gboolean g_file_attribute_matcher_matches_only (GFileAttributeMa
|
|||||||
gboolean g_file_attribute_matcher_enumerate_namespace (GFileAttributeMatcher *matcher,
|
gboolean g_file_attribute_matcher_enumerate_namespace (GFileAttributeMatcher *matcher,
|
||||||
const char *ns);
|
const char *ns);
|
||||||
const char * g_file_attribute_matcher_enumerate_next (GFileAttributeMatcher *matcher);
|
const char * g_file_attribute_matcher_enumerate_next (GFileAttributeMatcher *matcher);
|
||||||
|
char * g_file_attribute_matcher_to_string (GFileAttributeMatcher *matcher);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
@ -437,6 +437,7 @@ g_file_attribute_matcher_matches
|
|||||||
g_file_attribute_matcher_matches_only
|
g_file_attribute_matcher_matches_only
|
||||||
g_file_attribute_matcher_enumerate_namespace
|
g_file_attribute_matcher_enumerate_namespace
|
||||||
g_file_attribute_matcher_enumerate_next
|
g_file_attribute_matcher_enumerate_next
|
||||||
|
g_file_attribute_matcher_to_string
|
||||||
g_file_input_stream_get_type
|
g_file_input_stream_get_type
|
||||||
g_file_input_stream_query_info
|
g_file_input_stream_query_info
|
||||||
g_file_input_stream_query_info_async
|
g_file_input_stream_query_info_async
|
||||||
|
Loading…
x
Reference in New Issue
Block a user