Jpp test-rotations-old
the software that should make you happy
Loading...
Searching...
No Matches
JEEP::JProperties Class Reference

Utility class to parse parameter values. More...

#include <JProperties.hh>

Inheritance diagram for JEEP::JProperties:
std::map< std::string, JPropertiesElement > JLANG::JEquationParameters JEEP::JMessage< JProperties > JAANET::JEvtCategoryMap< JEvtWeightFactorProduct >::JEvtCategoryMapHelper JAANET::JEvtCategoryMap< JFluxHelper >::JEvtCategoryMapHelper JAANET::JEvtWeightFactorConstant< JEvtWeightFactor_t >::JEvtWeightFactorConstantHelper JAANET::JEvtWeightFactorFunction< Flux_Atmospheric, JDiffuseFlux >::JFluxFunctionHelper JAANET::JEvtWeightFactorMeffRatio::JEvtWeightFactorMeffRatioHelper JAANET::JEvtWeightFactorProduct::JEvtWeightFactorProductHelper JAANET::JEvtWeightFactorTFormula::JEvtWeightFactorTFormulaHelper JAANET::JHondaFluxInterpolator< JPhiFunction_t, JCoszFunctionalMap_t, JEnergyFunctionalMap_t >::JHondaFluxInterpolatorHelper JAANET::JHondaFluxInterpolator< JConstantFunction1D< double, JArray< 4, double > >, JCoszFunctionalMap_t, JEnergyFunctionalMap_t >::JHondaFluxInterpolatorHelper JAANET::JMuonBundleCategory::JMuonBundleCategoryHelper JAANET::JNeutrinoInteractionCategory::JNeutrinoInteractionCategoryHelper JAANET::JOscFlux::JOscFluxHelper JAANET::JPowerLawFlux::JPowerLawFluxHelper JCOMPAREHISTOGRAMS::JTestSummary::JTestSummaryHelper JDETECTOR::JDetectorHeader::JDetectorHeaderHelper JDETECTOR::JDetectorParametersHelper JDETECTOR::JPMTParameters::JPMTParametersHelper JOSCPROB::JOscChannel::JOscChannelHelper JOSCPROB::JOscParameters< T >::JOscParametersHelper JOSCPROB::JOscProbInterpolator< JCollection_t, JFunction1D_t, JFunctionalMaplist_t >::JOscProbInterpolatorHelper JROOT::JStyle::JParameters::JParametersHelper

Public Types

typedef std::map< std::string, JPropertiesElementJMap_t
 

Public Member Functions

 JProperties (const int debug=0)
 Constructor.
 
 JProperties (const JEquationParameters &parameters, const int debug=0)
 Constructor.
 
template<class T >
void put (const std::string &key, T &object)
 Put object at given key.
 
JPropertiesjoin (const JProperties &properties)
 Join properties objects.
 
bool read (const JEquation &equation)
 Read equation.
 
bool read (const std::string &buffer)
 Read from input string.
 
std::istream & read (std::istream &in)
 Read from input stream.
 
std::istream & read (std::istream &in, const std::string &format)
 Read from input stream according given format.
 
template<class T >
std::istream & read (std::istream &in, T __begin, T __end)
 Read from input stream according given format.
 
std::ostream & write (std::ostream &out) const
 Write the current parameter values.
 
std::ostream & write (std::ostream &out, const std::string &format)
 Write to output stream according given format.
 
template<class T >
std::ostream & write (std::ostream &out, T __begin, T __end)
 Write to output stream according given format.
 
std::string sed (const std::string &format, const std::string &prefix="", const std::string &postfix="")
 Stream editing of input format.
 
template<class T >
const T & getValue (const std::string &key) const
 Get value.
 
template<class T >
T & getValue (const std::string &key)
 Get value.
 
template<class T >
void setValue (const std::string &key, const T &value)
 Set value.
 
std::string getString (const std::string &key) const
 Get string value.
 
std::ostream & print (std::ostream &out) const
 Print the current parameter values.
 
const JEquationParametersgetEquationParameters () const
 Get equation parameters.
 
void setEquationParameters (const JEquationParameters &buffer)
 Set equation parameters.
 
const char getDefaultSeparator () const
 Get default separator character.
 
const std::string & getSeparator () const
 Get separator characters.
 
