MPD 0.20.6

- Main Page
- Namespaces
- Data Structures
- Files

- File List
- Globals

MixRampInfo.hxx
Go to the documentation of this file.
1 /*
2 * Copyright 2003-2017 The Music Player Daemon Project
3 * http://www.musicpd.org
4 *
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.
9 *
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.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
20 #ifndef MPD_MIX_RAMP_INFO_HXX
21 #define MPD_MIX_RAMP_INFO_HXX
22
23 #include "check.h"
24 #include "Compiler.h"
25
26 #include <string>
27
28 class MixRampInfo {
29 std::string start, end;
30
31 public:
32 MixRampInfo() = default;
33
34 void Clear() {
35 start.clear();
36 end.clear();
37 }
38
39 gcc_pure
40 bool IsDefined() const {
41 return !start.empty() || !end.empty();
42 }
43
44 gcc_pure
45 const char *GetStart() const {
46 return start.empty() ? nullptr : start.c_str();
47 }
48
49 gcc_pure
50 const char *GetEnd() const {
51 return end.empty() ? nullptr : end.c_str();
52 }
53
54 void SetStart(const char *new_value) {
55 if (new_value == nullptr)
56 start.clear();
57 else
58 start = new_value;
59 }
60
61 void SetStart(std::string &&new_value) {
62 start = std::move(new_value);
63 }
64
65 void SetEnd(const char *new_value) {
66 if (new_value == nullptr)
67 end.clear();
68 else
69 end = new_value;
70 }
71
72 void SetEnd(std::string &&new_value) {
73 end = std::move(new_value);
74 }
75 };
76
77 #endif
check.h
MixRampInfo::Clear
void Clear()
Definition: MixRampInfo.hxx:34
MixRampInfo
Definition: MixRampInfo.hxx:28
MixRampInfo::SetEnd
void SetEnd(const char *new_value)
Definition: MixRampInfo.hxx:65
Compiler.h
MixRampInfo::GetStart
gcc_pure const char * GetStart() const
Definition: MixRampInfo.hxx:45
MixRampInfo::SetStart
void SetStart(const char *new_value)
Definition: MixRampInfo.hxx:54
MixRampInfo::IsDefined
gcc_pure bool IsDefined() const
Definition: MixRampInfo.hxx:40
MixRampInfo::SetStart
void SetStart(std::string &&new_value)
Definition: MixRampInfo.hxx:61
MixRampInfo::SetEnd
void SetEnd(std::string &&new_value)
Definition: MixRampInfo.hxx:72
MixRampInfo::GetEnd
gcc_pure const char * GetEnd() const
Definition: MixRampInfo.hxx:50
gcc_pure
#define gcc_pure
Definition: Compiler.h:116
MixRampInfo::MixRampInfo
MixRampInfo()=default