struct CCL::IFileResource

Overview

Interface for file-based resource identified by an URL. More…

#include <ifileresource.h>

struct IFileResource: public CCL::IUnknown
{
    // structs

    struct Closer;
    struct Opener;

    // methods

    virtual tbool CCL_API setPath (UrlRef path) = 0;
    virtual UrlRef CCL_API getPath () const = 0;
    virtual tbool CCL_API open (int mode = 0) = 0;
    virtual tbool CCL_API create (int mode = 0) = 0;
    virtual tbool CCL_API close () = 0;
    virtual tbool CCL_API isExisting () const = 0;
    virtual tbool CCL_API isOpen () const = 0;
    virtual tbool CCL_API deletePhysical (int mode = 0) = 0;
};

Inherited Members

public:
    // methods

    virtual tresult CCL_API queryInterface (UIDRef iid, void** ptr) = 0;
    virtual unsigned int CCL_API retain () = 0;
    virtual unsigned int CCL_API release () = 0;

Detailed Documentation

Interface for file-based resource identified by an URL.

It can be opened, created, deleted, etc. Opening calls are counted. For each successful open, a close call must follow. Please note that the file resource itself is not safe for simultaneous access by multiple threads. If thread-safety is required, separate instances sharing the same URL should be created. <>

Methods

virtual tbool CCL_API setPath (UrlRef path) = 0

Call once to init file location.

virtual UrlRef CCL_API getPath () const = 0

Get file location.

virtual tbool CCL_API open (int mode = 0) = 0

Open existing file.

virtual tbool CCL_API create (int mode = 0) = 0

Create new file.

virtual tbool CCL_API close () = 0

Close file.

virtual tbool CCL_API isExisting () const = 0

Check if file exists.

virtual tbool CCL_API isOpen () const = 0

Check if file is currently open.

virtual tbool CCL_API deletePhysical (int mode = 0) = 0

Try to delete file physically.