std::string & getSeparator ()
 Get separator characters.
 
void setSeparator (const std::string &sep)
 Set separator character(s).
 
const char getDefaultEndOfLine () const
 Get default end of line character.
 
const char getPreferredEndOfLine (const unsigned int index) const
 Get preferred end of line character.
 
const std::string & getEndOfLine () const
 Get end of line characters.
 
std::string & getEndOfLine ()
 Get end of line characters.
 
void setEndOfLine (const std::string &eol)
 Set end of line characters.
 
const char getDefaultDivision () const
 Get default division character.
 
const std::string & getDivision () const
 Get division characters.
 
std::string & getDivision ()
 Get division characters.
 
void setDivision (const std::string &div)
 Set division characters.
 
const char getDefaultSkipLine () const
 Get default skip line character.
 
const std::string & getSkipLine () const
 Get skip line characters.
 
std::string & getSkipLine ()
 Get skip line characters.
 
void setSkipLine (const std::string &skip)
 Set skip line characters.
 
void setBrackets (const char left, const char right)
 Set brackets.
 
char getLeftBracket () const
 Get left bracket.
 
char & getLeftBracket ()
 Get left bracket.
 
char getRightBracket () const
 Get right bracket.
 
char & getRightBracket ()
 Get right bracket.
 
const char getDefaultWhiteSpace () const
 Get default white space character.
 
const std::string & getWhiteSpace () const
 Get white space characters.
 
std::string & getWhiteSpace ()
 Get white space characters.
 
void setWhiteSpace (const std::string &ws)
 Set white space characters.
 
const std::string & getComment () const
 Get comment string.
 
std::string & getComment ()
 Get comment string.
 
void setComment (const std::string &comment)
 Set comment string.
 
JEquationParametersjoin (const JEquationParameters &value)
 Join equation parameters.
 
bool isSeparator (const char c) const
 Test for separator character.
 
bool isEndOfLine (const char c) const
 Test for end of line character.
 
bool isDivision (const char c) const
 Test for division character.
 
bool isSkipLine (const char c) const
 Test for skip line character.
 
bool isLeftBracket (const char c) const
 Test for left bracket character.
 
bool isRightBracket (const char c) const
 Test for right bracket character.
 
bool isWhiteSpace (const char c) const
 Test for white space character.
 

Static Public Member Functions

static std::string getKey (const std::string &buffer, const std::string &sep)
 Utility method to strip off all leading characters from a string until specified character(s).
 

Static Public Attributes

static int debug
 debug level (default is off).
 

Protected Attributes

std::string sep
 
std::string eol
 
std::string div
 
std::string skip
 
char left
 
char right
 
std::string ws
 
std::string comment
 

Friends

std::istream & operator>> (std::istream &in, JProperties &properties)
 Stream input.
 
std::ostream & operator<< (std::ostream &out, const JProperties &properties)
 Stream output.
 

Detailed Description

Utility class to parse parameter values.

The mapping between a parameter (of any type) and a value has to be defined in the user's program, e.g.

ifstream in(filename.c_str());
int integer_value;
double double_value;
string string_value;
zap.insert(make_property(integer_value)); // key == parameter name
zap.insert(make_property(double_value)); // key == parameter name
zap["mies"] = string_value;
zap.read(in);
zap.write(cout);
Utility class to parse parameter values.
Utility class to parse parameter values.
std::ostream & write(std::ostream &out) const
Write the current parameter values.
bool read(const JEquation &equation)
Read equation.

Definition at line 499 of file JProperties.hh.

Member Typedef Documentation

◆ JMap_t

Definition at line 506 of file JProperties.hh.

Constructor & Destructor Documentation

◆ JProperties() [1/2]

JEEP::JProperties::JProperties ( const int debug = 0)
inline

Constructor.

Parameters
debugdebug level

Definition at line 536 of file JProperties.hh.

536 :
537 JMap_t(),
539 {
540 this->debug = debug;
541 }
std::map< std::string, JPropertiesElement > JMap_t
JEquationParameters()
Default constructor.

◆ JProperties() [2/2]

JEEP::JProperties::JProperties ( const JEquationParameters & parameters,
const int debug = 0 )
inline

Constructor.

Parameters
parametersequation parameters
debugdebug level

Definition at line 550 of file JProperties.hh.

