1 /***************************************************************************
2 * Copyright (C) 2008-2016 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
, SearchDirection sd
)
27 case SearchDirection::Backward
:
30 case SearchDirection::Forward
:
37 std::istream
&operator>>(std::istream
&is
, SearchDirection
&sd
)
41 if (ssd
== "backward")
42 sd
= SearchDirection::Backward
;
43 else if (ssd
== "forward")
44 sd
= SearchDirection::Forward
;
46 is
.setstate(std::ios::failbit
);
50 std::ostream
&operator<<(std::ostream
&os
, SpaceAddMode sam
)
54 case SpaceAddMode::AddRemove
:
57 case SpaceAddMode::AlwaysAdd
:
64 std::istream
&operator>>(std::istream
&is
, SpaceAddMode
&sam
)
68 if (ssam
== "add_remove")
69 sam
= SpaceAddMode::AddRemove
;
70 else if (ssam
== "always_add")
71 sam
= SpaceAddMode::AlwaysAdd
;
73 is
.setstate(std::ios::failbit
);
77 std::ostream
&operator<<(std::ostream
&os
, SortMode sm
)
84 case SortMode::ModificationTime
:
87 case SortMode::CustomFormat
:
97 std::istream
&operator>>(std::istream
&is
, SortMode
&sm
)
103 else if (ssm
== "mtime")
104 sm
= SortMode::ModificationTime
;
105 else if (ssm
== "format")
106 sm
= SortMode::CustomFormat
;
107 else if (ssm
== "noop")
110 is
.setstate(std::ios::failbit
);
114 std::ostream
&operator<<(std::ostream
&os
, DisplayMode dm
)
118 case DisplayMode::Classic
:
121 case DisplayMode::Columns
:
128 std::istream
&operator>>(std::istream
&is
, DisplayMode
&dm
)
132 if (sdm
== "classic")
133 dm
= DisplayMode::Classic
;
134 else if (sdm
== "columns")
135 dm
= DisplayMode::Columns
;
137 is
.setstate(std::ios::failbit
);
141 std::ostream
&operator<<(std::ostream
&os
, Design ui
)
145 case Design::Classic
:
148 case Design::Alternative
:
155 std::istream
&operator>>(std::istream
&is
, Design
&ui
)
159 if (sui
== "classic")
160 ui
= Design::Classic
;
161 else if (sui
== "alternative")
162 ui
= Design::Alternative
;
164 is
.setstate(std::ios::failbit
);
168 std::ostream
&operator<<(std::ostream
& os
, VisualizerType vt
)
172 case VisualizerType::Wave
:
175 case VisualizerType::WaveFilled
:
176 os
<< "sound wave filled";
179 case VisualizerType::Spectrum
:
180 os
<< "frequency spectrum";
182 # endif // HAVE_FFTW3_H
183 case VisualizerType::Ellipse
:
184 os
<< "sound ellipse";
190 std::istream
&operator>>(std::istream
& is
, VisualizerType
&vt
)
195 vt
= VisualizerType::Wave
;
196 else if (svt
== "wave_filled")
197 vt
= VisualizerType::WaveFilled
;
199 else if (svt
== "spectrum")
200 vt
= VisualizerType::Spectrum
;
201 # endif // HAVE_FFTW3_H
202 else if (svt
== "ellipse")
203 vt
= VisualizerType::Ellipse
;
205 is
.setstate(std::ios::failbit
);