Cloudy
Spectral Synthesis Code for Astrophysics
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
input.h
Go to the documentation of this file.
1 /* This file is part of Cloudy and is copyright (C)1978-2023 by Gary J. Ferland and
2  * others. For conditions of distribution and use see copyright notice in license.txt */
3 
4 #ifndef INPUT_H_
5 #define INPUT_H_
6 
7 /* input.h */
8 
9 #include "module.h"
10 
13 bool lgIsCommentSeq( const string& s, size_t p, bool lgReportVisible );
14 
16 bool lgIsExpungedCommentSeq( const string& s );
17 
23 bool lgInputComment( const string& chLine );
24 
26 bool lgInputEOF( const string& chLine );
27 
31 void StripComment( string& s, bool lgStripVisible );
32 
39 size_t GetString( const string& s, size_t p, string& buf );
40 
43 char GetEscape( const string& s, size_t& p );
44 
47 string MakeInputLine(long i);
48 
50 void input_readvector(const string& chFile,
51  vector<double> &vec);
53 struct CardInfo {
55  string chCardSav;
61  int InclLevel;
64  bool lgVisible;
65  CardInfo() : InclLevel(-1), lgVisible(true) {}
66 };
67 
68 struct t_input : public module {
69 
70  const char *chName() const
71  {
72  return "input";
73  }
74 
75  void comment(t_warnings&) {}
76  void zero() {}
77 
79  vector<CardInfo*> crd;
80 
82  string chTitle;
83 
86 
89 
91  long int nRead;
92 
95 
99 
103 
106 
107  void clear()
108  {
109  for( size_t i=0; i < crd.size(); ++i )
110  delete crd[i];
111  crd.clear();
112  curInclLevel = 0;
113  lgInitPresent = false;
114  lgUnderscoreFound = false;
115  lgBracketFound = false;
116  }
117 
119  {
120  /* will be set true if no buffering command entered */
121  lgSetNoBuffering = false;
122  }
123 
125  {
126  clear();
127  }
128 
129 private:
130  // friend CodeSmell
131  friend class Parser;
132 
137  string readarray(bool *lgEOF);
142  string peekarray(bool *lgEOF);
143 
144 public:
145  void echo(FILE *ipOUT) const;
146 
149  void init()
150  {
151  nRead = -1;
152  }
153 };
154 extern t_input input;
155 
156 #endif /* INPUT_H_ */
Definition: warnings.h:11
void comment(t_warnings &)
Definition: input.h:75
void init()
Definition: input.h:149
void echo(FILE *ipOUT) const
Definition: input.cpp:209
void input_readvector(const string &chFile, vector< double > &vec)
Definition: input.cpp:261
bool lgInitPresent
Definition: input.h:94
string MakeInputLine(long i)
Definition: input.cpp:146
int curInclLevel
Definition: input.h:85
long int nRead
Definition: input.h:91
void zero()
Definition: input.h:76
Definition: parser.h:41
bool lgIsExpungedCommentSeq(const string &s)
Definition: input.cpp:30
string chCardSav
Definition: input.h:55
string peekarray(bool *lgEOF)
Definition: input.cpp:244
void clear()
Definition: input.h:107
int InclLevel
Definition: input.h:61
t_input input
Definition: input.cpp:13
CardInfo()
Definition: input.h:65
char GetEscape(const string &s, size_t &p)
Definition: input.cpp:132
string readarray(bool *lgEOF)
Definition: input.cpp:218
bool lgIsCommentSeq(const string &s, size_t p, bool lgReportVisible)
Definition: input.cpp:17
void StripComment(string &s, bool lgStripVisible)
Definition: input.cpp:68
bool lgInputComment(const string &chLine)
Definition: input.cpp:44
size_t GetString(const string &s, size_t p, string &buf)
Definition: input.cpp:111
bool lgVisible
Definition: input.h:64
~t_input()
Definition: input.h:124
bool lgUnderscoreFound
Definition: input.h:98
bool lgBracketFound
Definition: input.h:102
bool lgVisibilityStatus
Definition: input.h:88
t_input()
Definition: input.h:118
vector< CardInfo * > crd
Definition: input.h:79
bool lgSetNoBuffering
Definition: input.h:105
Definition: input.h:53
const char * chName() const
Definition: input.h:70
Definition: module.h:26
bool lgInputEOF(const string &chLine)
Definition: input.cpp:52
string chTitle
Definition: input.h:82
Definition: input.h:68