Flutter Engine
The Flutter Engine
string_utils.h
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef BASE_STRING_UTILS_H_
6#define BASE_STRING_UTILS_H_
7
8#include <memory>
9#include <string>
10#include <vector>
11
12namespace base {
13
14constexpr char16_t kWhitespaceUTF16 = u' ';
15
16// Return a C++ string given printf-like input.
17template <typename... Args>
18std::string StringPrintf(const std::string& format, Args... args) {
19 // Calculate the buffer size.
20 int size = snprintf(nullptr, 0, format.c_str(), args...) + 1;
21 std::unique_ptr<char[]> buf = std::make_unique<char[]>(size);
22 snprintf(buf.get(), size, format.c_str(), args...);
23 return std::string(buf.get(), buf.get() + size - 1);
24}
25
26std::u16string ASCIIToUTF16(std::string src);
27std::u16string UTF8ToUTF16(std::string src);
28std::string UTF16ToUTF8(std::u16string src);
29
30std::u16string NumberToString16(unsigned int number);
31std::u16string NumberToString16(int32_t number);
32std::u16string NumberToString16(float number);
33std::u16string NumberToString16(double number);
34
35std::string NumberToString(unsigned int number);
36std::string NumberToString(int32_t number);
37std::string NumberToString(float number);
38std::string NumberToString(double number);
39
40std::string ToUpperASCII(std::string str);
41std::string ToLowerASCII(std::string str);
42
43std::string JoinString(std::vector<std::string> tokens, std::string delimiter);
44std::u16string JoinString(std::vector<std::u16string> tokens,
45 std::u16string delimiter);
46
47void ReplaceChars(std::string in,
48 std::string from,
49 std::string to,
50 std::string* out);
51void ReplaceChars(std::u16string in,
52 std::u16string from,
53 std::u16string to,
54 std::u16string* out);
55bool LowerCaseEqualsASCII(std::string a, std::string b);
56bool ContainsOnlyChars(std::u16string str, char16_t ch);
57
58const std::string& EmptyString();
59
60} // namespace base
61
62#endif // BASE_STRING_UTILS_H_
static bool b
struct MyStruct a[10]
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
uint32_t uint32_t * format
std::string StringPrintf(const std::string &format, Args... args)
Definition: string_utils.h:18
std::string ToUpperASCII(std::string str)
std::string UTF16ToUTF8(std::u16string src)
Definition: string_utils.cc:71
void ReplaceChars(std::string in, std::string from, std::string to, std::string *out)
const std::string & EmptyString()
std::u16string UTF8ToUTF16(std::string src)
Definition: string_utils.cc:67
constexpr char16_t kWhitespaceUTF16
Definition: string_utils.h:14
bool ContainsOnlyChars(std::u16string str, char16_t ch)
std::u16string ASCIIToUTF16(std::string src)
Definition: string_utils.cc:63
std::string ToLowerASCII(std::string str)
std::string JoinString(std::vector< std::string > tokens, std::string delimiter)
bool LowerCaseEqualsASCII(std::string a, std::string b)
std::string NumberToString(int32_t number)
Definition: string_utils.cc:91
std::u16string NumberToString16(float number)
Definition: string_utils.cc:75
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition: switches.h:259