551 :
552 JMap_t(),
553 JEquationParameters(parameters)
554 {
555 this->debug = debug;
556 }

Member Function Documentation

◆ getKey()

static std::string JEEP::JProperties::getKey ( const std::string & buffer,
const std::string & sep )
inlinestatic

Utility method to strip off all leading characters from a string until specified character(s).

Parameters
bufferinput string
seplast character(s) to strip
Returns
modified string

Definition at line 518 of file JProperties.hh.

519 {
520 using namespace std;
521
522 const size_type pos = buffer.find_last_of(sep);
523
524 if (pos != string::npos)
525 return buffer.substr(pos + 1);
526 else
527 return buffer;
528 }

◆ put()

template<class T >
void JEEP::JProperties::put ( const std::string & key,
T & object )
inline

Put object at given key.

Parameters
keykey
objectobject

Definition at line 566 of file JProperties.hh.

567 {
568 this->insert(value_type(key, JPropertiesElement(object)));
569 }

◆ join() [1/2]

JProperties & JEEP::JProperties::join ( const JProperties & properties)
inline

Join properties objects.

Parameters
propertiesproperties
Returns
properties

Definition at line 578 of file JProperties.hh.

579 {
580 JEquationParameters::join(properties);
581
582 insert(properties.begin(), properties.end());
583
584 return *this;
585 }
JEquationParameters & join(const JEquationParameters &value)
Join equation parameters.

◆ read() [1/5]

bool JEEP::JProperties::read ( const JEquation & equation)
inline

Read equation.

Parameters
equationequation
Returns
status

Definition at line 594 of file JProperties.hh.

595 {
596 using namespace std;
597
598 iterator p = find(equation.getKey());
599
600 DEBUG("Processing key: " << equation.getKey() << ' ' << (p != end()) << endl);
601
602 if (p != end()) {
603
604 istringstream is(equation.getValue());
605
606 if (isDivision(equation.getSeparator())) {
607
608 if (p->second->is_properties()) {
609
610 p->second->read(is);
611
612 } else {
613
614 ERROR("JProperties::read(): no properties object after division <" << equation.getKey() << ">" << endl);
615 }
616
617 } else if (isSeparator(equation.getSeparator())) {
618
619 try {
620 p->second->read(is);
621 }
622 catch(const exception& error) {
623 ERROR("JProperties::read(): read error at key <" << equation.getKey() << "> " << error.what() << endl);
624 }
625
626 } else {
627
628 ERROR("JProperties::read(): illegal character following key <" << equation.getKey() << "> " << equation.getSeparator() << endl);
629 }
630
631 if (p->second.getEndMarker()) {
632 return false;
633 }
634
635 if (fail(is)) {
636
637 ERROR("JProperties::read(): error reading data for key <" << equation.getKey() << "> " << equation.getValue() << endl);
638 }
639
640 } else {
641
642 WARNING("JProperties::read(): unknown key <" << equation.getKey() << ">" << endl);
643 }
644
645 return true;
646 }
#define DEBUG(A)
Message macros.
Definition JMessage.hh:62
#define ERROR(A)
Definition JMessage.hh:66
#define WARNING(A)
Definition JMessage.hh:65
bool isSeparator(const char c) const
Test for separator character.
bool isDivision(const char c) const
Test for division character.
bool fail(std::istream &in)
Check for stream state.

◆ read() [2/5]

bool JEEP::JProperties::read ( const std::string & buffer)
inline

Read from input string.

Parameters
bufferinput string
Returns
read status

Definition at line 655 of file JProperties.hh.

656 {
657 std::istringstream in(buffer);
658
659 return !fail(read(in));
660 }

◆ read() [3/5]

std::istream & JEEP::JProperties::read ( std::istream & in)
inline

Read from input stream.

The input format is:

   [<key><sub>]<key><sep><value><eol>
   [<key><sub>]<key><sep><value><eol>

In this, white spaces are ignored. The reading of key and value pairs is controlled by the JLANG::JEquationFacet class.

Parameters
ininput stream
Returns
input stream

Definition at line 677 of file JProperties.hh.

