| Flutter Impeller |

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
12 namespace impeller {
13 namespace compiler {
14
15 /// @brief Sets the file access mode of the file at path 'p' to 0644.
16 bool 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.
24 std::string Utf8FromPath(const std::filesystem::path& path);
25
26 std::string InferShaderNameFromPath(std::string_view path);
27
28 std::string ToCamelCase(std::string_view string);
29
30 std::string ToLowerCase(std::string_view string);
31
32 /// @brief Ensure that the entrypoint name is a valid identifier in the target
33 /// language.
34 std::string ConvertToEntrypointName(std::string_view string);
35
36 bool StringStartsWith(const std::string& target, const std::string& prefix);
37
38 } // namespace compiler
39 } // namespace impeller
40
41 #endif // FLUTTER_IMPELLER_COMPILER_UTILITIES_H_
impeller::compiler::ToCamelCase
std::string ToCamelCase(std::string_view string)
Definition: utilities.cc:39
impeller::compiler::ConvertToEntrypointName
std::string ConvertToEntrypointName(std::string_view string)
Ensure that the entrypoint name is a valid identifier in the target language.
Definition: utilities.cc:69
impeller::compiler::ToLowerCase
std::string ToLowerCase(std::string_view string)
Definition: utilities.cc:62
impeller::compiler::InferShaderNameFromPath
std::string InferShaderNameFromPath(std::string_view path)
Definition: utilities.cc:34
impeller::compiler::SetPermissiveAccess
bool SetPermissiveAccess(const std::filesystem::path &p)
Sets the file access mode of the file at path 'p' to 0644.
Definition: utilities.cc:16
impeller::compiler::Utf8FromPath
std::string Utf8FromPath(const std::filesystem::path &path)
Converts a native format path to a utf8 string.
Definition: utilities.cc:30
impeller::compiler::StringStartsWith
bool StringStartsWith(const std::string &target, const std::string &prefix)
Definition: utilities.cc:87
impeller
Definition: aiks_context.cc:10