CoinFileIO.hpp
Go to the documentation of this file.
1 /* $Id: CoinFileIO.hpp 1215 2009-11-05 11:03:04Z forrest $ */
2 // Copyright (C) 2005, COIN-OR. All Rights Reserved.
3 #ifndef CoinFileIO_H
4 #define CoinFileIO_H
5 
6 #include <string>
7 
10 {
11 public:
14  CoinFileIOBase (const std::string &fileName);
15 
17  ~CoinFileIOBase ();
18 
20  const char *getFileName () const;
21 
23  inline std::string getReadType () const
24  { return readType_.c_str();}
25 protected:
26  std::string readType_;
27 private:
28  CoinFileIOBase ();
30 
31  std::string fileName_;
32 };
33 
36 {
37 public:
45  static CoinFileInput *create (const std::string &fileName);
46 
49  CoinFileInput (const std::string &fileName);
50 
52  virtual ~CoinFileInput ();
53 
58  virtual int read (void *buffer, int size) = 0;
59 
69  virtual char *gets (char *buffer, int size) = 0;
70 };
71 
74 {
75 public:
76 
78  enum Compression {
82  };
83 
86  static bool compressionSupported (Compression compression);
87 
98  static CoinFileOutput *create (const std::string &fileName,
99  Compression compression);
100 
103  CoinFileOutput (const std::string &fileName);
104 
106  virtual ~CoinFileOutput ();
107 
112  virtual int write (const void * buffer, int size) = 0;
113 
121  virtual bool puts (const char *s);
122 
124  inline bool puts (const std::string &s)
125  {
126  return puts (s.c_str ());
127  }
128 };
129 
137 bool fileAbsPath (const std::string &path) ;
138 
157 bool fileCoinReadable(std::string &name,
158  const std::string &dfltPrefix = std::string(""));
159 #endif