OpendTect-6_4  6.4
od_stream.h
Go to the documentation of this file.
1 #ifndef od_stream_h
2 #define od_stream_h
3 
4 /*+
5 ________________________________________________________________________
6 
7  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
8  Author: Bert
9  Date: Sep 2013
10  RCS: $Id$
11 ________________________________________________________________________
12 
13 -*/
14 
15 #include "basicmod.h"
16 #include "bufstring.h"
17 #include "uistring.h"
18 #include "od_iosfwd.h"
19 #include <iosfwd>
20 class FilePath;
21 class StreamData;
22 
23 
24 
55 public:
56 
57  typedef od_stream_Count Count;
58  typedef od_stream_Pos Pos;
59 
60  virtual ~od_stream();
61 
62  bool isOK() const;
63  bool isBad() const;
64 
65  uiString errMsg() const;
67  bool forRead() const;
68  bool forWrite() const;
69 
70  enum Ref { Abs, Rel, End };
71  Pos position() const;
72  void setPosition(Pos,Ref r=Abs);
73  Pos endPosition() const;
74 
75  const char* fileName() const;
76  void setFileName(const char*);
77 
78  inline StreamData& streamData() { return sd_; }
79  inline const StreamData& streamData() const { return sd_; }
80 
81  void setNoClose( bool yn=true ) { noclose_=yn; }
82  void releaseStream(StreamData&);
83  void close();
84 
85  void addErrMsgTo(BufferString&) const;
86  void addErrMsgTo(uiString&)const;
87  static od_stream* create(const char*,bool forread,
88  BufferString& errmsg);
90  static od_stream* create(const char*,bool forread,
91  uiString& errmsg);
93  static const char* sStdIO();
95  static const char* sStdErr();
97 
98 protected:
99 
100  od_stream();
101  od_stream(const char*,bool,bool editmode=false);
102  od_stream(const FilePath&,bool,bool editmode=false);
103  od_stream(std::ostream*);
104  od_stream(std::ostream&);
105  od_stream(std::istream*);
106  od_stream(std::istream&);
107  od_stream(const od_stream&);
108  od_stream& operator=(const od_stream&);
109 
111  bool mine_;
112  bool noclose_;
113  mutable uiString errmsg_;
114 
115 };
116 
117 
118 
119 #endif
#define mExpClass(module)
Definition: commondefs.h:160
#define mODTextTranslationClass(clss)
Definition: uistring.h:38
StreamData & sd_
Definition: od_stream.h:110
od_int64 od_stream_Pos
Definition: od_iosfwd.h:21
Definition: od_stream.h:70
Definition: uistring.h:89
void setNoClose(bool yn=true)
Definition: od_stream.h:81
OD base class for stream read/write.
Definition: od_stream.h:53
od_uint64 od_stream_Count
Definition: od_iosfwd.h:18
unsigned int Abs(unsigned int i)
Definition: math2.h:80
bool noclose_
Definition: od_stream.h:112
StreamData & streamData()
Definition: od_stream.h:78
Holds data to use and close an iostream.
Definition: strmdata.h:28
uiString errmsg_
Definition: od_stream.h:113
od_stream_Pos Pos
Definition: od_stream.h:58
File pathname tools.
Definition: filepath.h:34
void close()
OD::String with its own variable length buffer. The buffer has a guaranteed minimum size...
Definition: bufstring.h:40
static uiHor3DInterpol * create(uiParent *)
void setFileName(const char *fn)
Definition: strmdata.h:38
Definition: stattype.h:23
const char * errMsg() const
Definition: horizontracker.h:61
bool mine_
Definition: od_stream.h:111
Ref
Definition: od_stream.h:70
const StreamData & streamData() const
Definition: od_stream.h:79
const char * fileName() const
Definition: strmdata.h:39

Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B. V. 2019