OpenDDS
Snapshot(2023/04/28-20:55)
dds
DCPS
RestoreOutputStreamState.h
Go to the documentation of this file.
1
/*
2
* Distributed under the OpenDDS License.
3
* See: http://www.opendds.org/license.html
4
*/
5
6
#ifndef OPENDDS_DCPS_RESTORE_OUTPUT_STREAM_STATE_H
7
#define OPENDDS_DCPS_RESTORE_OUTPUT_STREAM_STATE_H
8
9
// This file is used by opendds_idl, so it must be relative.
10
#include "../Versioned_Namespace.h"
11
12
#include <ostream>
13
14
OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL
15
16
namespace
OpenDDS
{
17
namespace
DCPS {
18
19
/**
20
* Save and automatically restore various formatting properties of a
21
* std::ostream. This should be used in custom operator<< overload functions
22
* when changing these properties.
23
*/
24
class
RestoreOutputStreamState
{
25
public
:
26
explicit
RestoreOutputStreamState
(std::ostream& stream)
27
:
stream_
(stream)
28
,
saved_
(0)
29
{
30
saved_
.copyfmt(stream);
31
}
32
33
~RestoreOutputStreamState
()
34
{
35
stream_
.copyfmt(
saved_
);
36
}
37
38
private
:
39
std::ostream&
stream_
;
40
std::ios
saved_
;
41
};
42
43
}
// namespace DCPS
44
}
// namespace OpenDDS
45
46
OPENDDS_END_VERSIONED_NAMESPACE_DECL
47
48
#endif
/* OPENDDS_DCPS_RESTORE_OUTPUT_STREAM_STATE_H */
OpenDDS::DCPS::RestoreOutputStreamState::saved_
std::ios saved_
Definition:
RestoreOutputStreamState.h:40
OpenDDS::DCPS::RestoreOutputStreamState
Definition:
RestoreOutputStreamState.h:24
OpenDDS::DCPS::RestoreOutputStreamState::stream_
std::ostream & stream_
Definition:
RestoreOutputStreamState.h:39
OpenDDS::DCPS::RestoreOutputStreamState::~RestoreOutputStreamState
~RestoreOutputStreamState()
Definition:
RestoreOutputStreamState.h:33
OPENDDS_END_VERSIONED_NAMESPACE_DECL
#define OPENDDS_END_VERSIONED_NAMESPACE_DECL
Definition:
Versioned_Namespace.h:48
OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL
Definition:
Hash.cpp:17
OpenDDS::DCPS::RestoreOutputStreamState::RestoreOutputStreamState
RestoreOutputStreamState(std::ostream &stream)
Definition:
RestoreOutputStreamState.h:26
OpenDDS
The Internal API and Implementation of OpenDDS.
Definition:
AddressCache.h:28
Generated by
1.8.13