70 #ifndef SOFTWARE_AND_SERVICES_LIBRARY_COMMON_FILE_HPP_ 71 #define SOFTWARE_AND_SERVICES_LIBRARY_COMMON_FILE_HPP_ 74 #pragma warning (disable : 4251) 77 #ifdef BUILDING_SAS_COMMON_LIBRARY 82 #include <SaS/Common/osver.h> 83 #include <SaS/Common/instance.hpp> 84 #include <SaS/Common/Tokens.h> 88 #ifdef BUILDING_SAS_COMMON_LIBRARY 90 #define EXPORT_COMMON EXPORT_OUT 93 #define EXPORT_COMMON EXPORT_IN 103 #include <sys/types.h> 104 #include <sys/stat.h> 110 #include <sys/ioctl.h> 112 #ifdef BUILDING_SAS_COMMON_LIBRARY 113 #include "WinWrappers.hpp" 115 #include <SaS/Common/WinWrappers.hpp> 124 #define EOVERFLOW EINVAL 183 File(std::fstream * fs,
const char * aFileName);
207 File(
const int fd,
const char * aFileName);
224 explicit File(
const void * buffer, uint32_t BufferSize = 0);
241 explicit File(
const wchar_t * buffer, uint32_t BufferSize = 0);
261 explicit File(
char ** buffer, uint32_t * BufferSize =
nullptr);
281 explicit File(
wchar_t ** buffer, uint32_t * BufferSize =
nullptr);
298 void ThrowExceptions(
bool Enable);
308 static bool Lock(
const char * fileName);
318 static bool LockFileOnly(
const char * fileName);
328 static bool Trylock(
const char * fileName);
338 static bool Unlock(
const char * fileName);
348 static bool UnlockFileOnly(
const char * fileName);
360 bool Open(
const char * file,
int RWmode);
372 bool Mkdir(
const char * path, mode_t mode);
422 uint32_t Read(
void * data,
423 const uint32_t Length,
503 bool ReadLine(uint8_t ** Results,
506 bool DiscardEol =
true);
525 uint32_t Write(
const void * data,
526 const uint32_t Length);
542 uint32_t Write(
const char * data);
553 int Printf(
const char * Format, ...);
565 SEEK_SET_t = SEEK_SET,
570 SEEK_CUR_t = SEEK_CUR,
575 SEEK_END_t = SEEK_END
589 off_t Lseek(off_t offset,
Whence_t whence);
622 const char * GetFileName()
const;
628 const char * GetBuffer()
const;
634 bool IsMMapped()
const;
640 uint32_t GetBufferSize()
const;
646 static const char * GetTopDir();
655 static bool SetTopDir(
const char * theTop);
682 bool Keys(
const char * Private,
683 const char * Public);
694 bool Encrypt(
bool DoEncryption);
701 static int _MaxBufferSize;
706 static int _CreateMode;
722 const char * _FileName;
727 struct stat _StatBuf;
732 struct __stat64 _StatBuf;
774 char ** _OriginalBuf;
780 uint32_t * _OriginalSize;
811 static const char * _TopDir;
822 HANDLE _CreateMapHandle;
833 bool _ThrowExceptions;
838 void _BlockSigPipe();
843 const char * _Private;
848 const char * _Public;
870 #endif // SOFTWARE_AND_SERVICES_LIBRARY_COMMON_FILE_HPP_ Like 'FILE', except C++ implementation and allows sockets and disk files to use same object on WINDOW...
Whence_t
How to apply the offset variable in the lseek() member function.
Instance counting and tracking.
static const char * DefaultTopDir
The current topDir.
Copyright Douglas Mark Royer DouglasRoyer@gmail.com.
Base class for instance counting objects.
static const char * NewTmpFileExt
defult extension for temporary files created.
"<SaS/Common/psver.h>" Definitions specific to various OS's and OS versions.