WXP C++ Library Version 6.74.9
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Attributes | List of all members
WXP::File Class Reference

This class accesses files. More...

#include "../include/File.h"

Inheritance diagram for WXP::File:
WXP::FileAttr

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
 

Detailed Description

This class accesses files.

Author
Dan Vietor

Constructor & Destructor Documentation

◆ File() [1/4]

File::File ( const char *  file,
const char *  raccess 
)

Constructor. Opens file with access

Parameters
fileFilename to open
raccessFile access (r, w, a, r+, see fopen)

References open().

◆ File() [2/4]

File::File ( String file,
const char *  raccess 
)

Constructor. Opens file with access

Parameters
fileFilename to open
accessFile access (r, w, a, r+, see fopen)

References WXP::String::get(), and open().

◆ File() [3/4]

File::File ( const char *  file,
int  raccess 
)

Constructor. Opens file with access

Parameters
fileFilename to open
raccessFile access READ, WRITE, APPEND

References open().

◆ File() [4/4]

File::File ( )

Constructor. Initializes class data

References init().

◆ ~File()

File::~File ( )

Destructor. Closes file

References close().

Member Function Documentation

◆ 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().

◆ endFile()

bool File::endFile ( )

◆ getLine() [1/2]

int File::getLine ( char *  string,
int  len 
)

◆ getLine() [2/2]

int File::getLine ( String string)

Gets a line from the file

Return values
stringOutput string class

References getLine().

◆ init()

int File::init ( )

Initializes the class data

References WXP::FileAttr::READ.

Referenced by File(), and open().

◆ isOpen()

bool File::isOpen ( )

Checks to see if file is open

Returns
True if 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().

◆ open() [1/3]

int File::open ( const char *  file,
const char *  raccess 
)

Opens file with access

Parameters
fileFilename to open
accessFile access (r, w, a, r+, see fopen)

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().

◆ open() [2/3]

int File::open ( const char *  file,
int  raccess 
)

Opens file with access

Parameters
fileFilename to open
raccessFile access READ, WRITE, APPEND

References WXP::FileAttr::APPEND, open(), WXP::FileAttr::READ, and WXP::FileAttr::WRITE.

◆ open() [3/3]

int File::open ( String file,
const char *  raccess 
)

Opens file with access

Parameters
fileFilename to open
accessFile access (r, w, a, r+, see fopen)

References WXP::String::get(), and open().

◆ printf()

int File::printf ( const char *  fmt,
  ... 
)

◆ read() [1/2]

int File::read ( unsigned char *  rbuf,
int  size 
)

Reads a set number of values from file (see fread)

Return values
rbufOutput byte buffer
Parameters
sizeNumber of bytes

References WXP::Buffer::getAvail(), and WXP::Buffer::read().

◆ read() [2/2]

int File::read ( unsigned char *  rbuf,
int  size,
int  num 
)

◆ rewind()

int File::rewind ( )

◆ scanf()

int File::scanf ( const char *  fmt,
  ... 
)

◆ seek() [1/2]

int WXP::File::seek ( int  byte)
inline

Seeks to byte position in file offset from beginning

References seek().

Referenced by seek().

◆ seek() [2/2]

int File::seek ( int  byte,
int  where 
)

◆ setShare()

int File::setShare ( int  mode)

Sets the share mode for file

Parameters
mode1=shared, 0=not shared

◆ skipLine()

int File::skipLine ( )

◆ tell()

int File::tell ( )

◆ write() [1/2]

int File::write ( const unsigned char *  rbuf,
int  size 
)

Writes a set number of values to file (see fwrite)

Parameters
rbufInput byte buffer
sizeNumber of bytes

◆ write() [2/2]

int File::write ( const unsigned char *  rbuf,
int  size,
int  num 
)

Writes a set number of values to file (see fwrite)

Parameters
rbufInput byte buffer
sizeSize of each value in bytes
numNumber 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().


The documentation for this class was generated from the following files: