MPD 0.20.6

- Main Page
- Namespaces
- Data Structures
- Files

- File List
- Globals

ArgParser.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_PROTOCOL_ARGPARSER_HXX
21 #define MPD_PROTOCOL_ARGPARSER_HXX
22
23 #include "check.h"
24 #include "Compiler.h"
25
26 #include <limits>
27
28 #include <stdint.h>
29
30 class SongTime;
31 class SignedSongTime;
32
33 gcc_pure
34 uint32_t
35 ParseCommandArgU32(const char *s);
36
37 gcc_pure
38 int
39 ParseCommandArgInt(const char *s, int min_value, int max_value);
40
41 gcc_pure
42 int
43 ParseCommandArgInt(const char *s);
44
45 struct RangeArg {
46 unsigned start, end;
47
48 void SetAll() {
49 start = 0;
50 end = std::numeric_limits<unsigned>::max();
51 }
52
53 static constexpr RangeArg All() {
54 return { 0, std::numeric_limits<unsigned>::max() };
55 }
56 };
57
58 gcc_pure
59 RangeArg
60 ParseCommandArgRange(const char *s);
61
62 gcc_pure
63 unsigned
64 ParseCommandArgUnsigned(const char *s, unsigned max_value);
65
66 gcc_pure
67 unsigned
68 ParseCommandArgUnsigned(const char *s);
69
70 gcc_pure
71 bool
72 ParseCommandArgBool(const char *s);
73
74 gcc_pure
75 float
76 ParseCommandArgFloat(const char *s);
77
78 gcc_pure
79 SongTime
80 ParseCommandArgSongTime(const char *s);
81
82 gcc_pure
83 SignedSongTime
84 ParseCommandArgSignedSongTime(const char *s);
85
86 #endif
check.h
ParseCommandArgSignedSongTime
gcc_pure SignedSongTime ParseCommandArgSignedSongTime(const char *s)
SongTime
A time stamp within a song.
Definition: Chrono.hxx:31
RangeArg::All
static constexpr RangeArg All()
Definition: ArgParser.hxx:53
RangeArg::start
unsigned start
Definition: ArgParser.hxx:46
ParseCommandArgBool
gcc_pure bool ParseCommandArgBool(const char *s)
ParseCommandArgSongTime
gcc_pure SongTime ParseCommandArgSongTime(const char *s)
ParseCommandArgInt
gcc_pure int ParseCommandArgInt(const char *s, int min_value, int max_value)
RangeArg
Definition: ArgParser.hxx:45
Compiler.h
RangeArg::end
unsigned end
Definition: ArgParser.hxx:46
SignedSongTime
A variant of SongTime that is based on a signed integer.
Definition: Chrono.hxx:115
ParseCommandArgU32
gcc_pure uint32_t ParseCommandArgU32(const char *s)
RangeArg::SetAll
void SetAll()
Definition: ArgParser.hxx:48
ParseCommandArgFloat
gcc_pure float ParseCommandArgFloat(const char *s)
gcc_pure
#define gcc_pure
Definition: Compiler.h:116
ParseCommandArgUnsigned
gcc_pure unsigned ParseCommandArgUnsigned(const char *s, unsigned max_value)
ParseCommandArgRange
gcc_pure RangeArg ParseCommandArgRange(const char *s)