OpendTect-6_4  6.4
od_istream.h
Go to the documentation of this file.
1 #ifndef od_istream_h
2 #define od_istream_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 "od_stream.h"
17 class SeparString;
18 class CompoundKey;
19 class FixedString;
20 
21 
25 {
26 public:
27 
29  od_istream( const char* fnm )
30  : od_stream(fnm,false) {}
31  od_istream( const FilePath& fp )
32  : od_stream(fp,false) {}
33  od_istream( std::istream* s )
34  : od_stream(s) {}
35  od_istream( std::istream& s )
36  : od_stream(s) {}
37  od_istream( const od_istream& s )
38  : od_stream(s) {}
40  { od_stream::operator =(s); return *this; }
41  bool open(const char*);
42  bool reOpen();
43 
44  od_istream& get(char&);
45  /*<!Use this function to get regular text inputs.
46  If you want to analyze an alien stream char-by-char,
47  use peek()-ignore(1) call pairs.*/
48 
49  od_istream& get(unsigned char&);
50  od_istream& get(od_int16&);
51  od_istream& get(od_uint16&);
52  od_istream& get(od_int32&);
53  od_istream& get(od_uint32&);
54  od_istream& get(od_int64&);
55  od_istream& get(od_uint64&);
56 #ifdef __lux64__
57  od_istream& get(long long&);
58  od_istream& get(unsigned long long&);
59 #else
60  od_istream& get(long&);
61  od_istream& get(unsigned long&);
62 #endif
63  od_istream& get(float&);
64  od_istream& get(double&);
65 
66  od_istream& get( BufferString& bs, bool allowgotonextline=true )
67  { getWord(bs,allowgotonextline); return *this; }
68 
69  od_istream& get(IOPar&);
70  od_istream& get(SeparString&);
71  od_istream& get(CompoundKey&);
72 
73  od_istream& getC(char*,int maxnrchar);
74  od_istream& get(char*);
75  od_istream& get(FixedString&);
76  od_istream& get(void*);
77 
78  bool getWord(BufferString&,bool allowgotonextline=true);
79  bool getLine(BufferString&,bool* newline_found=0);
80  bool getAll(BufferString&);
81 
82  bool getBin(void*,Count nrbytes);
83  template <class T>
84  od_istream& getBin(T&);
85 
86  char peek() const;
87  void ignore(Count);
88  bool skipUntil(char);
89  bool skipWord();
90  bool skipLine();
91  inline void setReadPosition( Pos p, Ref r=Abs )
92  { setPosition( p, r ); }
93 
94  Count lastNrBytesRead() const;
95  std::istream& stdStream();
96  bool atEOF() const;
99 
100  static od_istream& nullStream();
101 
102 };
103 
104 
105 
106 template <class T> inline od_istream& operator >>( od_istream& s, T& t )
107 { return s.get( t ); }
108 
109 template <class T>
111 {
112  getBin( &t, sizeof(T) );
113  return *this;
114 }
115 
116 
117 #endif
#define mExpClass(module)
Definition: commondefs.h:160
od_istream & operator>>(od_istream &s, T &t)
Definition: od_istream.h:106
od_istream(std::istream &s)
Definition: od_istream.h:35
OD::String that holds an existing text string.
Definition: fixedstring.h:29
#define od_int64
Definition: plftypes.h:36
int64_t lastNrBytesRead(std::istream &)
List encoded in a string.
Definition: separstr.h:33
OD base class for stream read/write.
Definition: od_stream.h:53
void setReadPosition(Pos p, Ref r=Abs)
Definition: od_istream.h:91
unsigned int Abs(unsigned int i)
Definition: math2.h:80
od_istream & get(char &)
OD class for stream read.
Definition: od_istream.h:24
od_istream()
Definition: od_istream.h:28
Generalized set of parameters of the keyword-value type.
Definition: iopar.h:47
od_istream(const od_istream &s)
Definition: od_istream.h:37
#define od_uint32
Definition: plftypes.h:32
bool getBin(void *, Count nrbytes)
od_stream_Count Count
Definition: od_stream.h:54
Position.
Definition: commontypes.h:42
od_istream(std::istream *s)
Definition: od_istream.h:33
#define od_int16
Definition: plftypes.h:27
#define od_uint64
Definition: plftypes.h:37
od_istream(const char *fnm)
Definition: od_istream.h:29
File pathname tools.
Definition: filepath.h:34
#define od_int32
Definition: plftypes.h:31
OD::String with its own variable length buffer. The buffer has a guaranteed minimum size...
Definition: bufstring.h:40
Concatenated short keys separated by dots. Used for Object identifiers in the Object Manager...
Definition: compoundkey.h:23
#define od_uint16
Definition: plftypes.h:28
od_istream(const FilePath &fp)
Definition: od_istream.h:31
od_stream & operator=(const od_stream &)
FixedString & operator=(const FixedString &fs)
Definition: fixedstring.h:35
Ref
Definition: od_stream.h:70

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