MiKTeX 23.10-next
A scalable TeX distribution
Loading...
Searching...
No Matches
MemoryMappedFile.h
1/* miktex/Core/MemoryMappedFile.h: -*- C++ -*-
2
3 Copyright (C) 1996-2021 Christian Schenk
4
5 This file is part of the MiKTeX Core Library.
6
7 The MiKTeX Core Library is free software; you can redistribute it
8 and/or modify it under the terms of the GNU General Public License
9 as published by the Free Software Foundation; either version 2, or
10 (at your option) any later version.
11
12 The MiKTeX Core Library is distributed in the hope that it will be
13 useful, but WITHOUT ANY WARRANTY; without even the implied warranty
14 of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with the MiKTeX Core Library; if not, write to the Free
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
20 02111-1307, USA. */
21
22#pragma once
23
24#if !defined(B15AA2CEBAC6439F92AFC9ED642BB435)
25#define B15AA2CEBAC6439F92AFC9ED642BB435
26
27#include <miktex/Core/config.h>
28
29#include <cstddef>
30
31#include <miktex/Util/PathName>
32
33MIKTEX_CORE_BEGIN_NAMESPACE;
34
36class MIKTEXNOVTABLE MemoryMappedFile
37{
38public:
39 virtual MIKTEXTHISCALL ~MemoryMappedFile() noexcept = 0;
40
46public:
47 virtual void* MIKTEXTHISCALL Open(const MiKTeX::Util::PathName& path, bool readWrite) = 0;
48
50public:
51 virtual void MIKTEXTHISCALL Close() = 0;
52
56public:
57 virtual void* MIKTEXTHISCALL Resize(std::size_t newSize) = 0;
58
61public:
62 virtual void* MIKTEXTHISCALL GetPtr() const = 0;
63
66public:
67 virtual std::string MIKTEXTHISCALL GetName() const = 0;
68
71public:
72 virtual std::size_t MIKTEXTHISCALL GetSize() const = 0;
73
75public:
76 virtual void MIKTEXTHISCALL Flush() = 0;
77
81public:
82 static MIKTEXCORECEEAPI(MemoryMappedFile*) Create();
83};
84
85MIKTEX_CORE_END_NAMESPACE;
86
87#endif
Instances of this class provide access to memory-mapped files.
Definition: MemoryMappedFile.h:37
virtual void Flush()=0
Flushes the memory-mapped file to disk.
virtual std::size_t GetSize() const =0
virtual void Close()=0
Closes the file mapping.
virtual void * Open(const MiKTeX::Util::PathName &path, bool readWrite)=0
static MemoryMappedFile * Create()
virtual std::string GetName() const =0
virtual void * GetPtr() const =0
virtual void * Resize(std::size_t newSize)=0
Instances of this class can be used to store path names.
Definition: PathName.h:73