678 {
679 using namespace std;
680 using namespace JPP;
681
682 JStringStream is(in);
683
684 if (getFileStatus(is.str().c_str())) {
685 is.load();
686 }
687
688 is.imbue(locale(is.getloc(), new JEquationFacet(*this)));
689
690 for (JEquation equation; is >> equation && read(equation); ) {}
691
692 return in;
693 }
Facet class to specify parsing of equations in currect locale (see class JLANG::JEquation).
General purpose equation class.
Definition JEquation.hh:47
Wrapper class around STL stringstream class to facilitate optional loading of data from file.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).

◆ read() [4/5]

std::istream & JEEP::JProperties::read ( std::istream & in,
const std::string & format )
inline

Read from input stream according given format.

For each key in the format specification, a corresponding value will be read from the input stream.

Parameters
ininput stream
formatformat
Returns
input stream

Definition at line 706 of file JProperties.hh.

707 {
708 using namespace std;
709
710 istringstream is(format);
711
712 vector<string> buffer;
713
714 for (string key; is >> key; ) {
715 buffer.push_back(key);
716 }
717
718 return read(in, buffer.begin(), buffer.end());
719 }

◆ read() [5/5]

template<class T >
std::istream & JEEP::JProperties::read ( std::istream & in,
T __begin,
T __end )
inline

Read from input stream according given format.

For each key in the format specification, a corresponding value will be read from the input stream.

Parameters
ininput stream
__beginbegin of format
__endend of format
Returns
input stream

Definition at line 734 of file JProperties.hh.

735 {
736 using namespace std;
737
738 for (T i = __begin; i != __end; ++i) {
739
740 iterator p = find(*i);
741
742 if (p != end()) {
743
744 p->second->read(in);
745
746 } else {
747
748 WARNING("JProperties::read(): unknown key <" << *i << ">" << endl);
749 }
750 }
751
752 return in;
753 }

◆ write() [1/3]

std::ostream & JEEP::JProperties::write ( std::ostream & out) const
inline

Write the current parameter values.

The output format is

[<key><sub>]<key><sep><value><eol> [<key><sub>]<key><sep><value><eol>

in this, white spaces are omitted.

Parameters
outoutput stream
Returns
output stream

Definition at line 769 of file JProperties.hh.

770 {
771 using namespace std;
772
773 for (const_iterator i = begin(); i != end(); ++i) {
774
775 char c = ' ';
776
777 if (i->second->is_properties()) {
778 c = getDefaultDivision ();
779 } else {
781 }
782
783 i->second->write(out, (i->first + c).c_str(), getDefaultEndOfLine());
784 }
785
786 out << flush;
787
788 return out;
789 }
const char getDefaultSeparator() const
Get default separator character.
const char getDefaultEndOfLine() const
Get default end of line character.
const char getDefaultDivision() const
Get default division character.

◆ write() [2/3]

std::ostream & JEEP::JProperties::write ( std::ostream & out,
const std::string & format )
inline

Write to output stream according given format.

For each key in the format specification, a corresponding value will be written to the output stream.

Parameters
outoutput stream
formatformat
Returns
output stream

Definition at line 802 of file JProperties.hh.

803 {
804 using namespace std;
805
806 istringstream is(format);
807
808 vector<string> buffer;
809
810 for (string key; is >> key; ) {
811 buffer.push_back(key);
812 }
813
814 return write(out, buffer.begin(), buffer.end());
815 }

◆ write() [3/3]

template<class T >
std::ostream & JEEP::JProperties::write ( std::ostream & out,
T __begin,
T __end )
inline

Write to output stream according given format.

For each key in the format specification, a corresponding value will be written to the output stream.

Parameters
outoutput stream
__beginbegin of format
__endend of format
Returns
output stream

Definition at line 830 of file JProperties.hh.

831 {
832 using namespace std;
833
834 for (T i = __begin; i != __end; ++i) {
835
836 iterator p = find(*i);
837
838 if (p != end()) {
839
840 out << getDefaultWhiteSpace();
841
842 p->second->write(out);
843
844 } else {
845
846 WARNING("JProperties::write(): unknown key <" << *i << ">" << endl);
847 }
848 }
849
850 return out;
851 }
const char getDefaultWhiteSpace() const
Get default white space character.

◆ sed()

std::string JEEP::JProperties::sed ( const std::string & format,
const std::string & prefix = "",
const std::string & postfix = "" )
inline

Stream editing of input format.

