OpendTect  6.3
od_istream.h
Go to the documentation of this file.
1 #pragma once
2 
3 /*+
4 ________________________________________________________________________
5 
6  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
7  Author: Bert
8  Date: Sep 2013
9 ________________________________________________________________________
10 
11 -*/
12 
13 #include "basicmod.h"
14 #include "od_stream.h"
15 class SeparString;
16 class CompoundKey;
17 class FixedString;
18 class DBKey;
19 
20 
24 {
25 public:
26 
28  od_istream( const char* fnm )
29  : od_stream(fnm,false) {}
30  od_istream( const File::Path& fp )
31  : od_stream(fp,false) {}
32  od_istream( std::istream* s )
33  : od_stream(s) {}
34  od_istream( std::istream& s )
35  : od_stream(s) {}
36 
37  od_istream(const od_istream&) = delete;
39  od_istream& operator=(const od_istream&) = delete;
41 
42  bool open(const char*);
43  bool reOpen();
44 
45  od_istream& get(char&);
46  /*<!Use this function to get regular text inputs.
47  If you want to analyze an alien stream char-by-char,
48  use peek()-ignore(1) call pairs.*/
49 
50  od_istream& get(unsigned char&);
51  od_istream& get(od_int16&);
52  od_istream& get(od_uint16&);
53  od_istream& get(od_int32&);
54  od_istream& get(od_uint32&);
55  od_istream& get(od_int64&);
56  od_istream& get(od_uint64&);
57 #ifdef __lux64__
58  od_istream& get(long long&);
59  od_istream& get(unsigned long long&);
60 #else
61  od_istream& get(long&);
62  od_istream& get(unsigned long&);
63 #endif
64  od_istream& get(float&);
65  od_istream& get(double&);
66 
67  od_istream& get( BufferString& bs, bool allowgotonextline=true )
68  { getWord(bs,allowgotonextline); return *this; }
69 
70  od_istream& get(IOPar&);
71  od_istream& get(SeparString&);
72  od_istream& get(CompoundKey&);
73  od_istream& get(DBKey&);
74 
75  od_istream& getC(char*,int maxnrchar);
76  od_istream& get(char*);
77  od_istream& get(FixedString&);
78  od_istream& get(void*);
79 
80  bool getWord(BufferString&,bool allowgotonextline=true);
81  bool getLine(BufferString&,bool* newline_found=0);
82  bool getAll(BufferString&);
83 
84  bool getBin(void*,Count nrbytes);
85  template <class T>
86  od_istream& getBin(T&);
87 
88  char peek() const;
89  void ignore(Count);
90  bool skipUntil(char);
91  bool skipWord();
92  bool skipLine();
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 }
#define mExpClass(module)
Definition: commondefs.h:157
od_istream & operator>>(od_istream &s, T &t)
Definition: od_istream.h:106
od_istream(std::istream &s)
Definition: od_istream.h:34
OD::String that holds an existing text string.
Definition: fixedstring.h:27
#define od_int64
Definition: plftypes.h:34
int64_t lastNrBytesRead(std::istream &)
List encoded in a string.
Definition: separstr.h:32
File pathname tools.
Definition: filepath.h:35
OD base class for stream read/write.
Definition: od_stream.h:52
od_istream & get(char &)
OD class for stream read.
Definition: od_istream.h:23
od_istream()
Definition: od_istream.h:27
Generalized set of parameters of the keyword-value type.
Definition: iopar.h:53
#define od_uint32
Definition: plftypes.h:30
bool getBin(void *, Count nrbytes)
od_stream_Count Count
Definition: od_stream.h:53
od_istream(std::istream *s)
Definition: od_istream.h:32
#define od_int16
Definition: plftypes.h:25
#define od_uint64
Definition: plftypes.h:35
od_istream(const char *fnm)
Definition: od_istream.h:28
#define od_int32
Definition: plftypes.h:29
OD::String with its own variable length buffer. The buffer has a guaranteed minimum size...
Definition: bufstring.h:38
od_istream(const File::Path &fp)
Definition: od_istream.h:30
Concatenated short keys separated by dots. Used for Object identifiers in the Object Manager...
Definition: compoundkey.h:21
Full key to any object in the OpendTect data store.
Definition: dbkey.h:36
#define od_uint16
Definition: plftypes.h:26
DBKey & operator=(const DBKey &)

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