struct CCL::IFileUtilities

Overview

File-related utilities. More…

#include <ifileutilities.h>

struct IFileUtilities: public CCL::IUnknown
{
    // enums

    enum StringStreamFlags;

    // methods

    virtual void CCL_API makeUniqueFileName (
        IFileSystem& fileSystem,
        IUrl& path,
        tbool forceSuffix = false
    ) = 0;

    virtual void CCL_API makeValidFileName (String& fileName) = 0;
    virtual void CCL_API appendDateTime (String& fileName) = 0;

    virtual tbool CCL_API scanDateTime (
        DateTime& time,
        StringRef fileName,
        String* prefix = nullptr,
        String* suffix = nullptr
    ) = 0;

    virtual UrlRef CCL_API makeUniqueTempFolder (IUrl& tempFolder) = 0;
    virtual UrlRef CCL_API makeUniqueTempFile (IUrl& tempFile, StringRef name) = 0;

    virtual tbool CCL_API copyStream (
        IStream& destStream,
        IStream& srcStream,
        IProgressNotify* progress = nullptr,
        int64 maxBytesToCopy = -1
    ) = 0;

    virtual IStream*CCL_API createSectionStream (
        IStream& inStream,
        int64 offset,
        int64 size,
        tbool writeMode = false
    ) = 0;

    virtual IStream*CCL_API createSeekableStream (
        IStream& inStream,
        tbool writeMode = false
    ) = 0;

    virtual IStream*CCL_API createBufferedStream (
        IStream& inStream,
        int bufferSize = -1
    ) = 0;

    virtual IMemoryStream*CCL_API createStreamCopyInMemory (
        IStream& inStream,
        IMemoryStream* destStream = nullptr
    ) = 0;

    virtual IStream*CCL_API createStringStream (
        StringRef string,
        TextEncoding encoding,
        int flags = 0
    ) = 0;

    virtual IUrl*CCL_API translatePathInMountedFolder (UrlRef path) = 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

File-related utilities.

Access via System::GetFileUtilities().

Methods

virtual void CCL_API makeUniqueFileName (
    IFileSystem& fileSystem,
    IUrl& path,
    tbool forceSuffix = false
) = 0

Make filename unique by appending a numeric suffix (e.g “Filename(2).xxx”)

virtual void CCL_API makeValidFileName (String& fileName) = 0

Replace invalid characters in filename.

virtual void CCL_API appendDateTime (String& fileName) = 0

Append current date & time to a filename.

virtual tbool CCL_API scanDateTime (
    DateTime& time,
    StringRef fileName,
    String* prefix = nullptr,
    String* suffix = nullptr
) = 0

Scan date & time from a filename that was created using appendDateTime.

Optionally returns the text surrounding the date & time string.

virtual UrlRef CCL_API makeUniqueTempFolder (IUrl& tempFolder) = 0

Generate unique subfolder name in temporary folder.

virtual UrlRef CCL_API makeUniqueTempFile (IUrl& tempFile, StringRef name) = 0

Generate unique file name in temporary folder.

virtual tbool CCL_API copyStream (
    IStream& destStream,
    IStream& srcStream,
    IProgressNotify* progress = nullptr,
    int64 maxBytesToCopy = -1
) = 0

Copy source to destination stream.

virtual IStream*CCL_API createSectionStream (
    IStream& inStream,
    int64 offset,
    int64 size,
    tbool writeMode = false
) = 0

Create sub-section of incoming stream.

virtual IStream*CCL_API createSeekableStream (
    IStream& inStream,
    tbool writeMode = false
) = 0

Create seekable stream, retains incoming stream or creates memory copy.

virtual IStream*CCL_API createBufferedStream (
    IStream& inStream,
    int bufferSize = -1
) = 0

Create buffered stream for incoming stream.

virtual IMemoryStream*CCL_API createStreamCopyInMemory (
    IStream& inStream,
    IMemoryStream* destStream = nullptr
) = 0

Create copy of stream in memory.

virtual IStream*CCL_API createStringStream (
    StringRef string,
    TextEncoding encoding,
    int flags = 0
) = 0

Create IStream from string.

virtual IUrl*CCL_API translatePathInMountedFolder (UrlRef path) = 0

Try to translate a native path inside a mounted package folder to a portable “package://” url; returns 0 if not applicable.