Mobile API Reference  MicroStrategy 2019
FileImpl.h
Go to the documentation of this file.
1 //==============================================================================================
2 // FILENAME : FileImpl.h
3 // AUTHOR : vovechkin
4 // CREATION : 2004-10-11
5 // Copyright (C) MicroStrategy Incorporated 2004
6 // All Rights Reserved
7 //==============================================================================================
8 #ifndef MFileSystem_FileImpl_h
9 #define MFileSystem_FileImpl_h
10 
12 
13 namespace MDataType
14 {
15  // forward declarations
16  class Binary;
17 }
18 
19 namespace MFileSystem
20 {
21  typedef int FileHandle;
22  #define INVALID_HANDLE_VALUE (-1)
23 
27  class FileImpl
28  {
29  public:
30 
34  static Int64 GetSize(const char* ipPath, FileHandle iFileHandle);
35 
41  static void Write(const char* ipPath, FileHandle iFileHandle, const char* ipString, size_t iLength = 0);
42 
46  static void Write(const char* ipPath, FileHandle iFileHandle, const void* ipBuffer, size_t iBufferSize);
47 
51  static void Read(const char* ipPath, FileHandle iFileHandle, void* ipBuffer, size_t iBufferSize);
52 
59  static void Read(const char* ipPath, FileHandle iFileHandle, MDataType::Binary& irBinary, size_t iMaxSize = 0);
60 
66  static void ReadLine(const char* ipPath, FileHandle iFileHandle, MDataType::Binary& irBinary);
67 
71  static void Flush(const char* ipPath, FileHandle iFileHandle);
72 
76  static void Truncate(const char* ipPath, FileHandle iFileHandle);
77 
81  static Int64 GetPosition(const char* ipPath, FileHandle iFileHandle);
82 
86  static Int64 MovePosition(const char* ipPath, FileHandle iFileHandle, Int64 iOffset);
87 
91  static void SetPosition(const char* ipPath, FileHandle iFileHandle, Int64 iOffset);
92 
96  static Int64 SetPositionToEnd(const char* ipPath, FileHandle iFileHandle);
97 
101  static void CloseAndGroundHandle(const char* ipPath, FileHandle& irFileHandle);
102 
106  static void CloseAndGroundHandle_NoThrow(FileHandle& irFileHandle) throw();
107 
111  static void TruncateFile_ThenCloseAndGroundHandle_NoThrow(FileHandle& irFileHandle) throw();
112 
116  static bool DoesPathMatchFileHandle(const char* ipPath, FileHandle iFileHandle);
117 
121  static bool WriteLock(const char* ipPath, FileHandle iFileHandle, bool iNoWait = false);
122 
126  static bool ReadLock(const char* ipPath, FileHandle iFileHandle, bool iNoWait = false);
127 
133  static void Unlock(FileHandle iFileHandle) throw();
134  };
135 }
136 
137 #endif // MFileSystem_FileImpl_h
static void Flush(const char *ipPath, FileHandle iFileHandle)
static void Read(const char *ipPath, FileHandle iFileHandle, void *ipBuffer, size_t iBufferSize)
MDataType::Binary represents binary data.
Definition: Binary.h:33
static Int64 SetPositionToEnd(const char *ipPath, FileHandle iFileHandle)
Definition: FileImpl.h:27
#define Int64
Definition: BasicTypes.h:36
static void CloseAndGroundHandle_NoThrow(FileHandle &irFileHandle)
static Int64 GetPosition(const char *ipPath, FileHandle iFileHandle)
Definition: BigDecimal.h:18
static void Truncate(const char *ipPath, FileHandle iFileHandle)
static Int64 GetSize(const char *ipPath, FileHandle iFileHandle)
static void ReadLine(const char *ipPath, FileHandle iFileHandle, MDataType::Binary &irBinary)
static bool DoesPathMatchFileHandle(const char *ipPath, FileHandle iFileHandle)
static void Write(const char *ipPath, FileHandle iFileHandle, const char *ipString, size_t iLength=0)
static bool WriteLock(const char *ipPath, FileHandle iFileHandle, bool iNoWait=false)
static void Unlock(FileHandle iFileHandle)
static void TruncateFile_ThenCloseAndGroundHandle_NoThrow(FileHandle &irFileHandle)
static bool ReadLock(const char *ipPath, FileHandle iFileHandle, bool iNoWait=false)
static Int64 MovePosition(const char *ipPath, FileHandle iFileHandle, Int64 iOffset)
static void SetPosition(const char *ipPath, FileHandle iFileHandle, Int64 iOffset)
static void CloseAndGroundHandle(const char *ipPath, FileHandle &irFileHandle)
int FileHandle
Definition: FileImpl.h:21
Definition: StrongObjects.h:21