| 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 #pragma once
6
7 #include <filesystem>
8 #include <string>
9 #include <string_view>
10
11 #include "flutter/fml/macros.h"
12
13 namespace impeller {
14 namespace compiler {
15
16 /// @brief Converts a native format path to a utf8 string.
17 ///
18 /// This utility uses `path::u8string()` to convert native paths to
19 /// utf8. If the given path doesn't match the underlying native path
20 /// format, and the native path format isn't utf8 (i.e. Windows, which
21 /// has utf16 paths), the path will get mangled.
22 std::string Utf8FromPath(const std::filesystem::path& path);
23
24 std::string InferShaderNameFromPath(std::string_view path);
25
26 std::string ConvertToCamelCase(std::string_view string);
27
28 /// @brief Ensure that the entrypoint name is a valid identifier in the target
29 /// language.
30 std::string ConvertToEntrypointName(std::string_view string);
31
32 bool StringStartsWith(const std::string& target, const std::string& prefix);
33
34 } // namespace compiler
35 } // namespace impeller
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:46
impeller::compiler::InferShaderNameFromPath
std::string InferShaderNameFromPath(std::string_view path)
Definition: utilities.cc:18
impeller::compiler::ConvertToCamelCase
std::string ConvertToCamelCase(std::string_view string)
Definition: utilities.cc:23
impeller::compiler::Utf8FromPath
std::string Utf8FromPath(const std::filesystem::path &path)
Converts a native format path to a utf8 string.
Definition: utilities.cc:14
impeller::compiler::StringStartsWith
bool StringStartsWith(const std::string &target, const std::string &prefix)
Definition: utilities.cc:64
impeller
Definition: aiks_context.cc:10