class CCL::File
Overview
#include <file.h> class File: public CCL::Object { public: // construction File (UrlRef path); // methods DECLARE_CLASS (File, Object); PROPERTY_OBJECT (Url, path, Path) const; bool isFolder () const; void signalRelease (); void signalCreated (); void signalRemoved (); bool exists () const; bool create () const; bool remove (int mode = 0) const; bool rename (StringRef newName, int mode = 0); bool getInfo (FileInfo& info) const; IStream* open (int mode = IStream::kOpenMode, IUnknown* context = nullptr) const; IFileIterator* newIterator (int mode = IFileIterator::kAll) const; bool getVolumeInfo (VolumeInfo& info) const; bool isLocal () const; bool isHidden () const; bool isWriteProtected () const; bool moveTo (UrlRef dstPath, int mode = 0, IProgressNotify* progress = nullptr); bool copyTo (UrlRef dstPath, int mode = 0, IProgressNotify* progress = nullptr) const; bool setTime (const FileTime& modifiedTime) const; static INativeFileSystem& getFS (); static IMemoryStream* loadBinaryFile ( UrlRef path, IFileSystem* fileSystem = nullptr ); static bool save (UrlRef path, const IMemoryStream& stream); static bool save (UrlRef path, const IStorable& storable); static bool load (UrlRef path, IStorable& storable); static void signalFile (StringID signalID, UrlRef path); static IFileIterator* findFiles ( UrlRef path, StringRef searchPattern, int mode = IFileIterator::kAll ); static IFileIterator* filterIterator ( IFileIterator& iter, const IUrlFilter& filter ); static bool isFolderEmpty (UrlRef path); static bool copyFolder ( UrlRef dstPath, UrlRef srcPath, const IUrlFilter* filter = nullptr, bool recursive = false ); };
Inherited Members
public: // typedefs typedef CStringRef MemberID; // 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; Unknown& operator = (const Unknown&); unsigned int getRetainCount () const; virtual Object*CCL_API revealObject (const void* moduleAddress) = 0; virtual void CCL_API addObserver (IObserver* observer) = 0; virtual void CCL_API removeObserver (IObserver* observer) = 0; virtual void CCL_API signal (MessageRef msg) = 0; virtual void CCL_API deferSignal (IMessage* msg) = 0; static ISubject void addObserver (IUnknown* unknown, IObserver* observer); static void removeObserver (IUnknown* unknown, IObserver* observer); virtual void CCL_API notify (ISubject* subject, MessageRef msg) = 0; static IObserver void notify ( IUnknown* unknown, ISubject* subject, MessageRef msg ); virtual const ITypeInfo&CCL_API getTypeInfo () const = 0; virtual tbool CCL_API getProperty (Variant& var, MemberID propertyId) const = 0; virtual tbool CCL_API setProperty (MemberID propertyId, const Variant& var) = 0; virtual tbool CCL_API getPropertyNames (IPropertyCollector& collector) const = 0; virtual tbool CCL_API invokeMethod (Variant& returnValue, MessageRef msg) = 0; DECLARE_BASE_CLASS (Object); virtual void CCL_API removeObserver (IObserver* observer); virtual void CCL_API signal (MessageRef msg); virtual void CCL_API deferSignal (IMessage* msg); virtual void deferChanged (); virtual void CCL_API notify (ISubject* subject, MessageRef msg); virtual bool equals (const Object& obj) const; virtual int compare (const Object& obj) const; virtual bool load (const Storage& storage); virtual bool save (const Storage& storage) const; virtual bool save (const OutputStorage& storage) const; virtual bool toString (String& string, int flags = 0) const; virtual int getHashCode (int size) const; IUnknown* asUnknown (); static void addGarbageCollected (Object* obj, bool globalScope = true); static void deferDestruction (Object* obj); static const void* getModuleAddress ();
Detailed Documentation
Methods
bool exists () const
See also:
bool create () const
See also:
IFileSystem::createFolder() or IFileSystem::openStream()
bool remove (int mode = 0) const
See also:
IFileSystem::removeFile() or IFileSystem::removeFolder()
bool rename (StringRef newName, int mode = 0)
See also:
bool getInfo (FileInfo& info) const
See also:
IStream* open (int mode = IStream::kOpenMode, IUnknown* context = nullptr) const
See also:
IFileIterator* newIterator (int mode = IFileIterator::kAll) const
See also:
bool getVolumeInfo (VolumeInfo& info) const
See also:
IVolumeFileSystem::getVolumeInfo()
bool isLocal () const
See also:
IVolumeFileSystem::isLocalFile()
bool isHidden () const
See also:
IVolumeFileSystem::isHiddenFile()
bool isWriteProtected () const
See also:
IVolumeFileSystem::isWriteProtected()
bool moveTo (UrlRef dstPath, int mode = 0, IProgressNotify* progress = nullptr)
See also:
bool copyTo (UrlRef dstPath, int mode = 0, IProgressNotify* progress = nullptr) const
See also:
bool setTime (const FileTime& modifiedTime) const
See also:
INativeFileSystem::setFileTime()
static INativeFileSystem& getFS ()
Get the file system (same as System::GetFileSystem()).
static IMemoryStream* loadBinaryFile ( UrlRef path, IFileSystem* fileSystem = nullptr )
Load file into memory.
static bool save (UrlRef path, const IMemoryStream& stream)
Save memory stream to file.
static bool save (UrlRef path, const IStorable& storable)
Save storable object as file.
static bool load (UrlRef path, IStorable& storable)
Load file into storable object.
static void signalFile (StringID signalID, UrlRef path)
Notify the application about a filesystem change (e.g.
kFileCreated, kFileRemoved).
static IFileIterator* findFiles ( UrlRef path, StringRef searchPattern, int mode = IFileIterator::kAll )
Returns iterator of files matching a search pattern in the specified path.
static IFileIterator* filterIterator ( IFileIterator& iter, const IUrlFilter& filter )
Create filtered file iterator.
static bool isFolderEmpty (UrlRef path)
Check if folder is empty.
static bool copyFolder ( UrlRef dstPath, UrlRef srcPath, const IUrlFilter* filter = nullptr, bool recursive = false )
Copy folder.