11 #include "AddonClass.h" 12 #include "AddonString.h" 13 #include "LanguageHook.h" 14 #include "commons/Buffer.h" 15 #include "filesystem/File.h" 62 inline File(
const String& filepath,
const char* mode = NULL) : file(
new XFILE::CFile())
65 if (mode && strncmp(mode,
"w", 1) == 0)
66 file->OpenForWrite(filepath,
true);
68 file->
Open(filepath, XFILE::READ_NO_CACHE);
71 inline ~
File()
override {
delete file; }
73 #if !defined(DOXYGEN_SHOULD_USE_THIS) 74 inline File* __enter__() {
return this; }
75 inline void __exit__() { close(); }
78 #ifdef DOXYGEN_SHOULD_USE_THIS 110 inline String read(
unsigned long numBytes = 0)
113 return b.getString(numBytes == 0 ? b.
remaining() : std::min((
unsigned long)b.
remaining(),numBytes));
117 #ifdef DOXYGEN_SHOULD_USE_THIS 152 #ifdef DOXYGEN_SHOULD_USE_THIS 186 #ifdef DOXYGEN_SHOULD_USE_THIS 216 inline long long size() {
DelayedCallGuard dg(languageHook);
return file->GetLength(); }
219 #ifdef DOXYGEN_SHOULD_USE_THIS 252 inline long long seek(
long long seekBytes,
int iWhence = SEEK_SET) {
DelayedCallGuard dg(languageHook);
return file->Seek(seekBytes,iWhence); }
255 #ifdef DOXYGEN_SHOULD_USE_THIS 286 inline long long tell() {
DelayedCallGuard dg(languageHook);
return file->GetPosition(); }
289 #ifdef DOXYGEN_SHOULD_USE_THIS 320 inline const XFILE::CFile* getFile()
const {
return file; }
size_t remaining() const
This method provides for the remaining number of bytes that can be read out of the buffer or written ...
Definition: Buffer.h:207
Defining LOG_LIFECYCLE_EVENTS will log all instantiations, deletions and also reference countings (in...
Definition: Addon.cpp:25
bool Open(const CURL &file, const unsigned int flags=0)
Attempt to open an IFile instance.
Definition: File.cpp:245
This class is based on the java java.nio.Buffer class however, it does not implement the 'mark' funct...
Definition: Buffer.h:79
This class can be used to access the language hook's DelayedCallOpen and DelayedCallClose.
Definition: LanguageHook.h:122
This class is the superclass for all reference counted classes in the api.
Definition: AddonClass.h:57