/** SGX

The   sss    gggg x   x   
     s      g      x x    Engine
      sss   g  gg   x
         s  g   g  x x          Copyright 1995-2009.
     ssss    gggg x   x         Steven Goodwin. All Rights Reserved.
    
This version has been released under the GNU Public License v2.0.

Please see the license files for details.

File: sgx/include/sgx/filesystem/fileentry.hpp

*/

#ifndef SGX_FILESYSTEM_FILEENTRY_HPP
#define SGX_FILESYSTEM_FILEENTRY_HPP	1

class CSGXFileEntry
{
public:
    CSGXFileEntry();
    CSGXFileEntry(const sgxString &Name);
    ~CSGXFileEntry();

	void					releaseHierarchy();

    tBOOL					isFile();
    tBOOL					isFolder();
    void					getFileNameBase(sgxString &filename) const { filename = m_Data.m_Name; }
    void					getFileNamePath(sgxString &filename) const;
	tDISC_SIZE				getFileSize() const { return m_Data.m_Filesize; }
	tBOOL					getFileModifiedDate(UTCDate &date) const { date = m_Data.m_LastModifiedDate; return TRUE; }

	// Tree discovery - both return NULL if this is a file
	CSGXFileEntry *			getChildFile(const tUINT32 idx=0);
	CSGXFileEntry *			getChildFolder(const tUINT32 idx=0);

	CSGXDeviceBlockState *	open(const sgxString &access);
	CSGXFileEntry *			createNewDirectory(const sgxString &dirName);
	tBOOL					removeChild(CSGXFileEntry *pChild);

    CSGXFileSysData     m_Data;
    CSGXDeviceBlock    *m_pBlock;      // device-specific state block for the file
    CSGXDevice         *m_pFSDevice;   // device-manager

    CSGXFileEntry      *m_pParent;

    CSGXFileEntry      *m_pFirstChild;
    CSGXFileEntry      *m_pNextSibling;
};

#endif /* SGX_FILESYSTEM_FILEENTRY_HPP */
