Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
directory_asset_bundle.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#ifndef FLUTTER_ASSETS_DIRECTORY_ASSET_BUNDLE_H_
6#define FLUTTER_ASSETS_DIRECTORY_ASSET_BUNDLE_H_
7
8#include <optional>
9#include "flutter/assets/asset_resolver.h"
10#include "flutter/fml/macros.h"
11#include "flutter/fml/memory/ref_counted.h"
12#include "flutter/fml/unique_fd.h"
13
14namespace flutter {
15
17 public:
19 bool is_valid_after_asset_manager_change);
20
22
23 private:
24 const fml::UniqueFD descriptor_;
25 bool is_valid_ = false;
26 bool is_valid_after_asset_manager_change_ = false;
27
28 // |AssetResolver|
29 bool IsValid() const override;
30
31 // |AssetResolver|
32 bool IsValidAfterAssetManagerChange() const override;
33
34 // |AssetResolver|
36
37 // |AssetResolver|
38 std::unique_ptr<fml::Mapping> GetAsMapping(
39 const std::string& asset_name) const override;
40
41 // |AssetResolver|
42 std::vector<std::unique_ptr<fml::Mapping>> GetAsMappings(
43 const std::string& asset_pattern,
44 const std::optional<std::string>& subdir) const override;
45
46 // |AssetResolver|
47 bool operator==(const AssetResolver& other) const override;
48
49 // |AssetResolver|
51 return this;
52 }
53
55};
56
57} // namespace flutter
58
59#endif // FLUTTER_ASSETS_DIRECTORY_ASSET_BUNDLE_H_
AssetResolverType
Identifies the type of AssetResolver an instance is.
std::vector< std::unique_ptr< fml::Mapping > > GetAsMappings(const std::string &asset_pattern, const std::optional< std::string > &subdir) const override
Same as GetAsMapping() but returns mappings for all files who's name matches a given pattern....
std::unique_ptr< fml::Mapping > GetAsMapping(const std::string &asset_name) const override
bool operator==(const AssetResolver &other) const override
bool IsValidAfterAssetManagerChange() const override
Certain asset resolvers are still valid after the asset manager is replaced before a hot reload,...
AssetResolver::AssetResolverType GetType() const override
Gets the type of AssetResolver this is. Types are defined in AssetResolverType.
const DirectoryAssetBundle * as_directory_asset_bundle() const override
#define FML_DISALLOW_COPY_AND_ASSIGN(TypeName)
Definition macros.h:27