Flutter Engine
tonic::DartLibraryNatives Class Reference

#include <dart_library_natives.h>

Classes

struct  Entry
 

Public Member Functions

 DartLibraryNatives ()
 
 ~DartLibraryNatives ()
 
void Register (std::initializer_list< Entry > entries)
 
Dart_NativeFunction GetNativeFunction (Dart_Handle name, int argument_count, bool *auto_setup_scope)
 
const uint8_t * GetSymbol (Dart_NativeFunction native_function)
 

Detailed Description

Definition at line 17 of file dart_library_natives.h.

Constructor & Destructor Documentation

◆ DartLibraryNatives()

tonic::DartLibraryNatives::DartLibraryNatives ( )

Definition at line 11 of file dart_library_natives.cc.

11 {}

◆ ~DartLibraryNatives()

tonic::DartLibraryNatives::~DartLibraryNatives ( )

Definition at line 13 of file dart_library_natives.cc.

13 {}

Member Function Documentation

◆ GetNativeFunction()

Dart_NativeFunction tonic::DartLibraryNatives::GetNativeFunction ( Dart_Handle  name,
int  argument_count,
bool *  auto_setup_scope 
)

Definition at line 22 of file dart_library_natives.cc.

References tonic::DartLibraryNatives::Entry::argument_count, tonic::DartLibraryNatives::Entry::auto_setup_scope, tonic::DartLibraryNatives::Entry::native_function, and tonic::StdStringFromDart().

25  {
26  std::string name_string = StdStringFromDart(name);
27  auto it = entries_.find(name_string);
28  if (it == entries_.end())
29  return nullptr;
30  const Entry& entry = it->second;
31  if (entry.argument_count != argument_count)
32  return nullptr;
33  *auto_setup_scope = entry.auto_setup_scope;
34  return entry.native_function;
35 }
int argument_count
Definition: fuchsia.cc:52
std::string StdStringFromDart(Dart_Handle handle)
const char * name
Definition: fuchsia.cc:50

◆ GetSymbol()

const uint8_t * tonic::DartLibraryNatives::GetSymbol ( Dart_NativeFunction  native_function)

Definition at line 37 of file dart_library_natives.cc.

38  {
39  auto it = symbols_.find(native_function);
40  if (it == symbols_.end())
41  return nullptr;
42  return reinterpret_cast<const uint8_t*>(it->second);
43 }

◆ Register()

void tonic::DartLibraryNatives::Register ( std::initializer_list< Entry entries)

The documentation for this class was generated from the following files: