Jpp test-rotations-old
the software that should make you happy
Loading...
Searching...
No Matches
JEEP::JPropertiesTemplateElement< T > Class Template Reference

Template class for I/O of properties element. More...

#include <JProperties.hh>

Inheritance diagram for JEEP::JPropertiesTemplateElement< T >:
JEEP::JPropertiesElementInterface JLANG::JStreamInput JLANG::JStreamOutput JLANG::JStreamSuffixOutput

Public Member Functions

 JPropertiesTemplateElement (T &value)
 Constructor.
 
virtual std::istream & read (std::istream &in) override
 Stream input.
 
virtual std::ostream & write (std::ostream &out, const char *prefix, const char postfix) const override
 Stream output.
 
virtual std::ostream & write (std::ostream &out) const override
 Stream output.
 
virtual bool equals (const JPropertiesElementInterface &element) const override
 Equality between property element interfaces.
 
virtual bool is_properties () const
 Get properties type.
 

Protected Attributes

T & object
 

Friends

class JPropertiesElement
 

Detailed Description

template<class T>
class JEEP::JPropertiesTemplateElement< T >

Template class for I/O of properties element.

This class implements the JPropertiesElementInterface interface.

Definition at line 112 of file JProperties.hh.

Constructor & Destructor Documentation

◆ JPropertiesTemplateElement()

template<class T >
JEEP::JPropertiesTemplateElement< T >::JPropertiesTemplateElement ( T & value)
inline

Constructor.

Parameters
valuereference of template object

Definition at line 124 of file JProperties.hh.

124 :
125 JPropertiesElementInterface(),
126 object(value)
127 {}

Member Function Documentation

◆ read()

template<class T >
virtual std::istream & JEEP::JPropertiesTemplateElement< T >::read ( std::istream & in)
inlineoverridevirtual

Stream input.

Parameters
ininput stream
Returns
input stream

Implements JLANG::JStreamInput.

Definition at line 136 of file JProperties.hh.

137 {
138 using namespace std;
139
140 readObject(in, object);
141
142 string buffer;
143
144 in >> buffer;
145
146 if (!buffer.empty()) {
147 THROW(JPropertiesException, "JProperties: pending data <" << buffer << (in.peek() != EOF ? "..." : "") << ">");
148 }
149
150 return in;
151 }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
std::istream & readObject(std::istream &in, T &object)
Stream input of object.

◆ write() [1/2]

template<class T >
virtual std::ostream & JEEP::JPropertiesTemplateElement< T >::write ( std::ostream & out,
const char * prefix,
const char postfix ) const
inlineoverridevirtual

Stream output.

Parameters
outoutput stream
prefixprefix
postfixpostfix
Returns
output stream

Reimplemented from JEEP::JPropertiesElementInterface.

Definition at line 162 of file JProperties.hh.

165 {
166 return writeObject(out, prefix, object, postfix);
167 }
std::ostream & writeObject(std::ostream &out, const T &object)
Stream output of object.

◆ write() [2/2]

template<class T >
virtual std::ostream & JEEP::JPropertiesTemplateElement< T >::write ( std::ostream & out) const
inlineoverridevirtual

Stream output.

Parameters
outoutput stream
Returns
output stream

Reimplemented from JEEP::JPropertiesElementInterface.

Definition at line 176 of file JProperties.hh.

177 {
178 return writeObject(out, object);
179 }

◆ equals()

template<class T >
virtual bool JEEP::JPropertiesTemplateElement< T >::equals ( const JPropertiesElementInterface & element) const
inlineoverridevirtual

Equality between property element interfaces.

Parameters
elementproperties element interface
Returns
true if equal; else false

Reimplemented from JEEP::JPropertiesElementInterface.

Definition at line 188 of file JProperties.hh.

189 {
190 const JPropertiesTemplateElement<T>* p = dynamic_cast<const JPropertiesTemplateElement<T>*>(&element);
191
192 if (p != NULL)
193 return compareObjects(object, p->object);
194 else
195 return false;
196 }
JPropertiesTemplateElement(T &value)
Constructor.
bool compareObjects(const T &first, const T &second, JBool< true >)
Comparison of comparable objects.

◆ is_properties()

virtual bool JEEP::JPropertiesElementInterface::is_properties ( ) const
inlinevirtualinherited

Get properties type.

Returns
false

Reimplemented in JEEP::JPropertiesTemplateElement< JProperties >.

Definition at line 84 of file JProperties.hh.

85 {
86 return false;
87 }

Friends And Related Symbol Documentation

◆ JPropertiesElement

template<class T >
friend class JPropertiesElement
friend

Definition at line 116 of file JProperties.hh.

Member Data Documentation

◆ object

template<class T >
T& JEEP::JPropertiesTemplateElement< T >::object
protected

Definition at line 200 of file JProperties.hh.


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