DATRW++ library: seismic data I/O with multiple formats

◆ Line()

datrw::tsoft::Line::Line ( const std::string &  line)

constructor: swallow line

read one line from data file

check existence of tag

Definition at line 68 of file tsoftdata.cc.

References Mcontent, Mhascontent, Mhastag, Mline, Mtag, datrw::tsoft::tagbegin, datrw::tsoft::tagend, and datrw::tsoft::trimws().

68  :
69  Mline(line), Mhastag(false), Mhascontent(false)
70  {
71  //! check existence of tag
72  if (Mline.substr(0,1) == tagbegin)
73  {
74  Mhastag=true;
75  // length without trailing \0
76  const string::size_type len=line.length();
77  // find end of tag
78  string::size_type i=1;
79  string::size_type j=line.find_first_of(tagend, i);
80  Mtag=line.substr(i,j-i);
81  j++;
82  if (j<len)
83  {
84  i=j;
85  j=line.find_first_not_of (" ", i);
86  if (j <len)
87  {
88  Mhascontent=true;
89  Mcontent=line.substr(j,len-j+1);
91  }
92  }
93  }
94  } // Line::Line(const std::string& line)
std::string Mcontent
the content part of the line
Definition: tsoftdata.h:161
bool Mhascontent
true if this line has a content
Definition: tsoftdata.h:165
const char * tagbegin
first character of TSOFT tag
Definition: tsoftdata.cc:51
bool Mhastag
true if this line contains a tag
Definition: tsoftdata.h:163
std::string Mline
the actual line
Definition: tsoftdata.h:157
void trimws(std::string &line)
helper function trimws
Definition: tsoftdata.cc:375
std::string Mtag
the tag part of the line
Definition: tsoftdata.h:159
const char * tagend
last character of TSOFT tag
Definition: tsoftdata.cc:52
Here is the call graph for this function: