glibmm 2.80.0
Public Member Functions | Static Public Member Functions | Protected Member Functions | Related Symbols | List of all members
Gio::FileAttributeMatcher Class Referencefinal

FileAttributeMatcher allows for searching through a FileInfo for attributes. More...

#include <giomm/fileinfo.h>

Public Member Functions

void reference () const
 Increment the reference count for this object.
 
void unreference () const
 Decrement the reference count for this object.
 
GFileAttributeMatchergobj ()
 Provides access to the underlying C instance.
 
const GFileAttributeMatchergobj () const
 Provides access to the underlying C instance.
 
GFileAttributeMatchergobj_copy () const
 Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
 
 FileAttributeMatcher ()=delete
 
 FileAttributeMatcher (const FileAttributeMatcher &)=delete
 
FileAttributeMatcheroperator= (const FileAttributeMatcher &)=delete
 
Glib::RefPtr< FileAttributeMatchercreate_difference (const Glib::RefPtr< const FileAttributeMatcher > &subtract) const
 Subtracts all attributes of subtract from matcher and returns a matcher that supports those attributes.
 
bool matches (const std::string &attribute) const
 Checks if an attribute will be matched by an attribute matcher.
 
bool matches_only (const std::string &attribute) const
 Checks if an attribute matcher only matches a given attribute.
 
bool enumerate_namespace (const std::string &ns)
 Checks if the matcher will match all of the keys in a given namespace.
 
std::string enumerate_next ()
 Gets the next matched attribute from a FileAttributeMatcher.
 
std::string to_string () const
 Prints what the matcher is matching against.
 

Static Public Member Functions

static Glib::RefPtr< FileAttributeMatchercreate (const std::string &attributes="*")
 Creates a new file attribute matcher, which matches attributes against a given string.
 

Protected Member Functions

void operator delete (void *, std::size_t)
 

Related Symbols

(Note that these are not member symbols.)

Glib::RefPtr< Gio::FileAttributeMatcherwrap (GFileAttributeMatcher *object, bool take_copy=false)
 A Glib::wrap() method for this object.
 

Detailed Description

FileAttributeMatcher allows for searching through a FileInfo for attributes.

Since glibmm 2.16:

Constructor & Destructor Documentation

◆ FileAttributeMatcher() [1/2]

Gio::FileAttributeMatcher::FileAttributeMatcher ( )
delete

◆ FileAttributeMatcher() [2/2]

Gio::FileAttributeMatcher::FileAttributeMatcher ( const FileAttributeMatcher )
delete

Member Function Documentation

◆ create()

static Glib::RefPtr< FileAttributeMatcher > Gio::FileAttributeMatcher::create ( const std::string attributes = "*")
static

Creates a new file attribute matcher, which matches attributes against a given string.

The attribute string should be formatted with specific keys separated from namespaces with a double colon. Several "namespace::key" strings may be concatenated with a single comma (e.g. "standard::type,standard::is-hidden"). The wildcard "*" may be used to match all keys and namespaces, or "namespace::*" will match all keys in a given namespace.

Parameters
attributesThe attributes string.
Returns
a new FileAttributeMatcher.

◆ create_difference()

Glib::RefPtr< FileAttributeMatcher > Gio::FileAttributeMatcher::create_difference ( const Glib::RefPtr< const FileAttributeMatcher > &  subtract) const

Subtracts all attributes of subtract from matcher and returns a matcher that supports those attributes.

Note that currently it is not possible to remove a single attribute when the matcher matches the whole namespace - or remove a namespace or attribute when the matcher matches everything. This is a limitation of the current implementation, but may be fixed in the future.

Parameters
subtractThe matcher to subtract.
Returns
A file attribute matcher matching all attributes of matcher that are not matched by subtract.

◆ enumerate_namespace()

bool Gio::FileAttributeMatcher::enumerate_namespace ( const std::string ns)

Checks if the matcher will match all of the keys in a given namespace.

This will always return true if a wildcard character is in use (e.g. if matcher was created with "standard::*" and ns is "standard", or if matcher was created using "*" and namespace is anything.)

TODO: this is awkwardly worded.

Parameters
nsA string containing a file attribute namespace.
Returns
true if the matcher matches all of the entries in the given ns, false otherwise.

◆ enumerate_next()

std::string Gio::FileAttributeMatcher::enumerate_next ( )

Gets the next matched attribute from a FileAttributeMatcher.

Returns
A string containing the next attribute or, nullptr if no more attribute exist.

◆ gobj() [1/2]

GFileAttributeMatcher * Gio::FileAttributeMatcher::gobj ( )

Provides access to the underlying C instance.

◆ gobj() [2/2]

const GFileAttributeMatcher * Gio::FileAttributeMatcher::gobj ( ) const

Provides access to the underlying C instance.

◆ gobj_copy()

GFileAttributeMatcher * Gio::FileAttributeMatcher::gobj_copy ( ) const

Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.

◆ matches()

bool Gio::FileAttributeMatcher::matches ( const std::string attribute) const

Checks if an attribute will be matched by an attribute matcher.

If the matcher was created with the "*" matching string, this function will always return true.

Parameters
attributeA file attribute key.
Returns
true if attribute matches matcher. false otherwise.

◆ matches_only()

bool Gio::FileAttributeMatcher::matches_only ( const std::string attribute) const

Checks if an attribute matcher only matches a given attribute.

Always returns false if "*" was used when creating the matcher.

Parameters
attributeA file attribute key.
Returns
true if the matcher only matches attribute. false otherwise.

◆ operator delete()

void Gio::FileAttributeMatcher::operator delete ( void ,
std::size_t   
)
protected

◆ operator=()

FileAttributeMatcher & Gio::FileAttributeMatcher::operator= ( const FileAttributeMatcher )
delete

◆ reference()

void Gio::FileAttributeMatcher::reference ( ) const

Increment the reference count for this object.

You should never need to do this manually - use the object via a RefPtr instead.

◆ to_string()

std::string Gio::FileAttributeMatcher::to_string ( ) const

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.

Since glibmm 2.32:
Returns
A string describing the attributes the matcher matches against or nullptr if matcher was nullptr.

◆ unreference()

void Gio::FileAttributeMatcher::unreference ( ) const

Decrement the reference count for this object.

You should never need to do this manually - use the object via a RefPtr instead.

Friends And Related Symbol Documentation

◆ wrap()

Glib::RefPtr< Gio::FileAttributeMatcher > wrap ( GFileAttributeMatcher object,
bool  take_copy = false 
)
related

A Glib::wrap() method for this object.

Parameters
objectThe C instance.
take_copyFalse if the result should take ownership of the C instance. True if it should take a new copy or ref.
Returns
A C++ instance that wraps this C instance.