votca
2024.2-dev
Loading...
Searching...
No Matches
tools
include
votca
tools
propertyiomanipulator.h
Go to the documentation of this file.
1
/*
2
* Copyright 2009-2020 The VOTCA Development Team (http://www.votca.org)
3
*
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
7
*
8
* http://www.apache.org/licenses/LICENSE-2.0
9
*
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
15
*
16
*/
17
18
#ifndef VOTCA_TOOLS_PROPERTYIOMANIPULATOR_H
19
#define VOTCA_TOOLS_PROPERTYIOMANIPULATOR_H
20
21
// Local VOTCA includes
22
#include "
colors.h
"
23
#include "
property.h
"
24
25
namespace
votca
{
26
namespace
tools {
27
34
class
PropertyIOManipulator
{
35
36
public
:
37
enum
Type
{
XML
,
HLP
,
TXT
};
38
39
explicit
PropertyIOManipulator
(
Type
type =
XML
,
Index
level = 0,
40
std::string indentation =
""
,
41
ColorSchemeBase
*color_scheme =
nullptr
)
42
:
type_
(type),
43
level_
(level),
44
indentation_
(indentation),
45
color_scheme_
(color_scheme) {
46
;
47
}
48
49
~PropertyIOManipulator
() {
delete
color_scheme_
; }
50
friend
std::ostream &
operator<<
(std::ostream &os,
51
PropertyIOManipulator
&piom) {
52
os.pword(
int
(
Property::getIOindex
())) = &piom;
53
return
os;
54
}
55
56
const
Type
&
getType
() {
return
type_
; }
57
void
setType
(
Type
type) {
type_
= type; }
58
const
Index
&
getLevel
() {
return
level_
; }
59
void
setLevel
(
Index
level) {
level_
= level; }
60
const
std::string &
getIndentation
() {
return
indentation_
; }
61
void
setIndentation
(std::string indentation) {
indentation_
= indentation; }
62
const
ColorSchemeBase
*
getColorScheme
() {
63
if
(!
color_scheme_
) {
64
return
&
DEFAULT_COLORS
;
65
}
66
return
color_scheme_
;
67
}
68
69
template
<
typename
T>
70
const
ColorSchemeBase
*
setColorScheme
() {
71
if
(
color_scheme_
) {
72
delete
color_scheme_
;
73
}
74
color_scheme_
=
new
Color<T>
();
75
return
color_scheme_
;
76
}
77
78
private
:
79
Type
type_
;
80
Index
level_
;
81
std::string
indentation_
;
82
ColorSchemeBase
*
color_scheme_
;
83
};
84
85
extern
PropertyIOManipulator
XML
;
86
extern
PropertyIOManipulator
HLP
;
87
extern
PropertyIOManipulator
TXT
;
88
89
}
// namespace tools
90
}
// namespace votca
91
92
#endif
// VOTCA_TOOLS_PROPERTYIOMANIPULATOR_H
votca::tools::ColorSchemeBase
Definition
colors.h:77
votca::tools::Color
Definition
colors.h:92
votca::tools::PropertyIOManipulator
Manipulates the format state of the output stream.
Definition
propertyiomanipulator.h:34
votca::tools::PropertyIOManipulator::getColorScheme
const ColorSchemeBase * getColorScheme()
Definition
propertyiomanipulator.h:62
votca::tools::PropertyIOManipulator::PropertyIOManipulator
PropertyIOManipulator(Type type=XML, Index level=0, std::string indentation="", ColorSchemeBase *color_scheme=nullptr)
Definition
propertyiomanipulator.h:39
votca::tools::PropertyIOManipulator::getIndentation
const std::string & getIndentation()
Definition
propertyiomanipulator.h:60
votca::tools::PropertyIOManipulator::getType
const Type & getType()
Definition
propertyiomanipulator.h:56
votca::tools::PropertyIOManipulator::operator<<
friend std::ostream & operator<<(std::ostream &os, PropertyIOManipulator &piom)
Definition
propertyiomanipulator.h:50
votca::tools::PropertyIOManipulator::setIndentation
void setIndentation(std::string indentation)
Definition
propertyiomanipulator.h:61
votca::tools::PropertyIOManipulator::color_scheme_
ColorSchemeBase * color_scheme_
Definition
propertyiomanipulator.h:82
votca::tools::PropertyIOManipulator::setLevel
void setLevel(Index level)
Definition
propertyiomanipulator.h:59
votca::tools::PropertyIOManipulator::setColorScheme
const ColorSchemeBase * setColorScheme()
Definition
propertyiomanipulator.h:70
votca::tools::PropertyIOManipulator::type_
Type type_
Definition
propertyiomanipulator.h:79
votca::tools::PropertyIOManipulator::setType
void setType(Type type)
Definition
propertyiomanipulator.h:57
votca::tools::PropertyIOManipulator::getLevel
const Index & getLevel()
Definition
propertyiomanipulator.h:58
votca::tools::PropertyIOManipulator::~PropertyIOManipulator
~PropertyIOManipulator()
Definition
propertyiomanipulator.h:49
votca::tools::PropertyIOManipulator::level_
Index level_
Definition
propertyiomanipulator.h:80
votca::tools::PropertyIOManipulator::Type
Type
Definition
propertyiomanipulator.h:37
votca::tools::PropertyIOManipulator::TXT
@ TXT
Definition
propertyiomanipulator.h:37
votca::tools::PropertyIOManipulator::XML
@ XML
Definition
propertyiomanipulator.h:37
votca::tools::PropertyIOManipulator::HLP
@ HLP
Definition
propertyiomanipulator.h:37
votca::tools::PropertyIOManipulator::indentation_
std::string indentation_
Definition
propertyiomanipulator.h:81
votca::tools::Property::getIOindex
static Index getIOindex()
Definition
property.h:268
colors.h
votca::tools::TXT
PropertyIOManipulator TXT
votca::tools::DEFAULT_COLORS
Color< csDefault > DEFAULT_COLORS
Definition
colors.cc:24
votca::tools::XML
PropertyIOManipulator XML
votca::tools::HLP
PropertyIOManipulator HLP
votca
base class for all analysis tools
Definition
basebead.h:33
votca::Index
Eigen::Index Index
Definition
types.h:26
property.h
Generated by
1.12.0