libjxl

FORK: libjxl patches used on blog
git clone https://git.neptards.moe/blog/libjxl.git
Log | Files | Refs | Submodules | README | LICENSE

mmap.h (720B)


      1 // Copyright (c) the JPEG XL Project Authors. All rights reserved.
      2 //
      3 // Use of this source code is governed by a BSD-style
      4 // license that can be found in the LICENSE file.
      5 
      6 #ifndef LIB_EXTRAS_MMAP_H_
      7 #define LIB_EXTRAS_MMAP_H_
      8 
      9 #include <memory>
     10 
     11 #include "lib/jxl/base/status.h"
     12 
     13 namespace jxl {
     14 struct MemoryMappedFileImpl;
     15 
     16 class MemoryMappedFile {
     17  public:
     18   static StatusOr<MemoryMappedFile> Init(const char* path);
     19   const uint8_t* data() const;
     20   size_t size() const;
     21   MemoryMappedFile();
     22   ~MemoryMappedFile();
     23   MemoryMappedFile(MemoryMappedFile&&) noexcept;
     24   MemoryMappedFile& operator=(MemoryMappedFile&&) noexcept;
     25 
     26  private:
     27   std::unique_ptr<MemoryMappedFileImpl> impl_;
     28 };
     29 }  // namespace jxl
     30 
     31 #endif