|
WXP C++ Library Version 6.74.9
|
This class accesses files. More...
#include "../include/File.h"
Public Types | |
| enum | Type { REG , PIPE , STDIO , FIFO , DEVICE , SOCKETC , SOCKETS , HTTP , FTP } |
| enum | Format { UNK , WXP , NETCDF , GRIB , BUFR , UNISYS , NONE } |
Public Member Functions | |
| int | init () |
| File (const char *file, const char *raccess) | |
| File (String &file, const char *raccess) | |
| File (const char *file, int raccess) | |
| File () | |
| ~File () | |
| int | open (const char *file, const char *raccess) |
| int | open (String &file, const char *raccess) |
| int | open (const char *file, int raccess) |
| int | getLine (char *string, int len) |
| int | getLine (String &string) |
| int | skipLine () |
| bool | isOpen () |
| int | rewind () |
| int | close () |
| bool | endFile () |
| int | scanf (const char *fmt,...) |
| int | printf (const char *fmt,...) |
| int | read (unsigned char *buf, int size, int num) |
| int | read (unsigned char *buf, int size) |
| int | read (Buffer &buf, int size) |
| int | read (Buffer &buf) |
| int | write (const unsigned char *buf, int size, int num) |
| int | write (const unsigned char *buf, int size) |
| int | tell () |
| int | seek (int byte, int where) |
| int | seek (int byte) |
| int | setShare (int mode) |
| FILE * | getFP () |
Static Public Attributes | |
| static const int | FILE_LENGTH = 200 |
| Static Public Attributes inherited from WXP::FileAttr | |
| static const int | READ = 0 |
| static const int | WRITE = 1 |
| static const int | APPEND = 2 |
This class accesses files.
| File::File | ( | const char * | file, |
| const char * | raccess ) |
| File::File | ( | String & | file, |
| const char * | raccess ) |
Constructor. Opens file with access
References WXP::String::get(), and open().
| File::File | ( | const char * | file, |
| int | raccess ) |
| File::File | ( | ) |
Constructor. Initializes class data
References init().
| File::~File | ( | ) |
Destructor. Closes file
References close().
| int File::close | ( | ) |
Closes the file
Referenced by WXP::GridFile::checkType(), WXP::MiscPlot::draw(), WXP::RedbookPlot::draw(), WXP::ImgWxpFile::open(), WXP::WmoIngest::printLog(), WXP::ImgWxpFile::readData(), WXP::WmoIngest::readProdFile(), WXP::VarName::searchFile(), WXP::WmoIngest::sendPAN(), WXP::GifFile::write(), WXP::LZWComp::write(), and ~File().
| bool File::endFile | ( | ) |
| int File::getLine | ( | char * | string, |
| int | len ) |
Gets a line from the file
| string | Output string |
| len | Length of string |
References WXP::Wxp::outDebug().
Referenced by WXP::MiscPlot::draw(), WXP::RedbookPlot::draw(), WXP::Region::get(), getLine(), WXP::ColorFile::readFile(), WXP::WmoIngest::readProdFile(), WXP::VarName::searchFile(), WXP::VarName::searchFile(), WXP::ModelSpec::set(), WXP::NameConv::set(), and WXP::Graph::setFont().
| int File::getLine | ( | String & | string | ) |
| int File::init | ( | ) |
| bool File::isOpen | ( | ) |
Checks to see if file is open
Referenced by WXP::GridFile::checkType(), WXP::KmlFile::checkType(), WXP::MapFile::checkType(), WXP::ProfFile::checkType(), WXP::SatCdfFile::checkType(), WXP::SfcCdfFile::checkType(), WXP::SfcXmlFile::checkType(), WXP::MapPlot::draw(), WXP::MetaPlot::draw(), WXP::MiscPlot::draw(), WXP::Region::get(), WXP::ImgWxpFile::open(), WXP::WmoIngest::printLog(), WXP::ImgWxpFile::readData(), WXP::ColorFile::readFile(), WXP::WmoIngest::readProdFile(), WXP::VarName::searchFile(), WXP::VarName::searchFile(), WXP::WmoIngest::sendPAN(), WXP::ModelSpec::set(), WXP::NameConv::set(), WXP::Graph::setFont(), WXP::GifFile::write(), and WXP::LZWComp::write().
| int File::open | ( | const char * | file, |
| const char * | raccess ) |
Opens file with access
References WXP::FileTool::addUserPath(), WXP::Wxp::exit(), WXP::String::get(), WXP::StrLib::iequal(), init(), WXP::FileTool::isStdio(), WXP::FileTool::makeDir(), WXP::Wxp::NORUN, WXP::Wxp::outDebug(), WXP::FileAttr::READ, WXP::Wxp::validLicense(), and WXP::FileAttr::WRITE.
Referenced by WXP::BufrFile::checkType(), WXP::GribFile::checkType(), WXP::RedbookPlot::draw(), File(), File(), File(), open(), open(), WXP::ImgWxpFile::open(), WXP::WmoIngest::printLog(), WXP::WmoIngest::readProdFile(), WXP::ModelSpec::set(), WXP::Graph::setFont(), WXP::GifFile::write(), and WXP::LZWComp::write().
| int File::open | ( | const char * | file, |
| int | raccess ) |
Opens file with access
References WXP::FileAttr::APPEND, open(), WXP::FileAttr::READ, and WXP::FileAttr::WRITE.
| int File::open | ( | String & | file, |
| const char * | raccess ) |
Opens file with access
References WXP::String::get(), and open().
| int File::printf | ( | const char * | fmt, |
| ... ) |
Prints formatted data to file (see fprintf)
| fmt | Printf format to use |
| ... | Variables to format |
Referenced by WXP::WmoIngest::printLog(), scanf(), and WXP::WmoIngest::sendPAN().
| int File::read | ( | unsigned char * | rbuf, |
| int | size ) |
Reads a set number of values from file (see fread)
| rbuf | Output byte buffer |
| size | Number of bytes |
| int File::read | ( | unsigned char * | rbuf, |
| int | size, | ||
| int | num ) |
Reads a set number of values from file (see fread)
| rbuf | Output byte buffer |
| size | Size of each value in bytes |
| num | Number of values |
Referenced by WXP::GridFile::checkType(), WXP::MapFile::checkType(), WXP::ImgWxpFile::open(), WXP::ImgWxpFile::readData(), WXP::GifFile::write(), and WXP::LZWComp::write().
| int File::rewind | ( | ) |
Rewinds the file
| int File::scanf | ( | const char * | fmt, |
| ... ) |
Scans file for data (see fscanf)
| fmt | Scanf format to use |
| ... | Output variables |
References printf().
Referenced by WXP::KmlFile::checkType(), WXP::ProfFile::checkType(), WXP::SatCdfFile::checkType(), WXP::SfcCdfFile::checkType(), WXP::SfcXmlFile::checkType(), WXP::MapPlot::draw(), WXP::MetaPlot::draw(), and WXP::Unit::readFile().
|
inline |
| int File::seek | ( | int | byte, |
| int | where ) |
Seeks to a specific location in a file
| byte | Offset in file to seek to |
| where | Where to offset from (0=begin, 1=current, 2=end) |
| int File::setShare | ( | int | mode | ) |
Sets the share mode for file
| mode | 1=shared, 0=not shared |
| int File::skipLine | ( | ) |
Skips a line in the file
Referenced by WXP::Unit::readFile().
| int File::tell | ( | ) |
Returns the current location in file
| int File::write | ( | const unsigned char * | rbuf, |
| int | size ) |
Writes a set number of values to file (see fwrite)
| rbuf | Input byte buffer |
| size | Number of bytes |
| int File::write | ( | const unsigned char * | rbuf, |
| int | size, | ||
| int | num ) |
Writes a set number of values to file (see fwrite)
| rbuf | Input byte buffer |
| size | Size of each value in bytes |
| num | Number of values |