logo top
Main Page   Widgets   glibmm Namespaces   Book  

Gio::FileEnumerator Class Reference

Enumerated Files Routines. More...

Inheritance diagram for Gio::FileEnumerator:

Inheritance graph
[legend]
List of all members.

Public Member Functions

virtual ~FileEnumerator ()
GFileEnumerator* gobj ()
 Provides access to the underlying C GObject.
const GFileEnumerator* gobj () const
 Provides access to the underlying C GObject.
GFileEnumerator* gobj_copy ()
 Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
Glib::RefPtr<FileInfonext_file (const Glib::RefPtr<Cancellable>& cancellable)
 Return value: A G::FileInfo or 0 on error or end of enumerator.
bool close (const Glib::RefPtr<Cancellable>& cancellable)
 Releases all resources used by this enumerator, making the enumerator return G::IO_ERROR_CLOSED on all calls.
void next_files_async (const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, int num_files=1, int io_priority=G_PRIORITY_DEFAULT)
 Request information for a number of files from the enumerator asynchronously.
void next_files_async (const SlotAsyncReady& slot, int num_files=1, int io_priority=G_PRIORITY_DEFAULT)
 Request information for a number of files from the enumerator asynchronously.
Glib::ListHandle< Glib::RefPtr<
FileInfo > > 
next_files_finish (const Glib::RefPtr<AsyncResult>& result)
 Finishes the asynchronous operation started with g_file_enumerator_next_files_async().
void close_async (int io_priority, const Glib::RefPtr<Cancellable>& cancellable, const SlotAsyncReady& slot)
 Asynchronously closes the file enumerator.
void close_async (int io_priority, const SlotAsyncReady& slot)
 Asynchronously closes the file enumerator.
bool close_finish (const Glib::RefPtr<AsyncResult>& result)
 Finishes closing a file enumerator, started from g_file_enumerator_close_async().
bool is_closed () const
 Checks if the file enumerator has been closed.
bool has_pending () const
 Checks if the file enumerator has pending operations.
void set_pending (bool pending=true)
 Sets the file enumerator as having pending operations.

Related Functions

(Note that these are not member functions.)

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

Detailed Description

Enumerated Files Routines.

FileEnumerator allows you to operate on a set of Gio::Files, returning a Gio::FileInfo instance for each file enumerated (e.g. Gio::File::enumerate_children() will return a FileEnumerator for each of the children within a directory).

To get the next file's information from a Gio::FileEnumerator, use next_file() or its asynchronous version, next_file_async(). Note that the asynchronous version will return a list of Gio::FileInfos, whereas the synchronous version will only return the next file in the enumerator.

To close a Gio::FileEnumerator, use FileEnumerator::close(), or its asynchronous version, close_async(). Once a FileEnumerator is closed, no further actions may be performed on it.

Since glibmm 2.16:


Constructor & Destructor Documentation

virtual Gio::FileEnumerator::~FileEnumerator (  )  [virtual]


Member Function Documentation

GFileEnumerator* Gio::FileEnumerator::gobj (  )  [inline]

Provides access to the underlying C GObject.

Reimplemented from Glib::ObjectBase.

const GFileEnumerator* Gio::FileEnumerator::gobj (  )  const [inline]

Provides access to the underlying C GObject.

Reimplemented from Glib::ObjectBase.

GFileEnumerator* Gio::FileEnumerator::gobj_copy (  ) 

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

Glib::RefPtr<FileInfo> Gio::FileEnumerator::next_file ( const Glib::RefPtr<Cancellable>&  cancellable  ) 

Return value: A G::FileInfo or 0 on error or end of enumerator.

Parameters:
cancellable Optional G::Cancellable object, 0 to ignore.
error Location to store the error occuring, or 0 to ignore.
Returns:
A G::FileInfo or 0 on error or end of enumerator.

bool Gio::FileEnumerator::close ( const Glib::RefPtr<Cancellable>&  cancellable  ) 

Releases all resources used by this enumerator, making the enumerator return G::IO_ERROR_CLOSED on all calls.

This will be automatically called when the last reference is dropped, but you might want to call make sure resources are released as early as possible.

Parameters:
cancellable Optional G::Cancellable object, 0 to ignore.
error Location to store the error occuring, or 0 to ignore.
Returns:
#true on success or #false on error.

void Gio::FileEnumerator::next_files_async ( const SlotAsyncReady slot,
const Glib::RefPtr<Cancellable>&  cancellable,
int  num_files = 1,
int  io_priority = G_PRIORITY_DEFAULT 
)

