1 // Copyright 2018 The Fuchsia 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 ZIRCON_SYSTEM_HOST_FIDL_INCLUDE_FIDL_C_NAMES_H_
6 #define ZIRCON_SYSTEM_HOST_FIDL_INCLUDE_FIDL_C_NAMES_H_
7 
8 #include <string>
9 
10 #include "c_generator.h"
11 #include "flat_ast.h"
12 #include "raw_ast.h"
13 #include "string_view.h"
14 #include "types.h"
15 
16 namespace fidl {
17 
18 std::string StringJoin(const std::vector<StringView>& strings, StringView separator);
19 
20 std::string NameIdentifier(SourceLocation name);
21 std::string NameName(const flat::Name& name, StringView library_separator, StringView separator);
22 
23 std::string NameLibrary(const std::vector<StringView>& library_name);
24 std::string NameLibraryCHeader(const std::vector<StringView>& library_name);
25 
26 std::string NamePrimitiveCType(types::PrimitiveSubtype subtype);
27 std::string NamePrimitiveSubtype(types::PrimitiveSubtype subtype);
28 std::string NamePrimitiveIntegerCConstantMacro(types::PrimitiveSubtype type);
29 std::string NameHandleSubtype(types::HandleSubtype subtype);
30 std::string NameHandleZXObjType(types::HandleSubtype subtype);
31 
32 std::string NameRawLiteralKind(raw::Literal::Kind kind);
33 
34 std::string NameFlatConstantKind(flat::Constant::Kind kind);
35 std::string NameFlatTypeKind(flat::Type::Kind kind);
36 std::string NameUnionTag(StringView union_name, const flat::Union::Member& member);
37 std::string NameFlatConstant(const flat::Constant* constant);
38 std::string NameFlatType(const flat::Type* type);
39 std::string NameFlatCType(const flat::Type* type, flat::Decl::Kind decl_kind);
40 std::string NameInterface(const flat::Interface& interface);
41 std::string NameDiscoverable(const flat::Interface& interface);
42 std::string NameMethod(StringView interface_name, const flat::Interface::Method& method);
43 std::string NameOrdinal(StringView method_name);
44 std::string NameMessage(StringView method_name, types::MessageKind kind);
45 
46 std::string NameTable(StringView type_name);
47 std::string NamePointer(StringView name);
48 std::string NameMembers(StringView name);
49 std::string NameFields(StringView name);
50 
51 std::string NameCodedStruct(const flat::Struct* struct_decl);
52 std::string NameCodedTable(const flat::Table* table_decl);
53 std::string NameCodedUnion(const flat::Union* union_decl);
54 std::string NameCodedHandle(types::HandleSubtype subtype, types::Nullability nullability);
55 std::string NameCodedInterfaceHandle(StringView interface_name, types::Nullability nullability);
56 std::string NameCodedRequestHandle(StringView interface_name, types::Nullability nullability);
57 std::string NameCodedArray(StringView element_name, uint64_t size);
58 std::string NameCodedVector(StringView element_name, uint64_t max_size,
59                             types::Nullability nullability);
60 std::string NameCodedString(uint64_t max_size, types::Nullability nullability);
61 
62 } // namespace fidl
63 
64 #endif // ZIRCON_SYSTEM_HOST_FIDL_INCLUDE_FIDL_C_NAMES_H_
65