Lines Matching full:matcher
64 /* We use this nasty thing, because NULL is a valid attribute matcher (matches nothing) */
2329 sub_matcher_matches (SubMatcher *matcher, in sub_matcher_matches() argument
2332 if ((matcher->mask & submatcher->mask) != matcher->mask) in sub_matcher_matches()
2335 return matcher->id == (submatcher->id & matcher->mask); in sub_matcher_matches()
2338 /* Call this function after modifying a matcher.
2342 matcher_optimize (GFileAttributeMatcher *matcher) in matcher_optimize() argument
2348 if (matcher->all) in matcher_optimize()
2350 if (matcher->sub_matchers) in matcher_optimize()
2352 g_array_free (matcher->sub_matchers, TRUE); in matcher_optimize()
2353 matcher->sub_matchers = NULL; in matcher_optimize()
2355 return matcher; in matcher_optimize()
2358 if (matcher->sub_matchers->len == 0) in matcher_optimize()
2360 g_file_attribute_matcher_unref (matcher); in matcher_optimize()
2366 g_array_sort (matcher->sub_matchers, compare_sub_matchers); in matcher_optimize()
2370 compare = &g_array_index (matcher->sub_matchers, SubMatcher, j); in matcher_optimize()
2372 for (i = 1; i < matcher->sub_matchers->len; i++) in matcher_optimize()
2374 submatcher = &g_array_index (matcher->sub_matchers, SubMatcher, i); in matcher_optimize()
2385 g_array_set_size (matcher->sub_matchers, j + 1); in matcher_optimize()
2387 return matcher; in matcher_optimize()
2394 * Creates a new file attribute matcher, which matches attributes
2406 * ## Examples of file attribute matcher strings and results
2422 GFileAttributeMatcher *matcher; in g_file_attribute_matcher_new() local
2427 matcher = g_malloc0 (sizeof (GFileAttributeMatcher)); in g_file_attribute_matcher_new()
2428 matcher->ref = 1; in g_file_attribute_matcher_new()
2429 matcher->sub_matchers = g_array_new (FALSE, FALSE, sizeof (SubMatcher)); in g_file_attribute_matcher_new()
2436 matcher->all = TRUE; in g_file_attribute_matcher_new()
2459 g_array_append_val (matcher->sub_matchers, s); in g_file_attribute_matcher_new()
2465 matcher = matcher_optimize (matcher); in g_file_attribute_matcher_new()
2467 return matcher; in g_file_attribute_matcher_new()
2472 * @matcher: (nullable): Matcher to subtract from
2473 * @subtract: (nullable): The matcher to subtract
2475 * Subtracts all attributes of @subtract from @matcher and returns
2476 * a matcher that supports those attributes.
2479 * attribute when the @matcher matches the whole namespace - or remove
2480 * a namespace or attribute when the matcher matches everything. This
2484 * Returns: (nullable): A file attribute matcher matching all attributes of
2485 * @matcher that are not matched by @subtract
2488 g_file_attribute_matcher_subtract (GFileAttributeMatcher *matcher, in g_file_attribute_matcher_subtract() argument
2495 if (matcher == NULL) in g_file_attribute_matcher_subtract()
2498 return g_file_attribute_matcher_ref (matcher); in g_file_attribute_matcher_subtract()
2501 if (matcher->all) in g_file_attribute_matcher_subtract()
2502 return g_file_attribute_matcher_ref (matcher); in g_file_attribute_matcher_subtract()
2512 for (mi = 0; mi < matcher->sub_matchers->len; mi++) in g_file_attribute_matcher_subtract()
2514 msub = &g_array_index (matcher->sub_matchers, SubMatcher, mi); in g_file_attribute_matcher_subtract()
2531 if (mi < matcher->sub_matchers->len) in g_file_attribute_matcher_subtract()
2533 &g_array_index (matcher->sub_matchers, SubMatcher, mi), in g_file_attribute_matcher_subtract()
2534 matcher->sub_matchers->len - mi); in g_file_attribute_matcher_subtract()
2543 * @matcher: a #GFileAttributeMatcher.
2545 * References a file attribute matcher.
2550 g_file_attribute_matcher_ref (GFileAttributeMatcher *matcher) in g_file_attribute_matcher_ref() argument
2552 if (matcher) in g_file_attribute_matcher_ref()
2554 g_return_val_if_fail (matcher->ref > 0, NULL); in g_file_attribute_matcher_ref()
2555 g_atomic_int_inc (&matcher->ref); in g_file_attribute_matcher_ref()
2557 return matcher; in g_file_attribute_matcher_ref()
2562 * @matcher: a #GFileAttributeMatcher.
2564 * Unreferences @matcher. If the reference count falls below 1,
2565 * the @matcher is automatically freed.
2569 g_file_attribute_matcher_unref (GFileAttributeMatcher *matcher) in g_file_attribute_matcher_unref() argument
2571 if (matcher) in g_file_attribute_matcher_unref()
2573 g_return_if_fail (matcher->ref > 0); in g_file_attribute_matcher_unref()
2575 if (g_atomic_int_dec_and_test (&matcher->ref)) in g_file_attribute_matcher_unref()
2577 if (matcher->sub_matchers) in g_file_attribute_matcher_unref()
2578 g_array_free (matcher->sub_matchers, TRUE); in g_file_attribute_matcher_unref()
2580 g_free (matcher); in g_file_attribute_matcher_unref()
2587 * @matcher: a #GFileAttributeMatcher.
2590 * Checks if a attribute matcher only matches a given attribute. Always
2591 * returns %FALSE if "*" was used when creating the matcher.
2593 * Returns: %TRUE if the matcher only matches @attribute. %FALSE otherwise.
2596 g_file_attribute_matcher_matches_only (GFileAttributeMatcher *matcher, in g_file_attribute_matcher_matches_only() argument
2604 if (matcher == NULL || in g_file_attribute_matcher_matches_only()
2605 matcher->all) in g_file_attribute_matcher_matches_only()
2608 if (matcher->sub_matchers->len != 1) in g_file_attribute_matcher_matches_only()
2613 sub_matcher = &g_array_index (matcher->sub_matchers, SubMatcher, 0); in g_file_attribute_matcher_matches_only()
2620 matcher_matches_id (GFileAttributeMatcher *matcher, in matcher_matches_id() argument
2626 if (matcher->sub_matchers) in matcher_matches_id()
2628 sub_matchers = (SubMatcher *)matcher->sub_matchers->data; in matcher_matches_id()
2629 for (i = 0; i < matcher->sub_matchers->len; i++) in matcher_matches_id()
2640 _g_file_attribute_matcher_matches_id (GFileAttributeMatcher *matcher, in _g_file_attribute_matcher_matches_id() argument
2643 /* We return a NULL matcher for an empty match string, so handle this */ in _g_file_attribute_matcher_matches_id()
2644 if (matcher == NULL) in _g_file_attribute_matcher_matches_id()
2647 if (matcher->all) in _g_file_attribute_matcher_matches_id()
2650 return matcher_matches_id (matcher, id); in _g_file_attribute_matcher_matches_id()
2655 * @matcher: a #GFileAttributeMatcher.
2658 * Checks if an attribute will be matched by an attribute matcher. If
2659 * the matcher was created with the "*" matching string, this function
2662 * Returns: %TRUE if @attribute matches @matcher. %FALSE otherwise.
2665 g_file_attribute_matcher_matches (GFileAttributeMatcher *matcher, in g_file_attribute_matcher_matches() argument
2670 /* We return a NULL matcher for an empty match string, so handle this */ in g_file_attribute_matcher_matches()
2671 if (matcher == NULL) in g_file_attribute_matcher_matches()
2674 if (matcher->all) in g_file_attribute_matcher_matches()
2677 return matcher_matches_id (matcher, lookup_attribute (attribute)); in g_file_attribute_matcher_matches()
2683 * @matcher: a #GFileAttributeMatcher.
2686 * Checks if the matcher will match all of the keys in a given namespace.
2688 * matcher was created with "standard::*" and @ns is "standard", or if matcher was created
2693 * Returns: %TRUE if the matcher matches all of the entries
2697 g_file_attribute_matcher_enumerate_namespace (GFileAttributeMatcher *matcher, in g_file_attribute_matcher_enumerate_namespace() argument
2706 /* We return a NULL matcher for an empty match string, so handle this */ in g_file_attribute_matcher_enumerate_namespace()
2707 if (matcher == NULL) in g_file_attribute_matcher_enumerate_namespace()
2710 if (matcher->all) in g_file_attribute_matcher_enumerate_namespace()
2715 if (matcher->sub_matchers) in g_file_attribute_matcher_enumerate_namespace()
2717 sub_matchers = (SubMatcher *)matcher->sub_matchers->data; in g_file_attribute_matcher_enumerate_namespace()
2718 for (i = 0; i < matcher->sub_matchers->len; i++) in g_file_attribute_matcher_enumerate_namespace()
2725 matcher->iterator_ns = ns_id; in g_file_attribute_matcher_enumerate_namespace()
2726 matcher->iterator_pos = 0; in g_file_attribute_matcher_enumerate_namespace()
2733 * @matcher: a #GFileAttributeMatcher.
2741 g_file_attribute_matcher_enumerate_next (GFileAttributeMatcher *matcher) in g_file_attribute_matcher_enumerate_next() argument
2746 /* We return a NULL matcher for an empty match string, so handle this */ in g_file_attribute_matcher_enumerate_next()
2747 if (matcher == NULL) in g_file_attribute_matcher_enumerate_next()
2752 i = matcher->iterator_pos++; in g_file_attribute_matcher_enumerate_next()
2754 if (matcher->sub_matchers == NULL) in g_file_attribute_matcher_enumerate_next()
2757 if (i < matcher->sub_matchers->len) in g_file_attribute_matcher_enumerate_next()
2758 sub_matcher = &g_array_index (matcher->sub_matchers, SubMatcher, i); in g_file_attribute_matcher_enumerate_next()
2763 (sub_matcher->id & (NS_MASK << NS_POS)) == matcher->iterator_ns) in g_file_attribute_matcher_enumerate_next()
2770 * @matcher: (nullable): a #GFileAttributeMatcher.
2772 * Prints what the matcher is matching against. The format will be
2774 * The output however, might not be identical, as the matcher may
2777 * Returns: a string describing the attributes the matcher matches
2778 * against or %NULL if @matcher was %NULL.
2783 g_file_attribute_matcher_to_string (GFileAttributeMatcher *matcher) in g_file_attribute_matcher_to_string() argument
2788 if (matcher == NULL) in g_file_attribute_matcher_to_string()
2791 if (matcher->all) in g_file_attribute_matcher_to_string()
2795 for (i = 0; i < matcher->sub_matchers->len; i++) in g_file_attribute_matcher_to_string()
2797 SubMatcher *submatcher = &g_array_index (matcher->sub_matchers, SubMatcher, i); in g_file_attribute_matcher_to_string()