alternative Standard Libary  0.29.8
std::filestream Klassenreferenz

#include <filestream.hpp>

+ Klassendiagramm für std::filestream:
+ Zusammengehörigkeiten von std::filestream:

Öffentliche Methoden

 filestream ()
 
 filestream (std::string file, filemode_t mode, bool binary)
 
 filestream (const filestream &fs)
 
virtual ~filestream ()
 
virtual bool close ()
 
virtual size_t seek (size_t off, seek_t org)
 
virtual size_t read (void *data, size_t offset, size_t size)
 
virtual size_t write (const void *data, size_t offset, size_t size)
 
virtual filestreamreopen (filemode_t mode, bool binary)
 
virtual void clear ()
 
virtual void write (char c)
 
virtual char read ()
 
virtual long position ()
 
virtual long size ()
 
virtual bool iseof ()
 
virtual void flush ()
 
virtual std::string filename ()
 
virtual bool isbinary ()
 
virtual filemode_t mode ()
 
 operator bool ()
 
filestreamoperator= (const filestream &fs)
 
virtual bool canRead ()
 
virtual bool canSeek ()
 
virtual bool canWrite ()
 

Öffentliche, statische Methoden

static bool isfile (std::string file)
 
static bool canread (std::string file)
 
static bool canwrite (std::string file)
 

Geschützte Methoden

 filestream (FILE *f, filemode_t mode, bool b)
 

Geschützte Attribute

filemode_t m_mode
 
auto_ptr< FILE > m_fFile
 
std::string m_strFile
 
bool m_binary
 
bool m_canRead
 
bool m_canWrite
 
bool m_canSeek
 

Ausführliche Beschreibung

Beschreibung der Konstruktoren und Destruktoren

◆ filestream() [1/4]

std::filestream::filestream ( )
inline
51 {}

◆ filestream() [2/4]

std::filestream::filestream ( std::string  file,
filemode_t  mode,
bool  binary 
)
66  : stream()
67  {
68  m_mode = mode;
69  m_strFile = file;
70  m_binary = a;
71  m_canSeek = true;
74 
75  m_fFile = auto_ptr<FILE>( (FILE*)(Sys::fOpen ( file.c_str() ,
76  filemodetostring(mode, a))) );
77 
78  }
const value_type * c_str() const
Definition: basic_string.hpp:199
bool m_canWrite
Definition: stream.hpp:80
bool m_canSeek
Definition: stream.hpp:81
static void * fOpen(const char *file, const char *fmt)
Definition: PLATFORM.cpp:68
virtual filemode_t mode()
Definition: filestream.hpp:79
bool m_binary
Definition: filestream.hpp:89
stream()
Definition: stream.hpp:51
auto_ptr< FILE > m_fFile
Definition: filestream.hpp:87
filemode_t m_mode
Definition: filestream.hpp:86
std::string m_strFile
Definition: filestream.hpp:88
const char * filemodetostring(filemode_t m, bool a)
Definition: filestream.cpp:32
bool m_canRead
Definition: stream.hpp:79

◆ filestream() [3/4]

std::filestream::filestream ( const filestream fs)
43  : stream(fs)
44  {
45  m_fFile.reset(fs.m_fFile.get());
46  m_mode = fs.m_mode;
47  m_strFile = fs.m_strFile;
48  m_binary = fs.m_binary;
49  }
void reset(pointer px=0)
Definition: auto_ptr.hpp:102
bool m_binary
Definition: filestream.hpp:89
stream()
Definition: stream.hpp:51
auto_ptr< FILE > m_fFile
Definition: filestream.hpp:87
filemode_t m_mode
Definition: filestream.hpp:86
std::string m_strFile
Definition: filestream.hpp:88

◆ ~filestream()

std::filestream::~filestream ( )
virtual
80  {
81  close();
82  }
virtual bool close()
Definition: filestream.cpp:83

◆ filestream() [4/4]

std::filestream::filestream ( FILE *  f,
filemode_t  mode,
bool  b 
)
protected
58  {
59  m_fFile.reset(f);
60  m_mode = mode;
61  m_strFile = "IoFile";
62  m_binary = b;
63  }
void reset(pointer px=0)
Definition: auto_ptr.hpp:102
virtual filemode_t mode()
Definition: filestream.hpp:79
bool m_binary
Definition: filestream.hpp:89
auto_ptr< FILE > m_fFile
Definition: filestream.hpp:87
filemode_t m_mode
Definition: filestream.hpp:86
std::string m_strFile
Definition: filestream.hpp:88

Dokumentation der Elementfunktionen

◆ canRead()

virtual bool std::stream::canRead ( )
inlinevirtualinherited
61 { return m_canRead; }
bool m_canRead
Definition: stream.hpp:79

◆ canread()