For each key in the format specification, a corresponding value will be written to the output stream.

Parameters
formatformat
prefixprefix key word
postfixpostfix key word
Returns
output stream

Definition at line 865 of file JProperties.hh.

868 {
869 using namespace std;
870
871 string buffer = format;
872
873 for (iterator i = begin(); i != end(); ++i) {
874
875 string::size_type ipos = 0;
876
877 while ((ipos = buffer.find(prefix + i->first + postfix, ipos)) != string::npos) {
878
879 ostringstream out;
880
881 i->second->write(out);
882
883 buffer.replace(ipos, prefix.length() + i->first.length() + postfix.length(), out.str());
884 }
885 }
886
887 return buffer;
888 }

◆ getValue() [1/2]

template<class T >
const T & JEEP::JProperties::getValue ( const std::string & key) const
inline

Get value.

Parameters
keykey
Returns
value of this JPropertiesElement

Definition at line 898 of file JProperties.hh.

899 {
900 const_iterator i = find(key);
901
902 if (i != end())
903 return i->second.getValue<T>();
904 else
905 THROW(JPropertiesException, "Key <" << key << "> not found at JPropertiesElement::getValue()");
906 }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.

◆ getValue() [2/2]

template<class T >
T & JEEP::JProperties::getValue ( const std::string & key)
inline

Get value.

Parameters
keykey
Returns
value of this JPropertiesElement

Definition at line 916 of file JProperties.hh.

917 {
918 iterator i = find(key);
919
920 if (i != end())
921 return i->second.getValue<T>();
922 else
923 THROW(JPropertiesException, "Key <" << key << "> not found at JPropertiesElement::getValue()");
924 }

◆ setValue()

template<class T >
void JEEP::JProperties::setValue ( const std::string & key,
const T & value )
inline

Set value.

Parameters
keykey
valuevalue

Definition at line 934 of file JProperties.hh.

935 {
936 iterator i = find(key);
937
938 if (i != end())
939 return i->second.setValue<T>(value);
940 else
941 THROW(JPropertiesException, "Key <" << key << "> not found at JPropertiesElement::setValue()");
942 }

◆ getString()

std::string JEEP::JProperties::getString ( const std::string & key) const
inline

Get string value.

Parameters
keykey
Returns
value

Definition at line 951 of file JProperties.hh.

952 {
953 const_iterator i = find(key);
954
955 if (i != end())
956 return i->second.toString();
957 else
958 THROW(JPropertiesException, "Key <" << key << "> not found at JPropertiesElement::getString()");
959 }

◆ print()

std::ostream & JEEP::JProperties::print ( std::ostream & out) const
inline

Print the current parameter values.

Parameters
outoutput stream
Returns
output stream

Definition at line 968 of file JProperties.hh.

969 {
970 write(out);
971
972 return out;
973 }

◆ getEquationParameters()

const JEquationParameters & JLANG::JEquationParameters::getEquationParameters ( ) const
inlineinherited

Get equation parameters.

Returns
equation parameters

Definition at line 75 of file JEquationParameters.hh.

76 {
77 return *this;
78 }

◆ setEquationParameters()

void JLANG::JEquationParameters::setEquationParameters ( const JEquationParameters & buffer)
inlineinherited

Set equation parameters.

Parameters
bufferequation parameters

Definition at line 86 of file JEquationParameters.hh.

87 {
88 static_cast<JEquationParameters&>(*this) = buffer;
89 }

◆ getDefaultSeparator()

const char JLANG::JEquationParameters::getDefaultSeparator ( ) const
inlineinherited

Get default separator character.

Returns
separator between parameter and its value

Definition at line 97 of file JEquationParameters.hh.

98 {
99 if (sep.empty())
100 return '=';
101 else
102 return sep[0];
103 }

◆ getSeparator() [1/2]

const std::string & JLANG::JEquationParameters::getSeparator ( ) const
inlineinherited

Get separator characters.

Returns
separator between parameter and its value

Definition at line 111 of file JEquationParameters.hh.

112 {
113 return sep;
114 }

◆ getSeparator() [2/2]

std::string & JLANG::JEquationParameters::getSeparator ( )
inlineinherited

Get separator characters.

Returns
separator between parameter and its value

Definition at line 122 of file JEquationParameters.hh.