Request information for a number of files from the enumerator asynchronously.

When all I/O for the operation is finished the callback slot will be called with the requested information.

The callback could be called with less than num_files files in case of error or at the end of the enumerator. In case of a partial error the callback will be called with any succeeding items and no error, and on the next request the error will be reported. If a request is cancelled the callback will be called with ERROR_CANCELLED.

During an async request no other sync and async calls are allowed, and will result in ERROR_PENDING errors.

Any outstanding I/O request with higher priority (lower numerical value) will be executed before an outstanding request with lower priority. The default priority is PRIORITY_DEFAULT.

Parameters:
slot A callback to call when the request is satisfied.
cancellable An cancellable object which can be used to cancel the request.
num_files The number of file info objects to request.
io_priority The I/O priority of the request.

void Gio::FileEnumerator::next_files_async ( const SlotAsyncReady slot,
int  num_files = 1,
int  io_priority = G_PRIORITY_DEFAULT 
)

Request information for a number of files from the enumerator asynchronously.

When all I/O for the operation is finished the callback slot will be called with the requested information.

The callback could be called with less than num_files files in case of error or at the end of the enumerator. In case of a partial error the callback will be called with any succeeding items and no error, and on the next request the error will be reported. If a request is cancelled the callback will be called with ERROR_CANCELLED.

During an async request no other sync and async calls are allowed, and will result in ERROR_PENDING errors.

Any outstanding I/O request with higher priority (lower numerical value) will be executed before an outstanding request with lower priority. The default priority is PRIORITY_DEFAULT.

Parameters:
slot A callback to call when the request is satisfied.
num_files The number of file info objects to request.
io_priority The I/O priority of the request.

Glib::ListHandle<Glib::RefPtr<FileInfo>> Gio::FileEnumerator::next_files_finish ( const Glib::RefPtr<AsyncResult>&  result  ) 

Finishes the asynchronous operation started with g_file_enumerator_next_files_async().

Parameters:
result A G::AsyncResult.
error A G::Error location to store the error occuring, or 0 to ignore.
Returns:
A G::List of G::FileInfo<!---->s.

void Gio::FileEnumerator::close_async ( int  io_priority,
const Glib::RefPtr<Cancellable>&  cancellable,
const SlotAsyncReady slot 
)

Asynchronously closes the file enumerator.

See close(), which is the synchronous version of this function.

The operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error ERROR_CANCELLED will be returned in close_finish().

Parameters:
io_priority The I/O priority of the request.
cancellable A Cancellable object which can be used to cancel the operation.
slot A callback to call when the request is satisfied.

void Gio::FileEnumerator::close_async ( int  io_priority,
const SlotAsyncReady slot 
)

Asynchronously closes the file enumerator.

See close(), which is the synchronous version of this function.

Parameters:
io_priority The I/O priority of the request.
slot A callback to call when the request is satisfied.

bool Gio::FileEnumerator::close_finish ( const Glib::RefPtr<AsyncResult>&  result  ) 

Finishes closing a file enumerator, started from g_file_enumerator_close_async().

If the file enumerator was already closed when g_file_enumerator_close_async() was called, then this function will report G::IO_ERROR_CLOSED in error , and return false. If the file enumerator had pending operation when the close operation was started, then this function will report G::IO_ERROR_PENDING, and return false. If cancellable was not 0, then the operation may have been cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error G::IO_ERROR_CANCELLED will be set, and false will be returned.

Parameters:
result A G::AsyncResult.
error A G::Error location to store the error occuring, or 0 to ignore.
Returns:
true if the close operation has finished successfully.

bool Gio::FileEnumerator::is_closed (  )  const

Checks if the file enumerator has been closed.

Returns:
true if the enumerator is closed.

bool Gio::FileEnumerator::has_pending (  )  const

Checks if the file enumerator has pending operations.

Returns:
true if the enumerator has pending operations.

void Gio::FileEnumerator::set_pending ( bool  pending = true  ) 

Sets the file enumerator as having pending operations.

Parameters:
pending A boolean value.


Friends And Related Function Documentation

Glib::RefPtr<Gio::FileEnumerator> wrap ( GFileEnumerator *  object,
bool  take_copy = false 
) [related]

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

Parameters:
object The C instance.
take_copy False 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.


The documentation for this class was generated from the following file:

Generated for glibmm 2.4 by Doxygen 1.5.1 © 1997-2001