Jpp  master_rocky-43-ge265d140c
the software that should make you happy
Public Member Functions | List of all members
JPARSER::JParserTemplateElement< JType_t, has_eq > Class Template Reference

Template class holder for I/O of parser element. More...

Public Member Functions

std::istream & read (std::istream &in)
 Template specialisation of JParserTemplateElement<std::string>::read to read complete line from stream input. More...
 
std::ostream & write (std::ostream &out) const
 Template specialisation of JParserTemplateElement<std::string>::write to surround text with quotes. More...
 
std::istream & read (std::istream &in)
 Template specialisation of JParserTemplateElement<TString>::read to read complete line from stream input. More...
 
std::istream & read (std::istream &in)
 Template specialisation of JParserTemplateElement< std::vector<TString> >read to read tokens from stream input. More...
 

Detailed Description

template<class JType_t, bool has_eq = JComparisonAvailable<JType_t>::has_eq>
class JPARSER::JParserTemplateElement< JType_t, has_eq >

Template class holder for I/O of parser element.

This class implements the JPARSER::JParserElementInterface interface.

Definition at line 663 of file JParser.hh.

Member Function Documentation

◆ read() [1/3]

std::istream & JPARSER::JParserTemplateElement< std::string, false >::read ( std::istream &  in)
inline

Template specialisation of JParserTemplateElement<std::string>::read to read complete line from stream input.

Parameters
ininput stream
Returns
input stream

Definition at line 902 of file JParser.hh.

903  {
904  std::getline(in, object);
905 
906  if (fail(in)) {
907  THROW(JParserException, "JParser: error reading parameter " << getName());
908  }
909 
910  if (in.peek() != EOF) {
911  THROW(JParserException, "JParser: pending data after reading parameter " << getName());
912  }
913 
914  setInitialiationStatus(true);
915 
916  return in;
917  }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:712
Exception when parsing a value.
Definition: JException.hh:558
std::istream & getline(std::istream &in, JString &object)
Read string from input stream until end of line.
Definition: JString.hh:478
bool fail(std::istream &in)
Check for stream state.
Definition: JParser.hh:98
const char * getName()
Get ROOT name of given data type.
Definition: JRootToolkit.hh:62

◆ write()

std::ostream & JPARSER::JParserTemplateElement< std::string, false >::write ( std::ostream &  out) const
inline

Template specialisation of JParserTemplateElement<std::string>::write to surround text with quotes.

Parameters
outoutput stream
Returns
output stream

Definition at line 927 of file JParser.hh.

928  {
929  return writeObject(out, JLANG::double_quote(object));
930  }
std::ostream & writeObject(std::ostream &out, const T &object)
Stream output of object.
std::string double_quote(const std::string &value)
Quote string.

◆ read() [2/3]

std::istream & JPARSER::JParserTemplateElement< TString, false >::read ( std::istream &  in)
inline

Template specialisation of JParserTemplateElement<TString>::read to read complete line from stream input.

Parameters
ininput stream
Returns
input stream

Definition at line 1020 of file JParser.hh.

1021  {
1022  TStringHelper<>::read(in, object);
1023 
1024  setInitialiationStatus(true);
1025 
1026  return in;
1027  }
std::istream & read(std::istream &in, JTestSummary &summary, const char delimiter=' ')
Read test summary.

◆ read() [3/3]

std::istream & JPARSER::JParserTemplateElement< std::vector< TString >, false >::read ( std::istream &  in)
inline

Template specialisation of JParserTemplateElement< std::vector<TString> >read to read tokens from stream input.

Parameters
ininput stream
Returns
input stream

Definition at line 1037 of file JParser.hh.

1038  {
1039  TStringHelper<>::read(in, object);
1040 
1041  setInitialiationStatus(true);
1042 
1043  return in;
1044  }

The documentation for this class was generated from the following file: