blob: 131b17e086ac7b3845e4f1294390cc698cd39e07 [file] [log] [blame]
Jamie Madill8c5aeb62015-05-21 08:17:18 -04001//
2// Copyright 2015 The ANGLE Project Authors. All rights reserved.
3// Use of this source code is governed by a BSD-style license that can be
4// found in the LICENSE file.
5//
6// string_utils:
7// String helper functions.
8//
9
10#ifndef LIBANGLE_STRING_UTILS_H_
11#define LIBANGLE_STRING_UTILS_H_
12
13#include <string>
14#include <vector>
15
16namespace angle
17{
18
Corentin Wallez47ac69c2015-11-24 11:15:57 -050019extern const char kWhitespaceASCII[];
20
21enum WhitespaceHandling
22{
23 KEEP_WHITESPACE,
24 TRIM_WHITESPACE,
25};
26
27enum SplitResult
28{
29 SPLIT_WANT_ALL,
30 SPLIT_WANT_NONEMPTY,
31};
32
33std::vector<std::string> SplitString(const std::string &input,
34 const std::string &delimiters,
35 WhitespaceHandling whitespace,
36 SplitResult resultType);
Jamie Madill8c5aeb62015-05-21 08:17:18 -040037
38void SplitStringAlongWhitespace(const std::string &input,
39 std::vector<std::string> *tokensOut);
40
Corentin Wallez47ac69c2015-11-24 11:15:57 -050041std::string TrimString(const std::string &input, const std::string &trimChars);
42
Jamie Madill8c5aeb62015-05-21 08:17:18 -040043bool HexStringToUInt(const std::string &input, unsigned int *uintOut);
44
45bool ReadFileToString(const std::string &path, std::string *stringOut);
46
47}
48
49#endif // LIBANGLE_STRING_UTILS_H_