bool std::filestream::canread ( std::string  file)
static
137  {
138  void* f = Sys::fOpen(file.c_str(), "r");
139  if(f != 0)
140  {
141  Sys::fClose(f);
142  return true;
143  }
144  return false;
145  }
const value_type * c_str() const
Definition: basic_string.hpp:199
static void * fOpen(const char *file, const char *fmt)
Definition: PLATFORM.cpp:68
static void fClose(void *file)
Definition: PLATFORM.cpp:71

◆ canSeek()

virtual bool std::stream::canSeek ( )
inlinevirtualinherited
62 { return m_canSeek; }
bool m_canSeek
Definition: stream.hpp:81

◆ canWrite()

virtual bool std::stream::canWrite ( )
inlinevirtualinherited
63 { return m_canWrite; }
bool m_canWrite
Definition: stream.hpp:80

◆ canwrite()

bool std::filestream::canwrite ( std::string  file)
static
146  {
147  void* f = Sys::fOpen(file.c_str(), "w");
148  if(f != 0)
149  {
150  Sys::fClose(f);
151  return true;
152  }
153  return false;
154  }
const value_type * c_str() const
Definition: basic_string.hpp:199
static void * fOpen(const char *file, const char *fmt)
Definition: PLATFORM.cpp:68
static void fClose(void *file)
Definition: PLATFORM.cpp:71

◆ clear()

void std::filestream::clear ( )
virtual

Erneute Implementation von std::stream.

117  {
118  if(m_fFile.get() !=0) {
119  Sys::fSeek(m_fFile.get(), 0, SEEK_END);
120  }
121  }
value_type * get() const
Definition: auto_ptr.hpp:134
auto_ptr< FILE > m_fFile
Definition: filestream.hpp:87
static int fSeek(void *file, int off, int org)
Definition: PLATFORM.cpp:89

◆ close()

bool std::filestream::close ( )
virtual
83  {
84  if(m_fFile.get() !=0) {
86  return true;
87  }
88  return false;
89  }
value_type * get() const
Definition: auto_ptr.hpp:134
auto_ptr< FILE > m_fFile
Definition: filestream.hpp:87
static void fClose(void *file)
Definition: PLATFORM.cpp:71

◆ filename()

virtual std::string std::filestream::filename ( )
inlinevirtual
77 { return m_strFile; }
std::string m_strFile
Definition: filestream.hpp:88

◆ flush()

void std::filestream::flush ( )
virtual

Erneute Implementation von std::stream.

163  {
165  }
value_type * get() const
Definition: auto_ptr.hpp:134
static int fFlush(void *file)
Definition: PLATFORM.cpp:98
auto_ptr< FILE > m_fFile
Definition: filestream.hpp:87

◆ isbinary()

virtual bool std::filestream::isbinary ( )
inlinevirtual
78 { return m_binary; }
bool m_binary
Definition: filestream.hpp:89

◆ iseof()

bool std::filestream::iseof ( )
virtual

Erneute Implementation von std::stream.

171  {
172  return Sys::fEOF(m_fFile.get());
173  }
static int fEOF(void *file)
Definition: PLATFORM.cpp:101
value_type * get() const
Definition: auto_ptr.hpp:134
auto_ptr< FILE > m_fFile
Definition: filestream.hpp:87

◆ isfile()

bool std::filestream::isfile ( std::string  file)
static
133  {
134  return Sys::fIsFile(file.c_str());
135 
136  }
const value_type * c_str() const
Definition: basic_string.hpp:199
static bool fIsFile(const char *file)
Definition: PLATFORM.cpp:107

◆ mode()

virtual filemode_t std::filestream::mode ( )
inlinevirtual
79 { return m_mode;}
filemode_t m_mode
Definition: filestream.hpp:86

◆ operator bool()

std::filestream::operator bool ( )
inline
81 { return m_fFile.get() == 0; }
value_type * get() const
Definition: auto_ptr.hpp:134
auto_ptr< FILE > m_fFile
Definition: filestream.hpp:87

◆ operator=()

filestream & std::filestream::operator= ( const filestream fs)
51  {
52  m_fFile.reset(fs.m_fFile.get());
53  m_mode = fs.m_mode;
54  m_strFile = fs.m_strFile;
55  m_binary = fs.m_binary;
56  }
void reset(pointer px=0)
Definition: auto_ptr.hpp:102
bool m_binary
Definition: filestream.hpp:89
auto_ptr< FILE > m_fFile
Definition: filestream.hpp:87
filemode_t m_mode
Definition: filestream.hpp:86
std::string m_strFile
Definition: filestream.hpp:88

◆ position()

long std::filestream::position ( )
virtual

Erneute Implementation von std::stream.

167  {
168  return Sys::fTell(m_fFile.get());
169  }
value_type * get() const
Definition: auto_ptr.hpp:134
auto_ptr< FILE > m_fFile
Definition: filestream.hpp:87
static int fTell(void *file)
Definition: PLATFORM.cpp:74

◆ read() [1/2]

size_t std::filestream::read ( void *  data,
size_t  offset,
size_t  size 
)
virtual

Erneute Implementation von std::stream.

