Jpp 21.0.0-rc.1
the software that should make you happy
Loading...
Searching...
No Matches
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.
 
std::ostream & write (std::ostream &out) const
 Template specialisation of JParserTemplateElement<std::string>::write to surround text with quotes.
 
std::istream & read (std::istream &in)
 Template specialisation of JParserTemplateElement<TString>::read to read complete line from stream input.
 
std::istream & read (std::istream &in)
 Template specialisation of JParserTemplateElement< std::vector<TString> >read to read tokens from stream input.
 

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 662 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 901 of file JParser.hh.

902 {
903 std::getline(in, object);
904
905 if (fail(in)) {
906 THROW(JParserException, "JParser: error reading parameter " << getName());
907 }
908
909 if (in.peek() != EOF) {
910 THROW(JParserException, "JParser: pending data after reading parameter " << getName());
911 }
912
913 setInitialiationStatus(true);
914
915 return in;
916 }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
bool fail(std::istream &in)
Check for stream state.
Definition JParser.hh:97
const char * getName()
Get ROOT name of given data type.

◆ 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 926 of file JParser.hh.

927 {
928 return writeObject(out, JLANG::double_quote(object));
929 }
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 1019 of file JParser.hh.

1020 {
1021 TStringHelper<>::read(in, object);
1022
1023 setInitialiationStatus(true);
1024
1025 return in;
1026 }

◆ 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 1036 of file JParser.hh.

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

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