MappedFile

The glib.MappedFile represents a file mapping created with MappedFile.new. It has only private members and should not be accessed directly.

Constructors

this
this(GMappedFile* gMappedFile, bool ownedRef)

Sets our main struct and passes it to the parent class.

this
this(string filename, bool writable)

Maps a file into memory. On UNIX, this is using the mmap() function.

this
this(int fd, bool writable)

Maps a file into memory. On UNIX, this is using the mmap() function.

Destructor

A destructor is present on this object, but not explicitly documented in the source.

Members

Functions

free
void free()

This call existed before glib.MappedFile had refcounting and is currently exactly the same as MappedFile.unref.

getBytes
Bytes getBytes()

Creates a new glib.Bytes which references the data mapped from file. The mapped contents of the file must not be modified after creating this bytes object, because a glib.Bytes should be immutable.

getContents
string getContents()

Returns the contents of a glib.MappedFile

getLength
size_t getLength()

Returns the length of the contents of a glib.MappedFile

getMappedFileStruct
GMappedFile* getMappedFileStruct(bool transferOwnership)

Get the main Gtk struct

getStruct
void* getStruct()

the main Gtk struct as a void*

ref_
MappedFile ref_()

Increments the reference count of file by one. It is safe to call this function from any thread.

unref
void unref()

Decrements the reference count of file by one. If the reference count drops to 0, unmaps the buffer of file and frees it.

Variables

gMappedFile
GMappedFile* gMappedFile;

the main Gtk struct