99  {
100  size_t s = EOF;
101  if(m_fFile.get() != 0 ) {
102  if(offset != 0) seek(offset, SeekOrigin::Current);
103  s = Sys::fRead (data, 1, size, m_fFile.get());
104  }
105  return s;
106  }
static int fRead(void *data, const int count, const int size, void *file)
Definition: PLATFORM.cpp:92
value_type * get() const
Definition: auto_ptr.hpp:134
virtual size_t seek(size_t off, seek_t org)
Definition: filestream.cpp:90
virtual long size()
Definition: filestream.cpp:155
auto_ptr< FILE > m_fFile
Definition: filestream.hpp:87

◆ read() [2/2]

char std::filestream::read ( )
virtual

Erneute Implementation von std::stream.

127  {
128  if(m_fFile.get() == 0)
129  return EOF;
130  return Sys::fGetc(m_fFile.get());
131  }
value_type * get() const
Definition: auto_ptr.hpp:134
auto_ptr< FILE > m_fFile
Definition: filestream.hpp:87
static int fGetc(void *file)
Definition: PLATFORM.cpp:83

◆ reopen()

filestream & std::filestream::reopen ( filemode_t  mode,
bool  binary 
)
virtual
175  {
176  if(mode != m_mode || m_binary != binary)
177  {
178  m_mode = mode;
179  m_binary = binary;
180  //m_fFile.reset( freopen(m_strFile,filemodetostring(mode, binary), m_fFile.get()) );
181  }
182  return *this;
183  }
virtual filemode_t mode()
Definition: filestream.hpp:79
bool m_binary
Definition: filestream.hpp:89
filemode_t m_mode
Definition: filestream.hpp:86

◆ seek()

size_t std::filestream::seek ( size_t  off,
seek_t  org 
)
virtual

Erneute Implementation von std::stream.

90  {
91  size_t s = EOF;
92  if(m_fFile.get() != 0 && m_canSeek) {
93  Sys::fSeek(m_fFile.get(), off,
94  (int)org);
95  s = Sys::fTell(m_fFile.get());
96  }
97  return s;
98  }
value_type * get() const
Definition: auto_ptr.hpp:134
bool m_canSeek
Definition: stream.hpp:81
auto_ptr< FILE > m_fFile
Definition: filestream.hpp:87
static int fSeek(void *file, int off, int org)
Definition: PLATFORM.cpp:89
static int fTell(void *file)
Definition: PLATFORM.cpp:74

◆ size()

long std::filestream::size ( )
virtual

Erneute Implementation von std::stream.

156  {
157  long pos = position();
158  long size = seek(0, SeekOrigin::End);
159  seek(pos, SeekOrigin::Beginn);
160  return size;
161  }
virtual long position()
Definition: filestream.cpp:166
virtual size_t seek(size_t off, seek_t org)
Definition: filestream.cpp:90
virtual long size()
Definition: filestream.cpp:155

◆ write() [1/2]

size_t std::filestream::write ( const void *  data,
size_t  offset,
size_t  size 
)
virtual

Erneute Implementation von std::stream.

107  {
108  //fwrite (buffer , sizeof(char), sizeof(buffer), pFile);
109  size_t s = EOF;
110  if(m_fFile.get() != 0 && m_canWrite) {
111  if(offset != 0) seek(offset, SeekOrigin::Current);
112  s = Sys::fWrite (data, 1, size, m_fFile.get());
113  }
114  return s;
115  }
value_type * get() const
Definition: auto_ptr.hpp:134
virtual size_t seek(size_t off, seek_t org)
Definition: filestream.cpp:90
virtual long size()
Definition: filestream.cpp:155
bool m_canWrite
Definition: stream.hpp:80
auto_ptr< FILE > m_fFile
Definition: filestream.hpp:87
static int fWrite(void *data, const int count, const int size, void *file)
Definition: PLATFORM.cpp:95

◆ write() [2/2]

void std::filestream::write ( char  c)
virtual

Erneute Implementation von std::stream.

122  {
123  if(m_fFile.get() !=0) {
124  Sys::fPutc (c, m_fFile.get());
125  }
126  }
value_type * get() const
Definition: auto_ptr.hpp:134
static int fPutc(int c, void *file)
Definition: PLATFORM.cpp:77
auto_ptr< FILE > m_fFile
Definition: filestream.hpp:87

Dokumentation der Datenelemente

◆ m_binary

bool std::filestream::m_binary
protected

◆ m_canRead

bool std::stream::m_canRead
protectedinherited

◆ m_canSeek

bool std::stream::m_canSeek
protectedinherited

◆ m_canWrite

bool std::stream::m_canWrite
protectedinherited

◆ m_fFile

auto_ptr<FILE> std::filestream::m_fFile
protected

◆ m_mode

filemode_t std::filestream::m_mode
protected

◆ m_strFile

std::string std::filestream::m_strFile
protected

Die Dokumentation für diese Klasse wurde erzeugt aufgrund der Dateien: