Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
utils.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
3
4#ifndef UTILS_H
5#define UTILS_H
6
7#include <QtCore/qglobal.h>
8#include <private/qtools_p.h>
9
10#include <algorithm>
11
13
14inline bool is_whitespace(char s)
15{
16 return (s == ' ' || s == '\t' || s == '\n');
17}
18
19inline bool is_space(char s)
20{
21 return (s == ' ' || s == '\t');
22}
23
24inline bool is_ident_start(char s)
25{
26 using namespace QtMiscUtils;
27 return isAsciiLower(s) || isAsciiUpper(s) || s == '_' || s == '$';
28}
29
30inline bool is_ident_char(char s)
31{
32 return QtMiscUtils::isAsciiLetterOrNumber(s) || s == '_' || s == '$';
33}
34
35inline bool is_identifier(const char *s, qsizetype len)
36{
37 if (len < 1)
38 return false;
39 return std::all_of(s, s + len, is_ident_char);
40}
41
42inline const char *skipQuote(const char *data)
43{
44 while (*data && (*data != '\"')) {
45 if (*data == '\\') {
46 ++data;
47 if (!*data) break;
48 }
49 ++data;
50 }
51
52 if (*data) //Skip last quote
53 ++data;
54 return data;
55}
56
58
59#endif // UTILS_H
bool is_identifier(const char *s, qsizetype len)
Definition utils.h:35
bool is_ident_char(char s)
Definition utils.h:30
const char * skipQuote(const char *data)
Definition utils.h:42
bool is_space(char s)
Definition utils.h:19
QT_BEGIN_NAMESPACE bool is_whitespace(char s)
Definition utils.h:14
bool is_ident_start(char s)
Definition utils.h:24
Combined button and popup list for selecting options.
constexpr bool isAsciiLetterOrNumber(char32_t c) noexcept
Definition qtools_p.h:82
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLdouble s
[6]
Definition qopenglext.h:235
GLenum GLsizei len
ptrdiff_t qsizetype
Definition qtypes.h:165