123 {
124 return sep;
125 }

◆ setSeparator()

void JLANG::JEquationParameters::setSeparator ( const std::string & sep)
inlineinherited

Set separator character(s).

Parameters
sepseparator between parameter and its value

Definition at line 133 of file JEquationParameters.hh.

134 {
135 this->sep = sep;
136 }

◆ getDefaultEndOfLine()

const char JLANG::JEquationParameters::getDefaultEndOfLine ( ) const
inlineinherited

Get default end of line character.

Returns
end of line character

Definition at line 144 of file JEquationParameters.hh.

145 {
146 if (eol.empty())
147 return '\n';
148 else
149 return eol[0];
150 }

◆ getPreferredEndOfLine()

const char JLANG::JEquationParameters::getPreferredEndOfLine ( const unsigned int index) const
inlineinherited

Get preferred end of line character.

Parameters
indexindex
Returns
end of line character

Definition at line 159 of file JEquationParameters.hh.

160 {
161 if (eol.empty())
162 return '\n';
163 else if (index < eol.size())
164 return eol[index];
165 else
166 return eol[0];
167 }

◆ getEndOfLine() [1/2]

const std::string & JLANG::JEquationParameters::getEndOfLine ( ) const
inlineinherited

Get end of line characters.

Returns
end of line characters

Definition at line 175 of file JEquationParameters.hh.

176 {
177 return eol;
178 }

◆ getEndOfLine() [2/2]

std::string & JLANG::JEquationParameters::getEndOfLine ( )
inlineinherited

Get end of line characters.

Returns
end of line characters

Definition at line 186 of file JEquationParameters.hh.

187 {
188 return eol;
189 }

◆ setEndOfLine()

void JLANG::JEquationParameters::setEndOfLine ( const std::string & eol)
inlineinherited

Set end of line characters.

Parameters
eolend of line character

Definition at line 197 of file JEquationParameters.hh.

198 {
199 this->eol = eol;
200 }

◆ getDefaultDivision()

const char JLANG::JEquationParameters::getDefaultDivision ( ) const
inlineinherited

Get default division character.

Returns
division character

Definition at line 208 of file JEquationParameters.hh.

209 {
210 if (div.empty())
211 return '.';
212 else
213 return div[0];
214 }

◆ getDivision() [1/2]

const std::string & JLANG::JEquationParameters::getDivision ( ) const
inlineinherited

Get division characters.

Returns
division characters

Definition at line 222 of file JEquationParameters.hh.

223 {
224 return div;
225 }

◆ getDivision() [2/2]

std::string & JLANG::JEquationParameters::getDivision ( )
inlineinherited

Get division characters.

Returns
division characters

Definition at line 233 of file JEquationParameters.hh.

234 {
235 return div;
236 }

◆ setDivision()

void JLANG::JEquationParameters::setDivision ( const std::string & div)
inlineinherited

Set division characters.

Parameters
divdivision characters

Definition at line 244 of file JEquationParameters.hh.

245 {
246 this->div = div;
247 }

◆ getDefaultSkipLine()

const char JLANG::JEquationParameters::getDefaultSkipLine ( ) const
inlineinherited

Get default skip line character.

Returns
skip line character

Definition at line 255 of file JEquationParameters.hh.

256 {
257 if (skip.empty())
258 return '#';
259 else
260 return skip[0];
261 }

◆ getSkipLine() [1/2]

const std::string & JLANG::JEquationParameters::getSkipLine ( ) const
inlineinherited

Get skip line characters.

Returns
skip line characters

Definition at line 269 of file JEquationParameters.hh.

270 {
271 return skip;
272 }

◆ getSkipLine() [2/2]

std::string & JLANG::JEquationParameters::getSkipLine ( )
inlineinherited

Get skip line characters.

Returns
skip line characters

Definition at line 280 of file JEquationParameters.hh.

281 {
282 return skip;
283 }

◆ setSkipLine()

void JLANG::JEquationParameters::setSkipLine ( const std::string & skip)
inlineinherited

Set skip line characters.

Parameters
skipskip line characters

Definition at line 291 of file JEquationParameters.hh.

292 {
293 this->skip = skip;
294 }

◆ setBrackets()

void JLANG::JEquationParameters::setBrackets ( const char left,
const char right )
inlineinherited

