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 = 100 |
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::BufrFile::checkType(), WXP::GribFile::checkType(), WXP::GridFile::checkType(), WXP::ImageFile::checkType(), WXP::AreaFile::close(), WXP::BufrFile::close(), WXP::CityFile::close(), WXP::GifFile::close(), WXP::GiniFile::close(), WXP::GribFile::close(), WXP::GridWxpFile::close(), WXP::ImgWxpFile::close(), WXP::KavradFile::close(), WXP::Lev2File::close(), WXP::LightFile::close(), WXP::LritFile::close(), WXP::LZWComp::close(), WXP::MapFile::close(), WXP::MetarFile::close(), WXP::NidsFile::close(), WXP::NowradFile::close(), WXP::Parse::close(), WXP::PngFile::close(), WXP::RcmFile::close(), WXP::RedbookFile::close(), WXP::ResrcFile::close(), WXP::SatFile::close(), WXP::SatUniFile::close(), WXP::SfcUniFile::close(), WXP::SfcWxpFile::close(), WXP::ShapeFile::close(), WXP::TiffFile::close(), WXP::VarFile::close(), WXP::WatchFile::close(), WXP::WmoIngest::close(), WXP::WmoParse::close(), WXP::MiscPlot::draw(), WXP::RedbookPlot::draw(), WXP::ModelName::get(), WXP::NidsFile::open(), WXP::ImgWxpFile::open(), WXP::Message::print(), WXP::WmoIngest::printLog(), WXP::ImgWxpFile::readData(), WXP::WmoIngest::readProdFile(), WXP::VarName::searchFile(), WXP::WmoIngest::sendPAN(), WXP::GifFile::write(), WXP::LZWComp::write(), WXP::GifFile::write(), WXP::ImgWxpFile::write(), WXP::LZWComp::write(), WXP::PngFile::write(), ~File(), WXP::GridWxpFile::~GridWxpFile(), WXP::Message::~Message(), WXP::MetarFile::~MetarFile(), WXP::PngFile::~PngFile(), WXP::RedbookFile::~RedbookFile(), WXP::ResrcFile::~ResrcFile(), WXP::SfcUniFile::~SfcUniFile(), and WXP::SfcWxpFile::~SfcWxpFile().
bool File::endFile | ( | ) |
Checks for end of file
Referenced by WXP::RcmFile::read(), WXP::SfcUniFile::read(), WXP::NidsFile::readBytes(), WXP::NowradFile::readLine(), WXP::KavradFile::readPacket(), WXP::NowradFile::readPacket(), and WXP::ModelSpec::set().
int File::getLine | ( | char * | string, |
int | len | ||
) |
Gets a line from the file
string | Output string |
len | Length of string |
References WXP::Buffer::getAvail(), WXP::Wxp::outDebug(), and WXP::Buffer::readLine().
Referenced by WXP::MiscPlot::draw(), WXP::RedbookPlot::draw(), WXP::Region::get(), WXP::ModelName::get(), WXP::ResrcFile::get(), WXP::GribFile::getHeader(), WXP::Parse::getLine(), WXP::WmoParse::getLine(), WXP::MetarFile::getLine(), getLine(), WXP::SfcWxpFile::open(), WXP::CityFile::read(), WXP::GribFile::read(), WXP::LightFile::read(), WXP::RcmFile::read(), WXP::SfcWxpFile::read(), WXP::VarFile::read(), WXP::WatchFile::read(), WXP::ColorFile::readFile(), WXP::BufrFile::readHeader(), WXP::GribFile::readHeader(), WXP::RedbookFile::readHeader(), WXP::GiniFile::readHeader(), WXP::ImgWxpFile::readHeader(), WXP::WmoIngest::readProdFile(), WXP::VarName::searchFile(), WXP::VarName::searchFile(), WXP::ModelSpec::set(), WXP::NameConv::set(), WXP::Graph::setFont(), WXP::Parse::setLoc(), and WXP::WmoParse::setLoc().
int File::getLine | ( | String & | string | ) |
int File::init | ( | ) |
bool File::isOpen | ( | ) |
Checks to see if file is open
Referenced by WXP::BufrFile::checkType(), WXP::GribFile::checkType(), WXP::GridFile::checkType(), WXP::ImageFile::checkType(), WXP::KmlFile::checkType(), WXP::MapFile::checkType(), WXP::ProfFile::checkType(), WXP::SatCdfFile::checkType(), WXP::SatFile::checkType(), WXP::SfcCdfFile::checkType(), WXP::SfcFile::checkType(), WXP::SfcWmoFile::checkType(), WXP::SfcWxpFile::checkType(), WXP::SfcXmlFile::checkType(), WXP::ShapeFile::checkType(), WXP::UpaWmoFile::checkType(), WXP::GribFile::close(), WXP::MapPlot::draw(), WXP::MetaPlot::draw(), WXP::MiscPlot::draw(), WXP::Region::get(), WXP::ModelName::get(), WXP::RedbookFile::open(), WXP::VarFile::open(), WXP::AreaFile::open(), WXP::BufrFile::open(), WXP::GribFile::open(), WXP::LritFile::open(), WXP::NidsFile::open(), WXP::SfcWmoFile::open(), WXP::UpaWmoFile::open(), WXP::WatchFile::open(), WXP::CityFile::open(), WXP::GifFile::open(), WXP::LZWComp::open(), WXP::PngFile::open(), WXP::SfcUniFile::open(), WXP::SfcWxpFile::open(), WXP::TiffFile::open(), WXP::GridWxpFile::open(), WXP::SfcFile::open(), WXP::ShapeFile::open(), WXP::ImgWxpFile::open(), WXP::GiniFile::open(), WXP::Lev2File::open(), WXP::LightFile::open(), WXP::SatUniFile::open(), WXP::MapFile::open(), WXP::ResrcFile::open(), WXP::KavradFile::open(), WXP::NowradFile::open(), WXP::GribFile::open(), WXP::MetarFile::open(), WXP::Parse::open(), WXP::WmoParse::open(), WXP::Message::print(), WXP::WmoIngest::printLog(), WXP::GiniFile::read(), WXP::SatUniFile::read(), WXP::ImgWxpFile::read(), WXP::VarFile::read(), WXP::GiniFile::readData(), WXP::SatUniFile::readData(), WXP::ImgWxpFile::readData(), WXP::ColorFile::readFile(), WXP::RedbookFile::readHeader(), WXP::GiniFile::readHeader(), WXP::SatUniFile::readHeader(), WXP::WmoIngest::readProdFile(), WXP::VarName::searchFile(), WXP::VarName::searchFile(), WXP::WmoIngest::sendPAN(), WXP::ModelSpec::set(), WXP::NameConv::set(), WXP::Graph::setFont(), WXP::GifFile::write(), WXP::LZWComp::write(), WXP::GiniFile::write(), WXP::ImgWxpFile::write(), and WXP::Message::~Message().
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::WmoIngest::action(), WXP::BufrFile::checkType(), WXP::GribFile::checkType(), WXP::RedbookPlot::draw(), File(), File(), File(), WXP::ModelName::get(), WXP::RedbookFile::open(), WXP::VarFile::open(), open(), WXP::AreaFile::open(), WXP::BufrFile::open(), WXP::GribFile::open(), WXP::LritFile::open(), WXP::NidsFile::open(), WXP::SfcWmoFile::open(), WXP::UpaWmoFile::open(), WXP::WatchFile::open(), WXP::CityFile::open(), WXP::GifFile::open(), WXP::LZWComp::open(), WXP::PngFile::open(), WXP::SfcUniFile::open(), WXP::SfcWxpFile::open(), WXP::TiffFile::open(), WXP::GridWxpFile::open(), WXP::SfcFile::open(), WXP::ShapeFile::open(), WXP::ImgWxpFile::open(), WXP::SatFile::open(), WXP::GiniFile::open(), WXP::Lev2File::open(), WXP::LightFile::open(), WXP::SatUniFile::open(), WXP::MapFile::open(), WXP::ResrcFile::open(), WXP::KavradFile::open(), WXP::NowradFile::open(), WXP::GribFile::open(), WXP::MetarFile::open(), WXP::Parse::open(), WXP::WmoParse::open(), open(), WXP::Message::print(), WXP::WmoIngest::printLog(), WXP::WmoIngest::readProdFile(), WXP::ModelSpec::set(), WXP::Message::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::close(), WXP::SfcUniFile::open(), WXP::SfcWxpFile::open(), WXP::Message::print(), WXP::WmoIngest::printLog(), WXP::WmoIngest::saveHeader(), scanf(), WXP::WmoIngest::sendPAN(), WXP::ImgWxpFile::write(), WXP::MapFile::writeData(), and WXP::MapFile::writeHeader().
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 |
References WXP::Buffer::getAvail(), and WXP::Buffer::read().
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 |
References WXP::Buffer::read().
Referenced by WXP::BufrFile::checkType(), WXP::GribFile::checkType(), WXP::GridFile::checkType(), WXP::ImageFile::checkType(), WXP::MapFile::checkType(), WXP::SfcFile::checkType(), WXP::SfcWxpFile::checkType(), WXP::ShapeFile::checkType(), WXP::LritFile::getHeader(), WXP::SfcUniFile::open(), WXP::ImgWxpFile::open(), WXP::LightFile::open(), WXP::GifFile::read(), WXP::LritFile::read(), WXP::LZWComp::read(), WXP::PngFile::read(), WXP::TiffFile::read(), WXP::LightFile::read(), WXP::ShapeFile::read(), WXP::GribFile::readBits(), WXP::GribFile::readBMB(), WXP::GribFile::readBMS(), WXP::AreaFile::readByte(), WXP::GiniFile::readData(), WXP::SatUniFile::readData(), WXP::AreaFile::readData(), WXP::ImgWxpFile::readData(), WXP::GribFile::readData(), WXP::GribFile::readDS(), WXP::AreaFile::readHeader(), WXP::KavradFile::readHeader(), WXP::NowradFile::readHeader(), WXP::GiniFile::readHeader(), WXP::SatUniFile::readHeader(), WXP::NowradFile::readLine(), WXP::KavradFile::readPacket(), WXP::NowradFile::readPacket(), WXP::RedbookFile::readPacket(), WXP::AreaFile::readWord(), WXP::NidsFile::skipLine(), WXP::GifFile::write(), and WXP::LZWComp::write().
int File::rewind | ( | ) |
Rewinds the file
Referenced by WXP::RedbookFile::readHeader(), WXP::AreaFile::rewind(), WXP::CityFile::rewind(), WXP::GiniFile::rewind(), WXP::KavradFile::rewind(), WXP::MapFile::rewind(), WXP::MetarFile::rewind(), WXP::NowradFile::rewind(), WXP::Parse::rewind(), WXP::SatFile::rewind(), WXP::SatUniFile::rewind(), WXP::SfcWxpFile::rewind(), WXP::VarFile::rewind(), WXP::WmoParse::rewind(), WXP::Parse::setLoc(), and WXP::WmoParse::setLoc().
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::SatFile::checkType(), WXP::SfcCdfFile::checkType(), WXP::SfcWmoFile::checkType(), WXP::SfcXmlFile::checkType(), WXP::UpaWmoFile::checkType(), WXP::MapPlot::draw(), WXP::MetaPlot::draw(), WXP::LightFile::read(), WXP::MapFile::readData(), WXP::ImgWxpFile::readData(), WXP::Unit::readFile(), WXP::NowradFile::readHeader(), WXP::SatUniFile::readHeader(), WXP::ImgWxpFile::readHeader(), WXP::MapFile::readHeader(), and WXP::MapFile::skipData().
|
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) |
Referenced by WXP::ShapeFile::close(), WXP::LritFile::getHeader(), WXP::GribFile::getHeader(), WXP::Parse::getLine(), WXP::WmoParse::getLine(), WXP::GribFile::next(), WXP::ShapeFile::open(), WXP::LightFile::open(), WXP::GribFile::read(), WXP::TiffFile::read(), WXP::LightFile::read(), WXP::ShapeFile::read(), WXP::AreaFile::readHeader(), WXP::KavradFile::readHeader(), WXP::NowradFile::readPacket(), WXP::SfcUniFile::rewind(), WXP::MapFile::seek(), WXP::Parse::setLoc(), WXP::WmoParse::setLoc(), WXP::MapFile::skipData(), and WXP::GribFile::skipSection().
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
References WXP::Buffer::getAvail(), and WXP::Buffer::skipLine().
Referenced by WXP::SfcWxpFile::open(), WXP::LightFile::open(), WXP::Unit::readFile(), WXP::BufrFile::readHeader(), WXP::GribFile::readHeader(), WXP::GiniFile::rewind(), WXP::SatFile::rewind(), WXP::SatUniFile::rewind(), and WXP::SfcWxpFile::rewind().
int File::tell | ( | ) |
Returns the current location in file
Referenced by WXP::ShapeFile::close(), WXP::Parse::getLine(), WXP::WmoParse::getLine(), WXP::SfcWxpFile::open(), WXP::TiffFile::read(), WXP::ShapeFile::read(), WXP::SatUniFile::readData(), WXP::GribFile::readData(), WXP::BufrFile::readHeader(), WXP::GribFile::readHeader(), WXP::WmoIngest::saveHeader(), WXP::WmoIngest::sendPAN(), WXP::Parse::setLoc(), WXP::WmoParse::setLoc(), and WXP::MapFile::tell().
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 |
Referenced by WXP::ShapeFile::open(), WXP::WmoIngest::saveLine(), WXP::GifFile::write(), WXP::LZWComp::write(), WXP::GifFile::write(), WXP::ImgWxpFile::write(), WXP::LZWComp::write(), WXP::ShapeFile::write(), and WXP::GribFile::writeBits().