Flutter Engine
 
Loading...
Searching...
No Matches
mmap_file.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_TOOLS_LICENSES_CPP_SRC_MMAP_FILE_H_
6#define FLUTTER_TOOLS_LICENSES_CPP_SRC_MMAP_FILE_H_
7
8#include <string_view>
9#include "third_party/abseil-cpp/absl/status/statusor.h"
10
11/// A memory mapped file.
12class MMapFile {
13 public:
14 static absl::StatusOr<MMapFile> Make(std::string_view path);
15
16 ~MMapFile();
17
18 MMapFile(const MMapFile&) = delete;
19 MMapFile& operator=(const MMapFile&) = delete;
20
21 MMapFile(MMapFile&& other);
22
23 const char* GetData() const { return data_; }
24
25 size_t GetSize() const { return size_; }
26
27 private:
28 MMapFile(int fd, const char* data, size_t size);
29
30 int fd_ = -1;
31 const char* data_ = nullptr;
32 size_t size_ = 0;
33};
34
35#endif // FLUTTER_TOOLS_LICENSES_CPP_SRC_MMAP_FILE_H_
A memory mapped file.
Definition mmap_file.h:12
MMapFile & operator=(const MMapFile &)=delete
size_t GetSize() const
Definition mmap_file.h:25
static absl::StatusOr< MMapFile > Make(std::string_view path)
Definition mmap_file.cc:13
const char * GetData() const
Definition mmap_file.h:23
MMapFile(const MMapFile &)=delete
std::shared_ptr< const fml::Mapping > data