Jpp  17.1.1
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
JLANG::JRedirectString Class Reference

This class can be used to temporarily redirect an input stream to an input string. More...

#include <JRedirectString.hh>

Inheritance diagram for JLANG::JRedirectString:
JLANG::JAbstractObjectStatus

Public Member Functions

 JRedirectString (std::istream &is, const std::string &buffer)
 Constructor. More...
 
 ~JRedirectString ()
 Destructor. More...
 
virtual bool getStatus () const override
 Get status of object. More...
 
 operator bool () const
 Type conversion operator. More...
 
bool operator! () const
 Negated status of this object. More...
 

Private Member Functions

 JRedirectString (const JRedirectString &)
 
 JRedirectString (JRedirectString &&)
 
JRedirectStringoperator= (const JRedirectString &)
 
JRedirectStringoperator= (JRedirectString &&)
 

Private Attributes

std::ios & ios
 
std::streambuf * p
 

Detailed Description

This class can be used to temporarily redirect an input stream to an input string.

The destructor restores the internal buffer of the input stream.

Definition at line 26 of file JRedirectString.hh.

Constructor & Destructor Documentation

JLANG::JRedirectString::JRedirectString ( std::istream &  is,
const std::string &  buffer 
)
inline

Constructor.

The input stream is redirected to the given input string.

Parameters
isinput stream
bufferinput string

Definition at line 37 of file JRedirectString.hh.

37  :
38  ios(is)
39  {
40  p = ios.rdbuf(new std::stringbuf(buffer));
41  }
is
Definition: JDAQCHSM.chsm:167
JLANG::JRedirectString::~JRedirectString ( )
inline

Destructor.

Restore internal buffer and delete temporary buffer.

Definition at line 48 of file JRedirectString.hh.

49  {
50  delete ios.rdbuf(p);
51  }
JLANG::JRedirectString::JRedirectString ( const JRedirectString )
private
JLANG::JRedirectString::JRedirectString ( JRedirectString &&  )
private

Member Function Documentation

virtual bool JLANG::JRedirectString::getStatus ( ) const
inlineoverridevirtual

Get status of object.

Returns
true

Implements JLANG::JAbstractObjectStatus.

Definition at line 59 of file JRedirectString.hh.

60  {
61  return true;
62  }
JRedirectString& JLANG::JRedirectString::operator= ( const JRedirectString )
private
JRedirectString& JLANG::JRedirectString::operator= ( JRedirectString &&  )
private
JLANG::JAbstractObjectStatus::operator bool ( ) const
inlineinherited

Type conversion operator.

Returns
status of this object

Definition at line 33 of file JAbstractObjectStatus.hh.

34  {
35  return this->getStatus();
36  }
virtual bool getStatus() const =0
Get status of object.
bool JLANG::JAbstractObjectStatus::operator! ( ) const
inlineinherited

Negated status of this object.

Returns
negated status of this object

Definition at line 44 of file JAbstractObjectStatus.hh.

45  {
46  return !(this->getStatus());
47  }
virtual bool getStatus() const =0
Get status of object.

Member Data Documentation

std::ios& JLANG::JRedirectString::ios
private

Definition at line 65 of file JRedirectString.hh.

std::streambuf* JLANG::JRedirectString::p
private

Definition at line 66 of file JRedirectString.hh.


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