MPD 0.20.6

- Main Page
- Namespaces
- Data Structures
- Files

- File List
- Globals

StringUtil.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_STRING_UTIL_HXX
21 #define MPD_STRING_UTIL_HXX
22
23 #include "Compiler.h"
24
25 #include <stddef.h>
26
35 gcc_nonnull_all
36 char *
37 CopyString(char *dest, const char *src, size_t size);
38
43 gcc_pure
44 const char *
45 StripLeft(const char *p);
46
47 gcc_pure
48 static inline char *
49 StripLeft(char *p)
50 {
51 return const_cast<char *>(StripLeft((const char *)p));
52 }
53
54 gcc_pure
55 const char *
56 StripLeft(const char *p, const char *end);
57
61 gcc_pure
62 const char *
63 StripRight(const char *p, const char *end);
64
68 gcc_pure
69 static inline char *
70 StripRight(char *p, char *end)
71 {
72 return const_cast<char *>(StripRight((const char *)p,
73 (const char *)end));
74 }
75
80 gcc_pure
81 size_t
82 StripRight(const char *p, size_t length);
83
87 void
88 StripRight(char *p);
89
94 char *
95 Strip(char *p);
96
105 gcc_pure
106 bool
107 StringArrayContainsCase(const char *const*haystack, const char *needle);
108
114 void
115 ToUpperASCII(char *dest, const char *src, size_t size);
116
117 #endif
gcc_nonnull_all
#define gcc_nonnull_all
Definition: Compiler.h:122
StripRight
gcc_pure const char * StripRight(const char *p, const char *end)
Determine the string's end as if it was stripped on the right side.
StringArrayContainsCase
gcc_pure bool StringArrayContainsCase(const char *const *haystack, const char *needle)
Checks whether a string array contains the specified string.
ToUpperASCII
void ToUpperASCII(char *dest, const char *src, size_t size)
Convert the specified ASCII string (0x00..0x7f) to upper case.
Compiler.h
Strip
char * Strip(char *p)
Skip whitespace at the beginning and terminate the string after the last non-whitespace character...
gcc_pure
#define gcc_pure
Definition: Compiler.h:116
StripLeft
gcc_pure const char * StripLeft(const char *p)
Returns a pointer to the first non-whitespace character in the string, or to the end of the string...
CopyString
gcc_nonnull_all char * CopyString(char *dest, const char *src, size_t size)
Copy a string.