Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
utilities.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 FLUTTER_IMPELLER_COMPILER_UTILITIES_H_
6#define FLUTTER_IMPELLER_COMPILER_UTILITIES_H_
7
8#include <filesystem>
9#include <string>
10#include <string_view>
11
12namespace impeller {
13namespace compiler {
14
15/// @brief Sets the file access mode of the file at path 'p' to 0644.
16bool SetPermissiveAccess(const std::filesystem::path& p);
17
18/// @brief Converts a native format path to a utf8 string.
19///
20/// This utility uses `path::u8string()` to convert native paths to
21/// utf8. If the given path doesn't match the underlying native path
22/// format, and the native path format isn't utf8 (i.e. Windows, which
23/// has utf16 paths), the path will get mangled.
24std::string Utf8FromPath(const std::filesystem::path& path);
25
26std::string InferShaderNameFromPath(std::string_view path);
27
28std::string ToCamelCase(std::string_view string);
29
30std::string ToLowerCase(std::string_view string);
31
32/// @brief Ensure that the entrypoint name is a valid identifier in the target
33/// language.
34std::string ConvertToEntrypointName(std::string_view string);
35
36bool StringStartsWith(const std::string& target, const std::string& prefix);
37
38} // namespace compiler
39} // namespace impeller
40
41#endif // FLUTTER_IMPELLER_COMPILER_UTILITIES_H_
uint32_t * target
std::string ConvertToEntrypointName(std::string_view string)
Ensure that the entrypoint name is a valid identifier in the target language.
Definition utilities.cc:69
std::string ToLowerCase(std::string_view string)
Definition utilities.cc:62
bool SetPermissiveAccess(const std::filesystem::path &p)
Sets the file access mode of the file at path 'p' to 0644.
Definition utilities.cc:16
std::string ToCamelCase(std::string_view string)
Definition utilities.cc:39
std::string Utf8FromPath(const std::filesystem::path &path)
Converts a native format path to a utf8 string.
Definition utilities.cc:30
bool StringStartsWith(const std::string &target, const std::string &prefix)
Definition utilities.cc:87
std::string InferShaderNameFromPath(std::string_view path)
Definition utilities.cc:34