Set brackets.

Parameters
leftleft bracket
rightright bracket

Definition at line 303 of file JEquationParameters.hh.

◆ getLeftBracket() [1/2]

char JLANG::JEquationParameters::getLeftBracket ( ) const
inlineinherited

Get left bracket.

Returns
left bracket

Definition at line 315 of file JEquationParameters.hh.

316 {
317 return left;
318 }

◆ getLeftBracket() [2/2]

char & JLANG::JEquationParameters::getLeftBracket ( )
inlineinherited

Get left bracket.

Returns
left bracket

Definition at line 326 of file JEquationParameters.hh.

327 {
328 return left;
329 }

◆ getRightBracket() [1/2]

char JLANG::JEquationParameters::getRightBracket ( ) const
inlineinherited

Get right bracket.

Returns
right bracket

Definition at line 337 of file JEquationParameters.hh.

338 {
339 return right;
340 }

◆ getRightBracket() [2/2]

char & JLANG::JEquationParameters::getRightBracket ( )
inlineinherited

Get right bracket.

Returns
right bracket

Definition at line 348 of file JEquationParameters.hh.

349 {
350 return right;
351 }

◆ getDefaultWhiteSpace()

const char JLANG::JEquationParameters::getDefaultWhiteSpace ( ) const
inlineinherited

Get default white space character.

Returns
white space character

Definition at line 359 of file JEquationParameters.hh.

360 {
361 if (ws.empty())
362 return ' ';
363 else
364 return ws[0];
365 }

◆ getWhiteSpace() [1/2]

const std::string & JLANG::JEquationParameters::getWhiteSpace ( ) const
inlineinherited

Get white space characters.

Returns
white space characters

Definition at line 373 of file JEquationParameters.hh.

374 {
375 return ws;
376 }

◆ getWhiteSpace() [2/2]

std::string & JLANG::JEquationParameters::getWhiteSpace ( )
inlineinherited

Get white space characters.

Returns
white space characters

Definition at line 384 of file JEquationParameters.hh.

385 {
386 return ws;
387 }

◆ setWhiteSpace()

void JLANG::JEquationParameters::setWhiteSpace ( const std::string & ws)
inlineinherited

Set white space characters.

Parameters
wswhite space characters

Definition at line 395 of file JEquationParameters.hh.

396 {
397 this->ws = ws;
398 }

◆ getComment() [1/2]

const std::string & JLANG::JEquationParameters::getComment ( ) const
inlineinherited

Get comment string.

Returns
comment string

Definition at line 406 of file JEquationParameters.hh.

407 {
408 return comment;
409 }

◆ getComment() [2/2]

std::string & JLANG::JEquationParameters::getComment ( )
inlineinherited

Get comment string.

Returns
comment string

Definition at line 417 of file JEquationParameters.hh.

418 {
419 return comment;
420 }

◆ setComment()

void JLANG::JEquationParameters::setComment ( const std::string & comment)
inlineinherited

Set comment string.

Parameters
commentcomment string

Definition at line 428 of file JEquationParameters.hh.

429 {
430 this->comment = comment;
431 }

◆ join() [2/2]

JEquationParameters & JLANG::JEquationParameters::join ( const JEquationParameters & value)
inlineinherited

Join equation parameters.

Parameters
valueequation parameters

Definition at line 439 of file JEquationParameters.hh.

440 {
441 using namespace std;
442
443 for (string::const_iterator i = value.sep.begin(); i != value.sep.end(); ++i) {
444 if (!isSeparator(*i)) {
445 sep += *i;
446 }
447 }
448
449 for (string::const_iterator i = value.eol.begin(); i != value.eol.end(); ++i) {
450 if (!isEndOfLine(*i)) {
451 eol += *i;
452 }
453 }
454
455 for (string::const_iterator i = value.div.begin(); i != value.div.end(); ++i) {
456 if (!isDivision(*i)) {
457 div += *i;
458 }
459 }
460
461 for (string::const_iterator i = value.skip.begin(); i != value.skip.end(); ++i) {
462 if (!isSkipLine(*i)) {
463 skip += *i;
464 }
465 }
466
467 for (string::const_iterator i = value.ws.begin(); i != value.ws.end(); ++i) {
468 if (!isWhiteSpace(*i)) {
469 ws += *i;
470 }
471 }
472
473 return *this;
474 }
bool isEndOfLine(const char c) const
Test for end of line character.
bool isSkipLine(const char c) const
Test for skip line character.
bool isWhiteSpace(const char c) const
Test for white space character.

