[#BloombergLP-balst-Resolver_FileHelper] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/balst.adoc[balst]::Resolver_FileHelper :relfileprefix: ../../ :mrdocs: This class provides a low‐level file utility functions for `Resolver<Elf>`. This class contains the file descriptor of current object file. Note that the file is opened readonly, and all reads specify the offset, so the offset of the file descriptor is not considered part of the state of this object. == Synopsis Declared in `<balst_resolver_filehelper.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class Resolver_FileHelper; ---- == Type Aliases [cols="1"] |=== | Name | xref:BloombergLP/balst/Resolver_FileHelper/Offset.adoc[`Offset`] |=== == Enums [cols="1,4"] |=== | Name| Description | xref:BloombergLP/balst/Resolver_FileHelper/_04enum.adoc[`Unnamed enum`] | length in bytes of d_buffer_p; 32K minus a little so we don't waste a page |=== == Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/balst/Resolver_FileHelper/2constructor.adoc[`Resolver_FileHelper`] [.small]#[constructor]# | Create a file helper object in an invalid state. | xref:BloombergLP/balst/Resolver_FileHelper/fileSize.adoc[`fileSize`] | The size of the open file or mapped segment. | xref:BloombergLP/balst/Resolver_FileHelper/loadString.adoc[`loadString`] | Read a null‐terminated string from `offset` in the file or mapped file into `writeSpan` and return a `string_view` to the string. If we run out of room in `writeSpan`, reach end of file, or reach end of mapped area, return a non‐null‐terminated `string_view`. The behavior is undefined unless `!outSpan.empty()` and `offset >= 0`. Note that the returned `string_view` never contains the terminating `0`. | xref:BloombergLP/balst/Resolver_FileHelper/openFile.adoc[`openFile`] | Open the file referred to by the specified `fileName` for read‐only access, and if it opens successfully, set `d_reader` to a `FileReader` type and bind it to the opened file. Return 0 on success and a non‐zero value otherwise. | xref:BloombergLP/balst/Resolver_FileHelper/openMappedFile.adoc[`openMappedFile`] | Open this object to access the memory referred to by the specified `mappedFile` as if it were a disk file. Return 0 on success and a non‐zero value otherwise. | xref:BloombergLP/balst/Resolver_FileHelper/readBytes.adoc[`readBytes`] | Read into the specified `outSpan` up to the specified `outSpan.size()` of data starting at the specified `offset` in the current ELF file. Return a span referring to the section of `outSpan` containing, which can be empty. The behavior is undefined unless `!outSpan.empty()` and `offset >= 0`. | xref:BloombergLP/balst/Resolver_FileHelper/readExact.adoc[`readExact`] | Read into the specified `outSpan` exactly the specified `outSpan.size()` bytes of data starting at the specified `offset` in the current ELF file. Return 0 on success, or a negative value otherwise. The behavior is undefined unless `!outSpan.empty()` and `offset >= 0`. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#