- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- File List
- File Members

# FUtils/FUFile.h

Go to the documentation of this file.

    00001 /*
    00002     Copyright (C) 2005-2007 Feeling Software Inc.
    00003     Portions of the code are:
    00004     Copyright (C) 2005-2007 Sony Computer Entertainment America
    00005
    00006     MIT License: http://www.opensource.org/licenses/mit-license.php
    00007 */
    00008
    00014 #ifndef _FU_FILE_H_
    00015 #define _FU_FILE_H_
    00016
    00024 class FCOLLADA_EXPORT FUFile
    00025 {
    00026 public:
    00028     enum Mode
    00029     {
    00030         READ,
    00031         WRITE
    00032     };
    00033
    00034 private:
    00035     FILE* filePtr;
    00036     fstring filepath;
    00037
    00038 public:
    00042     FUFile(const fstring& filename, Mode mode);
    00043     FUFile(const fchar* filename, Mode mode);
    00048     FUFile();
    00049
    00052     ~FUFile();
    00053
    00056     inline const fstring& GetFilePath() const { return filepath; }
    00057
    00062     inline bool Open(const fstring& filename, Mode mode) { return Open(filename.c_str(), mode); }
    00063     bool Open(const fchar* filename, Mode mode);
    00067     bool IsOpen() { return filePtr != NULL; }
    00068
    00071     size_t GetLength();
    00072
    00076     FILE* GetHandle() { return filePtr; }
    00077
    00084     bool Read(void* buffer, size_t length);
    00085
    00091     bool Write(const void* buffer, size_t length);
    00092
    00095     void Flush();
    00096
    00098     void Close();
    00099 };
    00100
    00101 #endif // _FU_FILE_H_