Main Page   Class Hierarchy   Alphabetical List   Compound List   Examples  
stdfile.h
1/***************************************************************************
2 copyright : (C) 2002-2008 by Stefano Barbato
3 email : stefano@codesink.org
4
5 $Id: stdfile.h,v 1.9 2008-10-07 11:06:26 tat Exp $
6 ***************************************************************************/
7#ifndef _MIMETIC_OS_STDFILE_H
8#define _MIMETIC_OS_STDFILE_H
9#include <sys/types.h>
10#include <sys/stat.h>
11#include <fcntl.h>
12#include <cstdio>
13#include <string>
14#include <iterator>
15#include <mimetic/os/fileop.h>
16#include <mimetic/os/file_iterator.h>
17
18namespace mimetic
19{
20
21// File class
22struct StdFile: public FileOp
23{
24 typedef ifile_iterator iterator;
25 StdFile();
26 StdFile(const std::string&, int mode = O_RDONLY);
27 ~StdFile();
28 operator bool() const;
29 void open(const std::string&, int mode = O_RDONLY);
30 void close();
31 uint read(char*, int);
32
33 iterator begin();
34 iterator end();
35protected:
36 void open(int flags);
37 bool stat();
38
39 std::string m_fqn;
40 bool m_stated;
41 struct stat m_st;
42 int m_fd;
43};
44
45}
46
47
48#endif
49
Definition body.h:18