1 /***************************************************************************
2 * Copyright (C) 2008-2014 by Andrzej Rybczak *
3 * electricityispower@gmail.com *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
19 ***************************************************************************/
23 std::ostream
&operator<<(std::ostream
&os
, SpaceAddMode sam
)
27 case SpaceAddMode::AddRemove
:
30 case SpaceAddMode::AlwaysAdd
:
37 std::istream
&operator>>(std::istream
&is
, SpaceAddMode
&sam
)
41 if (ssam
== "add_remove")
42 sam
= SpaceAddMode::AddRemove
;
43 else if (ssam
== "always_add")
44 sam
= SpaceAddMode::AlwaysAdd
;
46 is
.setstate(std::ios::failbit
);
50 std::ostream
&operator<<(std::ostream
&os
, SortMode sm
)
57 case SortMode::ModificationTime
:
60 case SortMode::CustomFormat
:
70 std::istream
&operator>>(std::istream
&is
, SortMode
&sm
)
76 else if (ssm
== "mtime")
77 sm
= SortMode::ModificationTime
;
78 else if (ssm
== "format")
79 sm
= SortMode::CustomFormat
;
80 else if (ssm
== "noop")
83 is
.setstate(std::ios::failbit
);
87 std::ostream
&operator<<(std::ostream
&os
, DisplayMode dm
)
91 case DisplayMode::Classic
:
94 case DisplayMode::Columns
:
101 std::istream
&operator>>(std::istream
&is
, DisplayMode
&dm
)
105 if (sdm
== "classic")
106 dm
= DisplayMode::Classic
;
107 else if (sdm
== "columns")
108 dm
= DisplayMode::Columns
;
110 is
.setstate(std::ios::failbit
);
114 std::ostream
&operator<<(std::ostream
&os
, Design ui
)
118 case Design::Classic
:
121 case Design::Alternative
:
128 std::istream
&operator>>(std::istream
&is
, Design
&ui
)
132 if (sui
== "classic")
133 ui
= Design::Classic
;
134 else if (sui
== "alternative")
135 ui
= Design::Alternative
;
137 is
.setstate(std::ios::failbit
);