Osi 0.107.9

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CoinFileIO.hpp
Go to the documentation of this file.
1 /* $Id: CoinFileIO.hpp 1439 2011-06-13 16:31:21Z stefan $ */
2 // Copyright (C) 2005, COIN-OR. All Rights Reserved.
3 // This code is licensed under the terms of the Eclipse Public License (EPL).
4
5 #ifndef CoinFileIO_H
6 #define CoinFileIO_H
7
8 #include <string>
9
11 class CoinFileIOBase
12 {
13 public:
16 CoinFileIOBase (const std::string &fileName);
17
19 ~CoinFileIOBase ();
20
22 const char *getFileName () const;
23
25 inline std::string getReadType () const
26 { return readType_.c_str();}
27 protected:
28 std::string readType_;
29 private:
30 CoinFileIOBase ();
31 CoinFileIOBase (const CoinFileIOBase &);
32
33 std::string fileName_;
34 };
35
37 class CoinFileInput: public CoinFileIOBase
38 {
39 public:
41 static bool haveGzipSupport();
43 static bool haveBzip2Support();
44
52 static CoinFileInput *create (const std::string &fileName);
53
56 CoinFileInput (const std::string &fileName);
57
59 virtual ~CoinFileInput ();
60
65 virtual int read (void *buffer, int size) = 0;
66
76 virtual char *gets (char *buffer, int size) = 0;
77 };
78
80 class CoinFileOutput: public CoinFileIOBase
81 {
82 public:
83
85 enum Compression {
86 COMPRESS_NONE = 0,
87 COMPRESS_GZIP = 1,
88 COMPRESS_BZIP2 = 2
89 };
90
93 static bool compressionSupported (Compression compression);
94
105 static CoinFileOutput *create (const std::string &fileName,
106 Compression compression);
107
110 CoinFileOutput (const std::string &fileName);
111
113 virtual ~CoinFileOutput ();
114
119 virtual int write (const void * buffer, int size) = 0;
120
128 virtual bool puts (const char *s);
129
131 inline bool puts (const std::string &s)
132 {
133 return puts (s.c_str ());
134 }
135 };
136
144 bool fileAbsPath (const std::string &path) ;
145
164 bool fileCoinReadable(std::string &name,
165 const std::string &dfltPrefix = std::string(""));
166 #endif
CoinFileOutput::puts
virtual bool puts(const char *s)
Write a string to the file (like fputs).
CoinFileOutput::puts
bool puts(const std::string &s)
Convenience method: just a &#39;puts(s.c_str())&#39;.
Definition: CoinFileIO.hpp:131
CoinFileInput::read
virtual int read(void *buffer, int size)=0
Read a block of data from the file, similar to fread.
CoinFileOutput::COMPRESS_BZIP2
bzip2 compression.
Definition: CoinFileIO.hpp:88
CoinFileOutput::~CoinFileOutput
virtual ~CoinFileOutput()
Destructor.
CoinFileInput::fileCoinReadable
bool fileCoinReadable(std::string &name, const std::string &dfltPrefix=std::string(""))
Test if the file is readable, using likely versions of the file name, and return the name that worked...
CoinFileInput::CoinFileInput
CoinFileInput(const std::string &fileName)
Constructor (don&#39;t use this, use the create method instead).
CoinFileOutput::COMPRESS_NONE
No compression.
Definition: CoinFileIO.hpp:86
CoinFileIOBase::CoinFileIOBase
CoinFileIOBase()
CoinFileIOBase
Base class for FileIO classes.
Definition: CoinFileIO.hpp:11
CoinFileIOBase::getFileName
const char * getFileName() const
Return the name of the file used by this object.
CoinFileOutput::CoinFileOutput
CoinFileOutput(const std::string &fileName)
Constructor (don&#39;t use this, use the create method instead).
CoinFileInput::fileAbsPath
bool fileAbsPath(const std::string &path)
Test if the given string looks like an absolute file path.
CoinFileOutput
Abstract base class for file output classes.
Definition: CoinFileIO.hpp:80
CoinFileOutput::Compression
Compression
The compression method.
Definition: CoinFileIO.hpp:85
CoinFileInput::haveBzip2Support
static bool haveBzip2Support()
indicates whether CoinFileInput supports bzip2&#39;ed files
CoinFileOutput::write
virtual int write(const void *buffer, int size)=0
Write a block of data to the file, similar to fwrite.
CoinFileIOBase::fileName_
std::string fileName_
Definition: CoinFileIO.hpp:33
CoinFileIOBase::readType_
std::string readType_
Definition: CoinFileIO.hpp:28
CoinFileOutput::compressionSupported
static bool compressionSupported(Compression compression)
Returns whether the specified compression method is supported (i.e.
CoinFileInput
Abstract base class for file input classes.
Definition: CoinFileIO.hpp:37
CoinFileInput::gets
virtual char * gets(char *buffer, int size)=0
Reads up to (size-1) characters an stores them into the buffer, similar to fgets. ...
CoinFileOutput::create
static CoinFileOutput * create(const std::string &fileName, Compression compression)
Factory method, that creates a CoinFileOutput (more precisely a subclass of it) for the file specifie...
CoinFileInput::create
static CoinFileInput * create(const std::string &fileName)
Factory method, that creates a CoinFileInput (more precisely a subclass of it) for the file specified...
CoinFileIOBase::~CoinFileIOBase
~CoinFileIOBase()
Destructor.
CoinFileIOBase::getReadType
std::string getReadType() const
Return the method of reading being used.
Definition: CoinFileIO.hpp:25
CoinFileInput::~CoinFileInput
virtual ~CoinFileInput()
Destructor.
CoinFileInput::haveGzipSupport
static bool haveGzipSupport()
indicates whether CoinFileInput supports gzip&#39;ed files
CoinFileOutput::COMPRESS_GZIP
gzip compression.
Definition: CoinFileIO.hpp:87