class NamingContext

Defined at line 42 of file ../../tools/fidl/fidlc/src/name.h

A NamingContext is a list of names, from least specific to most specific, which

identifies the use of a layout. For example, for the FIDL:

```

library fuchsia.bluetooth.le;

protocol Peripheral {

StartAdvertising(table { 1: data struct {}; });

};

```

The context for the innermost empty struct can be built up by the calls:

auto ctx = NamingContext("Peripheral").FromRequest("StartAdvertising").EnterMember("data")

`ctx` will produce a `FlattenedName` of "data", and a `Context` of

["Peripheral", "StartAdvertising", "data"].

Public Methods

std::shared_ptr<NamingContext> Create (SourceSpan decl_name)

Usage should only be through shared pointers, so that shared_from_this is always

valid. We use shared pointers to manage the lifetime of NamingContexts since the

parent pointers need to always be valid. Managing ownership with unique_ptr is tricky

(Push() would need to have access to a unique_ptr of this, and there would need to

be a place to own all the root nodes, which are not owned by an anonymous name), and

doing it manually is even worse.

Defined at line 50 of file ../../tools/fidl/fidlc/src/name.h

std::shared_ptr<NamingContext> Create (const Name & decl_name)
std::vector<std::string> Context ()
std::shared_ptr<NamingContext> EnterRequest (SourceSpan method_name)

Defined at line 55 of file ../../tools/fidl/fidlc/src/name.h

std::shared_ptr<NamingContext> EnterEvent (SourceSpan method_name)

Defined at line 60 of file ../../tools/fidl/fidlc/src/name.h

std::shared_ptr<NamingContext> EnterResponse (SourceSpan method_name)

Defined at line 67 of file ../../tools/fidl/fidlc/src/name.h

std::shared_ptr<NamingContext> EnterMember (SourceSpan member_name)

Defined at line 72 of file ../../tools/fidl/fidlc/src/name.h

Name ToName (Library * library, SourceSpan declaration_span)

ToName() exists to handle the case where the caller does not necessarily know what

kind of name (sourced or anonymous) this NamingContext corresponds to.

For example, this happens for layouts where the Consume* functions all take a

NamingContext and so the given layout may be at the top level of the library

(with a user-specified name) or may be nested/anonymous.

SourceSpan name ()

Defined at line 76 of file ../../tools/fidl/fidlc/src/name.h

std::shared_ptr<NamingContext> parent ()

Defined at line 78 of file ../../tools/fidl/fidlc/src/name.h

void set_name_override (std::string value)

Defined at line 83 of file ../../tools/fidl/fidlc/src/name.h

std::string_view flattened_name ()

Defined at line 85 of file ../../tools/fidl/fidlc/src/name.h