#include <file_io.h>
|
| AJAFileIO () |
|
| ~AJAFileIO () |
|
AJAStatus | Open (const std::string &fileName, const int flags, const int properties) |
|
AJAStatus | Open (const std::wstring &fileName, const int flags, const int properties) |
|
AJAStatus | Close () |
|
bool | IsOpen () |
|
uint32_t | Read (uint8_t *pBuffer, const uint32_t length) |
|
uint32_t | Read (std::string &buffer, const uint32_t length) |
|
uint32_t | Write (const uint8_t *pBuffer, const uint32_t length) const |
|
uint32_t | Write (const std::string &buffer) const |
|
AJAStatus | Sync () |
|
AJAStatus | Truncate (int32_t offset) |
|
int64_t | Tell () |
|
AJAStatus | Seek (const int64_t distance, const AJAFileSetFlag flag) const |
|
AJAStatus | FileInfo (int64_t &createTime, int64_t &modTime, int64_t &size) |
|
AJAStatus | FileInfo (int64_t &createTime, int64_t &modTime, int64_t &size, std::string &filePath) |
|
void | SetHandle (FILE *fp) |
|
void * | GetHandle (void) |
|
|
static bool | FileExists (const std::wstring &fileName) |
|
static bool | FileExists (const std::string &fileName) |
|
static AJAStatus | Delete (const std::string &fileName) |
|
static AJAStatus | Delete (const std::wstring &fileName) |
|
static AJAStatus | ReadDirectory (const std::string &directory, const std::string &filePattern, std::vector< std::string > &fileContainer) |
|
static AJAStatus | ReadDirectory (const std::wstring &directory, const std::wstring &filePattern, std::vector< std::wstring > &fileContainer) |
|
static AJAStatus | DoesDirectoryContain (const std::string &directory, const std::string &filePattern) |
|
static AJAStatus | DoesDirectoryContain (const std::wstring &directory, const std::wstring &filePattern) |
|
static AJAStatus | DoesDirectoryExist (const std::string &directory) |
|
static AJAStatus | DoesDirectoryExist (const std::wstring &directory) |
|
static bool | DirectoryExists (const std::string &directory) |
|
static bool | DirectoryExists (const std::wstring &directory) |
|
static AJAStatus | IsDirectoryEmpty (const std::string &directory) |
|
static AJAStatus | IsDirectoryEmpty (const std::wstring &directory) |
|
static AJAStatus | TempDirectory (std::string &directory) |
|
static AJAStatus | TempDirectory (std::wstring &directory) |
|
static AJAStatus | GetWorkingDirectory (std::string &directory) |
|
static AJAStatus | GetWorkingDirectory (std::wstring &directory) |
|
static AJAStatus | GetDirectoryName (const std::string &path, std::string &directory) |
|
static AJAStatus | GetDirectoryName (const std::wstring &path, std::wstring &directory) |
|
static AJAStatus | GetFileName (const std::string &path, std::string &filename) |
|
static AJAStatus | GetFileName (const std::wstring &path, std::wstring &filename) |
|
static AJAStatus | GetExecutablePath (std::string &path) |
|
static AJAStatus | GetExecutablePath (std::wstring &path) |
|
The File I/O class proper.
Definition at line 64 of file file_io.h.
◆ AJAFileIO()
◆ ~AJAFileIO()
AJAFileIO::~AJAFileIO |
( |
| ) |
|
◆ Close()
Close a file.
- Returns
- AJA_STATUS_SUCCESS The file was successfully closed AJA_STATUS_FAIL The file could not be closed
Definition at line 281 of file file_io.cpp.
◆ Delete() [1/2]
static AJAStatus AJAFileIO::Delete |
( |
const std::string & |
fileName | ) |
|
|
static |
Remove the file from the system
- Parameters
-
[in] | fileName | The fully qualified file name |
- Returns
- AJA_STATUS_SUCCESS The file was successfully deleteed AJA_STATUS_FAIL The file could not be deleted
◆ Delete() [2/2]
static AJAStatus AJAFileIO::Delete |
( |
const std::wstring & |
fileName | ) |
|
|
static |
◆ DirectoryExists() [1/2]
bool AJAFileIO::DirectoryExists |
( |
const std::string & |
directory | ) |
|
|
static |
Tests if a directory exists. Does not change the current directory.
- Parameters
-
[in] | directory | The path to the directory |
- Returns
- true If and only if the directory exists
Definition at line 1113 of file file_io.cpp.
◆ DirectoryExists() [2/2]
bool AJAFileIO::DirectoryExists |
( |
const std::wstring & |
directory | ) |
|
|
static |
◆ DoesDirectoryContain() [1/2]
AJAStatus AJAFileIO::DoesDirectoryContain |
( |
const std::string & |
directory, |
|
|
const std::string & |
filePattern |
|
) |
| |
|
static |
Tests if a directory contains a file that matches the pattern. Does not change the current directory.
- Parameters
-
[in] | directory | The path to the directory |
[in] | filePattern | The pattern within the directory to match |
- Returns
- AJA_STATUS_SUCCESS If the directory has at least one matching file
Definition at line 974 of file file_io.cpp.
◆ DoesDirectoryContain() [2/2]
AJAStatus AJAFileIO::DoesDirectoryContain |
( |
const std::wstring & |
directory, |
|
|
const std::wstring & |
filePattern |
|
) |
| |
|
static |
◆ DoesDirectoryExist() [1/2]
AJAStatus AJAFileIO::DoesDirectoryExist |
( |
const std::string & |
directory | ) |
|
|
static |
Tests if a directory exists. Does not change the current directory.
- Parameters
-
[in] | directory | The path to the directory |
- Returns
- AJA_STATUS_SUCCESS If and only if the directory exists
Definition at line 1070 of file file_io.cpp.
◆ DoesDirectoryExist() [2/2]
AJAStatus AJAFileIO::DoesDirectoryExist |
( |
const std::wstring & |
directory | ) |
|
|
static |
◆ FileExists() [1/2]
bool AJAFileIO::FileExists |
( |
const std::string & |
fileName | ) |
|
|
static |
◆ FileExists() [2/2]
bool AJAFileIO::FileExists |
( |
const std::wstring & |
fileName | ) |
|
|
static |
Test file to see if it exists
- Parameters
-
[in] | fileName | The fully qualified file name |
- Returns
- bool true if file exists
Definition at line 97 of file file_io.cpp.
◆ FileInfo() [1/2]
AJAStatus AJAFileIO::FileInfo |
( |
int64_t & |
createTime, |
|
|
int64_t & |
modTime, |
|
|
int64_t & |
size |
|
) |
| |
Get some basic file info
- Parameters
-
[out] | createTime | Time of file creation, measured in seconds since 1970 |
[out] | modTime | Last time file was modified, measured in seconds since 1970 |
[out] | size | Size of the file in bytes |
- Returns
- AJA_STATUS_SUCCESS Was able to get info from the file
Definition at line 627 of file file_io.cpp.
◆ FileInfo() [2/2]
AJAStatus AJAFileIO::FileInfo |
( |
int64_t & |
createTime, |
|
|
int64_t & |
modTime, |
|
|
int64_t & |
size, |
|
|
std::string & |
filePath |
|
) |
| |
◆ GetDirectoryName() [1/2]
AJAStatus AJAFileIO::GetDirectoryName |
( |
const std::string & |
path, |
|
|
std::string & |
directory |
|
) |
| |
|
static |
Retrieves the directory name from the specified path.
- Parameters
-
[in] | path | Path from which to extract the directory name |
[out] | directory | Path of the directory extracted from specified path |
- Returns
- AJA_STATUS_SUCCESS If and only if the directory name is extracted
Definition at line 1301 of file file_io.cpp.
◆ GetDirectoryName() [2/2]
AJAStatus AJAFileIO::GetDirectoryName |
( |
const std::wstring & |
path, |
|
|
std::wstring & |
directory |
|
) |
| |
|
static |
◆ GetExecutablePath() [1/2]
AJAStatus AJAFileIO::GetExecutablePath |
( |
std::string & |
path | ) |
|
|
static |
Retrieves the full path of the currently running exectuable.
- Parameters
-
[out] | path | Path of the running executable |
- Returns
- AJA_STATUS_SUCCESS If and only if the executable path is retrieved
Definition at line 1361 of file file_io.cpp.
◆ GetExecutablePath() [2/2]
AJAStatus AJAFileIO::GetExecutablePath |
( |
std::wstring & |
path | ) |
|
|
static |
◆ GetFileName() [1/2]
AJAStatus AJAFileIO::GetFileName |
( |
const std::string & |
path, |
|
|
std::string & |
filename |
|
) |
| |
|
static |
Retrieves the filename (with extension) from the specified path.
- Parameters
-
[in] | path | Path from which to extract the filename |
[out] | filename | Filename extracted from specified path |
- Returns
- AJA_STATUS_SUCCESS If and only if the filename is extracted
Definition at line 1331 of file file_io.cpp.
◆ GetFileName() [2/2]
AJAStatus AJAFileIO::GetFileName |
( |
const std::wstring & |
path, |
|
|
std::wstring & |
filename |
|
) |
| |
|
static |
◆ GetHandle()
void* AJAFileIO::GetHandle |
( |
void |
| ) |
|
|
inline |
◆ GetWorkingDirectory() [1/2]
AJAStatus AJAFileIO::GetWorkingDirectory |
( |
std::string & |
directory | ) |
|
|
static |
Retrieves the path to the current working directory
- Parameters
-
[out] | directory | Path of the current working directory |
- Returns
- AJA_STATUS_SUCCESS If and only if current working directory retrieved.
Definition at line 1269 of file file_io.cpp.
◆ GetWorkingDirectory() [2/2]
AJAStatus AJAFileIO::GetWorkingDirectory |
( |
std::wstring & |
directory | ) |
|
|
static |
◆ IsDirectoryEmpty() [1/2]
AJAStatus AJAFileIO::IsDirectoryEmpty |
( |
const std::string & |
directory | ) |
|
|
static |
Tests if a directory is empty. Does not change the current directory.
- Parameters
-
[in] | directory | The path to the directory |
- Returns
- AJA_STATUS_SUCCESS If and only if the directory contains no files
Definition at line 1126 of file file_io.cpp.
◆ IsDirectoryEmpty() [2/2]
AJAStatus AJAFileIO::IsDirectoryEmpty |
( |
const std::wstring & |
directory | ) |
|
|
static |
◆ IsOpen()
bool AJAFileIO::IsOpen |
( |
| ) |
|
Tests for a valid open file.
- Returns
- bool 'true' if a valid file is available
Definition at line 317 of file file_io.cpp.
◆ Open() [1/2]
AJAStatus AJAFileIO::Open |
( |
const std::string & |
fileName, |
|
|
const int |
flags, |
|
|
const int |
properties |
|
) |
| |
Open a file.
- Parameters
-
[in] | fileName | The fully qualified file name |
[in] | flags | The way in which the file is opened |
[in] | properties | Indicates whether the file is buffered or not |
- Returns
- AJA_STATUS_SUCCESS A file has been successfully opened AJA_STATUS_FAIL A file could not be opened
Definition at line 201 of file file_io.cpp.
◆ Open() [2/2]
AJAStatus AJAFileIO::Open |
( |
const std::wstring & |
fileName, |
|
|
const int |
flags, |
|
|
const int |
properties |
|
) |
| |
◆ Read() [1/2]
uint32_t AJAFileIO::Read |
( |
std::string & |
buffer, |
|
|
const uint32_t |
length |
|
) |
| |
Read the contents of the file.
- Parameters
-
[out] | buffer | The buffer to be written to |
[in] | length | The number of bytes to be read |
- Returns
- uint32_t The number of bytes actually read
Definition at line 360 of file file_io.cpp.
◆ Read() [2/2]
uint32_t AJAFileIO::Read |
( |
uint8_t * |
pBuffer, |
|
|
const uint32_t |
length |
|
) |
| |
Read the contents of the file.
- Parameters
-
[out] | pBuffer | The buffer to be written to |
[in] | length | The number of bytes to be read |
- Returns
- uint32_t The number of bytes actually read
Definition at line 328 of file file_io.cpp.
◆ ReadDirectory() [1/2]
AJAStatus AJAFileIO::ReadDirectory |
( |
const std::string & |
directory, |
|
|
const std::string & |
filePattern, |
|
|
std::vector< std::string > & |
fileContainer |
|
) |
| |
|
static |
Retrieves a set of files from a directory. Changes the current directory.
- Parameters
-
[in] | directory | The path to the directory |
[in] | filePattern | The pattern within the directory to match |
[out] | fileContainer | The files that match the file pattern |
- Returns
- AJA_STATUS_SUCCESS The returned container has a size > 0
Definition at line 805 of file file_io.cpp.
◆ ReadDirectory() [2/2]
AJAStatus AJAFileIO::ReadDirectory |
( |
const std::wstring & |
directory, |
|
|
const std::wstring & |
filePattern, |
|
|
std::vector< std::wstring > & |
fileContainer |
|
) |
| |
|
static |
◆ Seek()
Moves the offset of the file pointer.
- Parameters
-
[in] | distance | The distance to move the file pointer |
[in] | flag | Describes from whence to move the file pointer |
- Returns
- AJA_STATUS_SUCCESS The position of the file pointer was moved
Definition at line 545 of file file_io.cpp.
◆ SetHandle()
void AJAFileIO::SetHandle |
( |
FILE * |
fp | ) |
|
Set private file handle from FILE pointer.
- Parameters
-
Definition at line 1415 of file file_io.cpp.
◆ Sync()
Flush the cache
- Returns
- AJA_STATUS_SUCCESS Was able to sync file
Definition at line 430 of file file_io.cpp.
◆ Tell()
int64_t AJAFileIO::Tell |
( |
| ) |
|
Retrieves the offset of the file pointer from the start of a file.
- Returns
- int64_t The position of the file pointer, -1 if error
Definition at line 503 of file file_io.cpp.
◆ TempDirectory() [1/2]
AJAStatus AJAFileIO::TempDirectory |
( |
std::string & |
directory | ) |
|
|
static |
Retrieves a path to the temp directory
- Parameters
-
[out] | directory | The path to the temp directory |
- Returns
- AJA_STATUS_SUCCESS If and only if a temp directory found
Definition at line 1166 of file file_io.cpp.
◆ TempDirectory() [2/2]
AJAStatus AJAFileIO::TempDirectory |
( |
std::wstring & |
directory | ) |
|
|
static |
◆ Truncate()
AJAStatus AJAFileIO::Truncate |
( |
int32_t |
offset | ) |
|
Truncates the file.
- Parameters
-
[in] | offset | The size offset of the file |
- Returns
- AJA_STATUS_SUCCESS Was able to truncate file
Definition at line 459 of file file_io.cpp.
◆ Write() [1/2]
uint32_t AJAFileIO::Write |
( |
const std::string & |
buffer | ) |
const |
Write the contents of the file.
- Parameters
-
[in] | buffer | The buffer to be written out |
- Returns
- uint32_t The number of bytes actually written
Definition at line 419 of file file_io.cpp.
◆ Write() [2/2]
uint32_t AJAFileIO::Write |
( |
const uint8_t * |
pBuffer, |
|
|
const uint32_t |
length |
|
) |
| const |
Write the contents of the file.
- Parameters
-
[in] | pBuffer | The buffer to be written out |
[in] | length | The number of bytes to be written |
- Returns
- uint32_t The number of bytes actually written
Definition at line 380 of file file_io.cpp.
The documentation for this class was generated from the following files:
- /home/tcbuilder/buildAgent/work/df8e8cce5bebfd58/libajantv2/ajabase/system/file_io.h
- /home/tcbuilder/buildAgent/work/df8e8cce5bebfd58/libajantv2/ajabase/system/file_io.cpp