CASM
AClustersApproachtoStatisticalMechanics
Main Page
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Modules
FormatFlag.hh
Go to the documentation of this file.
1
#ifndef FORMATFLAG_HH
2
#define FORMATFLAG_HH
3
4
#include <iostream>
5
6
namespace
CASM
{
7
8
class
FormatFlag
{
9
public
:
10
enum
Value
{
11
cart
= 0,
12
va_off
= 0,
13
header_on
= 0,
14
frac
= (1u << 0),
15
va_on
= (1u << 1),
16
header_off
= (1u << 2)
17
// add up to (1u << 7)
18
};
19
20
FormatFlag
(
int
_value) :
m_value
(_value) {}
21
22
FormatFlag
(std::ostream &_stream) :
m_value
(_stream.iword(
iword_index
())) {}
23
24
int
value
()
const
{
25
return
m_value
;
26
}
27
28
std::ostream &
set
(std::ostream &_stream)
const
{
29
_stream.iword(
iword_index
()) =
value
();
30
return
_stream;
31
}
32
33
bool
print_header
()
const
{
34
return
!bool(
m_value
&
header_off
);
35
}
36
37
FormatFlag
&
print_header
(
bool
_set) {
38
if
(_set)
39
m_value
&= ~
header_off
;
40
else
41
m_value
|=
header_off
;
42
return
*
this
;
43
}
44
45
bool
print_va
()
const
{
46
return
bool(
m_value
&
va_on
);
47
}
48
49
FormatFlag
operator|
(
int
RHS) {
50
FormatFlag
tflag(*
this
);
51
return
tflag |= RHS;
52
}
53
54
FormatFlag
operator^
(
int
RHS) {
55
FormatFlag
tflag(*
this
);
56
return
tflag ^= RHS;
57
}
58
59
FormatFlag
operator&
(
int
RHS) {
60
FormatFlag
tflag(*
this
);
61
return
tflag &= RHS;
62
}
63
64
FormatFlag
&
operator|=
(
int
RHS) {
65
m_value
|= RHS;
66
return
*
this
;
67
}
68
69
FormatFlag
&
operator^=
(
int
RHS) {
70
m_value
^= RHS;
71
return
*
this
;
72
}
73
74
FormatFlag
&
operator&=
(
int
RHS) {
75
m_value
&= RHS;
76
return
*
this
;
77
}
78
79
private
:
80
static
int
iword_index
();
81
int
m_value
;
82
};
83
84
std::ostream &
operator<<
(std::ostream &_stream,
const
FormatFlag
&flag);
85
86
}
87
#endif
88
CASM::FormatFlag::iword_index
static int iword_index()
Definition:
FormatFlag.cc:4
CASM::FormatFlag::print_header
bool print_header() const
Definition:
FormatFlag.hh:33
CASM::FormatFlag::operator|=
FormatFlag & operator|=(int RHS)
Definition:
FormatFlag.hh:64
CASM
Main CASM namespace.
Definition:
complete.cpp:8
CASM::FormatFlag::frac
Definition:
FormatFlag.hh:14
CASM::FormatFlag::m_value
int m_value
Definition:
FormatFlag.hh:81
CASM::operator<<
std::ostream & operator<<(std::ostream &_stream, const FormattedPrintable &_formatted)
Definition:
DataFormatter.hh:728
CASM::FormatFlag::FormatFlag
FormatFlag(std::ostream &_stream)
Definition:
FormatFlag.hh:22
CASM::FormatFlag::Value
Value
Definition:
FormatFlag.hh:10
CASM::FormatFlag::print_header
FormatFlag & print_header(bool _set)
Definition:
FormatFlag.hh:37
CASM::FormatFlag::header_off
Definition:
FormatFlag.hh:16
CASM::FormatFlag::va_on
Definition:
FormatFlag.hh:15
CASM::FormatFlag::FormatFlag
FormatFlag(int _value)
Definition:
FormatFlag.hh:20
CASM::FormatFlag::operator|
FormatFlag operator|(int RHS)
Definition:
FormatFlag.hh:49
CASM::FormatFlag::cart
Definition:
FormatFlag.hh:11
CASM::FormatFlag::set
std::ostream & set(std::ostream &_stream) const
Definition:
FormatFlag.hh:28
CASM::FormatFlag::operator^=
FormatFlag & operator^=(int RHS)
Definition:
FormatFlag.hh:69
CASM::FormatFlag::operator&
FormatFlag operator&(int RHS)
Definition:
FormatFlag.hh:59
CASM::FormatFlag::va_off
Definition:
FormatFlag.hh:12
CASM::FormatFlag::operator^
FormatFlag operator^(int RHS)
Definition:
FormatFlag.hh:54
CASM::FormatFlag
Definition:
FormatFlag.hh:8
CASM::FormatFlag::header_on
Definition:
FormatFlag.hh:13
CASM::FormatFlag::print_va
bool print_va() const
Definition:
FormatFlag.hh:45
CASM::FormatFlag::operator&=
FormatFlag & operator&=(int RHS)
Definition:
FormatFlag.hh:74
CASM::FormatFlag::value
int value() const
Definition:
FormatFlag.hh:24
include
casm
casm_io
FormatFlag.hh
Generated on Fri Aug 10 2018 02:19:20 for CASM by
1.8.8