1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 17:57:35 +00:00

Import all this stuff into a single repo called Serenity.

This commit is contained in:
Andreas Kling 2018-10-10 11:53:07 +02:00
commit 5a30055157
67 changed files with 8836 additions and 0 deletions

30
AK/MappedFile.h Normal file
View file

@ -0,0 +1,30 @@
#pragma once
#include "String.h"
namespace AK {
class MappedFile {
public:
MappedFile() { }
explicit MappedFile(String&& fileName);
MappedFile(MappedFile&&);
~MappedFile();
bool isValid() const { return m_map != (void*)-1; }
void* pointer() { return m_map; }
const void* pointer() const { return m_map; }
size_t fileLength() const { return m_fileLength; }
private:
String m_fileName;
size_t m_fileLength { 0 };
int m_fd { -1 };
void* m_map { (void*)-1 };
};
}
using AK::MappedFile;