MixRampInfo.hxx 1.75 KB
Newer Older
1
/*
Max Kellermann's avatar
Max Kellermann committed
2
 * Copyright 2003-2017 The Music Player Daemon Project
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
 * http://www.musicpd.org
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */

#ifndef MPD_MIX_RAMP_INFO_HXX
#define MPD_MIX_RAMP_INFO_HXX

#include "check.h"
#include "Compiler.h"

#include <string>

class MixRampInfo {
	std::string start, end;

public:
	MixRampInfo() = default;

34
	void Clear() noexcept {
35 36 37 38 39
		start.clear();
		end.clear();
	}

	gcc_pure
40
	bool IsDefined() const noexcept {
41 42 43 44
		return !start.empty() || !end.empty();
	}

	gcc_pure
45
	const char *GetStart() const noexcept {
46 47 48 49
		return start.empty() ? nullptr : start.c_str();
	}

	gcc_pure
50
	const char *GetEnd() const noexcept {
51 52 53
		return end.empty() ? nullptr : end.c_str();
	}

54
	void SetStart(const char *new_value) noexcept {
55 56 57 58 59 60
		if (new_value == nullptr)
			start.clear();
		else
			start = new_value;
	}

61
	void SetStart(std::string &&new_value) noexcept {
62 63 64
		start = std::move(new_value);
	}

65
	void SetEnd(const char *new_value) noexcept {
66 67 68 69 70 71
		if (new_value == nullptr)
			end.clear();
		else
			end = new_value;
	}

72
	void SetEnd(std::string &&new_value) noexcept {
73 74 75 76 77
		end = std::move(new_value);
	}
};

#endif