Flutter Engine
flutter::EmbedderResources Class Reference

#include <embedder_resources.h>

Public Member Functions

 EmbedderResources (runtime::ResourcesEntry *resources_table)
 
int ResourceLookup (const char *path, const char **resource)
 
const char * Path (int idx)
 

Static Public Attributes

static const int kNoSuchInstance = -1
 

Detailed Description

Definition at line 22 of file embedder_resources.h.

Constructor & Destructor Documentation

◆ EmbedderResources()

flutter::EmbedderResources::EmbedderResources ( runtime::ResourcesEntry resources_table)

Definition at line 15 of file embedder_resources.cc.

References kNoSuchInstance.

16  : resources_table_(resources_table) {}

Member Function Documentation

◆ Path()

const char * flutter::EmbedderResources::Path ( int  idx)

Definition at line 32 of file embedder_resources.cc.

References FML_DCHECK, and flutter::runtime::ResourcesEntry::path_.

32  {
33  FML_DCHECK(idx >= 0);
34  ResourcesEntry* entry = At(idx);
35  if (entry == nullptr) {
36  return nullptr;
37  }
38  FML_DCHECK(entry->path_ != nullptr);
39  return entry->path_;
40 }
#define FML_DCHECK(condition)
Definition: logging.h:86

◆ ResourceLookup()

int flutter::EmbedderResources::ResourceLookup ( const char *  path,
const char **  resource 
)

Definition at line 20 of file embedder_resources.cc.

References FML_DCHECK, kNoSuchInstance, flutter::runtime::ResourcesEntry::length_, flutter::runtime::ResourcesEntry::path_, and flutter::runtime::ResourcesEntry::resource_.

20  {
21  for (int i = 0; resources_table_[i].path_ != nullptr; i++) {
22  const ResourcesEntry& entry = resources_table_[i];
23  if (strcmp(path, entry.path_) == 0) {
24  *resource = entry.resource_;
25  FML_DCHECK(entry.length_ > 0);
26  return entry.length_;
27  }
28  }
29  return kNoSuchInstance;
30 }
DEF_SWITCHES_START snapshot asset path
Definition: switches.h:32
static const int kNoSuchInstance
#define FML_DCHECK(condition)
Definition: logging.h:86
const char * path_
const char * resource_

Member Data Documentation

◆ kNoSuchInstance

const int flutter::EmbedderResources::kNoSuchInstance = -1
static

Definition at line 26 of file embedder_resources.h.

Referenced by EmbedderResources(), and ResourceLookup().


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