◆ isSeparator()

bool JLANG::JEquationParameters::isSeparator ( const char c) const
inlineinherited

Test for separator character.

Parameters
ccharacter
Returns
true if separator; else false

Definition at line 483 of file JEquationParameters.hh.

484 {
485 return sep .find(c) != std::string::npos;
486 }

◆ isEndOfLine()

bool JLANG::JEquationParameters::isEndOfLine ( const char c) const
inlineinherited

Test for end of line character.

Parameters
ccharacter
Returns
true if end of line; else false

Definition at line 495 of file JEquationParameters.hh.

495{ return eol .find(c) != std::string::npos; }

◆ isDivision()

bool JLANG::JEquationParameters::isDivision ( const char c) const
inlineinherited

Test for division character.

Parameters
ccharacter
Returns
true if division; else false

Definition at line 504 of file JEquationParameters.hh.

505 {
506 return div .find(c) != std::string::npos;
507 }

◆ isSkipLine()

bool JLANG::JEquationParameters::isSkipLine ( const char c) const
inlineinherited

Test for skip line character.

Parameters
ccharacter
Returns
true if skip line; else false

Definition at line 516 of file JEquationParameters.hh.

517 {
518 return skip.find(c) != std::string::npos;
519 }

◆ isLeftBracket()

bool JLANG::JEquationParameters::isLeftBracket ( const char c) const
inlineinherited

Test for left bracket character.

Parameters
ccharacter
Returns
true if left bracket; else false

Definition at line 528 of file JEquationParameters.hh.

529 {
530 return c == left;
531 }

◆ isRightBracket()

bool JLANG::JEquationParameters::isRightBracket ( const char c) const
inlineinherited

Test for right bracket character.

Parameters
ccharacter
Returns
true if right bracket; else false

Definition at line 540 of file JEquationParameters.hh.

541 {
542 return c == right;
543 }

◆ isWhiteSpace()

bool JLANG::JEquationParameters::isWhiteSpace ( const char c) const
inlineinherited

Test for white space character.

Parameters
ccharacter
Returns
true if white space; else false

Definition at line 552 of file JEquationParameters.hh.

553 {
554 return ws .find(c) != std::string::npos;
555 }

Friends And Related Symbol Documentation

◆ operator>>

std::istream & operator>> ( std::istream & in,
JProperties & properties )
friend

Stream input.

Parameters
ininput stream
propertiesproperties
Returns
input stream

Definition at line 983 of file JProperties.hh.

984 {
985 return properties.read(in);
986 }

◆ operator<<

std::ostream & operator<< ( std::ostream & out,
const JProperties & properties )
friend

Stream output.

Parameters
outoutput stream
propertiesproperties
Returns
output stream

Definition at line 996 of file JProperties.hh.

997 {
998 return properties.write(out);
999 }

Member Data Documentation

◆ sep

std::string JLANG::JEquationParameters::sep
protectedinherited

Definition at line 558 of file JEquationParameters.hh.

◆ eol

std::string JLANG::JEquationParameters::eol
protectedinherited

Definition at line 559 of file JEquationParameters.hh.

◆ div

std::string JLANG::JEquationParameters::div
protectedinherited

Definition at line 560 of file JEquationParameters.hh.

◆ skip

std::string JLANG::JEquationParameters::skip
protectedinherited

Definition at line 561 of file JEquationParameters.hh.

◆ left

char JLANG::JEquationParameters::left
protectedinherited

Definition at line 562 of file JEquationParameters.hh.

◆ right

char JLANG::JEquationParameters::right
protectedinherited

Definition at line 563 of file JEquationParameters.hh.

◆ ws

std::string JLANG::JEquationParameters::ws
protectedinherited

Definition at line 564 of file JEquationParameters.hh.

◆ comment

std::string JLANG::JEquationParameters::comment
protectedinherited

Definition at line 565 of file JEquationParameters.hh.

◆ debug

int JEEP::JMessage< JProperties >::debug
staticinherited

debug level (default is off).

Definition at line 45 of file JMessage.hh.


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