A rather simple text file reader and writer.
| TNString | The string-type. This may also be a type derived from NString which contains further fields available with each line of the file. |
| TAllocator | The allocator type to use. |
Definition at line 88 of file ALib.Files.TextFile.H.
#include <ALib.Files.TextFile.H>
Public Type Index: | |
| using | AllocatorType = TAllocator |
| Type definition publishing template parameter TAllocator. | |
| using | StoredType = TNString |
| using | Vector = StdVectorMA<TNString> |
| Type definition publishing the base container type. | |
Public Type Index: inherited from alib::lang::AllocatorMember< MonoAllocator > | |
| using | AllocatorType |
| Exposes the allocator type. | |
Public Method Index: | |
| TTextFile (MonoAllocator &ma) | |
| template<typename TIntegral> | |
| constexpr const StoredType & | At (TIntegral idx) const noexcept |
| template<typename TIntegral> | |
| constexpr StoredType & | At (TIntegral idx) noexcept |
| system::SystemErrors | Read (const CString &filePath) |
| system::SystemErrors | Read (files::File file) |
| constexpr integer | Size () const noexcept |
| ALIB_DLL system::SystemErrors | Write (const String &filePath) |
Public Method Index: inherited from alib::lang::AllocatorMember< MonoAllocator > | |
| AllocatorMember () | |
| AllocatorMember (MonoAllocator &pAllocator) noexcept | |
| AllocatorInterface< MonoAllocator > | AI () const noexcept |
| MonoAllocator & | GetAllocator () const noexcept |
Protected Field Index: | |
| MonoAllocator & | allocator |
| The given allocator. | |
Protected Field Index: inherited from alib::lang::AllocatorMember< MonoAllocator > | |
| MonoAllocator * | allocator |
| The allocator stored. | |
| using alib::files::TTextFile< TNString, TAllocator >::AllocatorType = TAllocator |
Type definition publishing template parameter TAllocator.
Definition at line 97 of file ALib.Files.TextFile.H.
| using alib::files::TTextFile< TNString, TAllocator >::StoredType = TNString |
Type definition publishing the type in the std::vector that this type is derived of. (As is defined with template parameter TNString.)
Definition at line 102 of file ALib.Files.TextFile.H.
| using alib::files::TTextFile< TNString, TAllocator >::Vector = StdVectorMA<TNString> |
Type definition publishing the base container type.
Definition at line 105 of file ALib.Files.TextFile.H.
|
protected |
The given allocator.
Definition at line 93 of file ALib.Files.TextFile.H.
|
inline |
Constructor.
| ma | The allocator to use. |
Definition at line 109 of file ALib.Files.TextFile.H.
|
inlineconstexprnoexcept |
const-version of At.
| TIntegral | The integral type that the index is provided by. |
| idx | The index to retrieve an element for. |
const reference to the element stored at the given idx. Definition at line 136 of file ALib.Files.TextFile.H.
|
inlineconstexprnoexcept |
Returns the element in the vector at the given position.
Note that this is the same as calling inherited std::vector::at(), but this method accepts any integral type for parameter idx.
Furthermore, this method raises an ALib Assertion in debug-builds, instead of throwing an exception.
| TIntegral | The integral type that the index is provided by. |
| idx | The index to retrieve an element for. |
Definition at line 128 of file ALib.Files.TextFile.H.
|
inline |
Reads the file into this vector of lines.
| filePath | The path of the file. |
Definition at line 142 of file ALib.Files.TextFile.H.
|
inline |
Reads the file into this vector of lines.
| file | The file to read. |
Definition at line 160 of file ALib.Files.TextFile.H.
|
inlineconstexprnoexcept |
Returns the vector's size as ALib's signed integral type.
Definition at line 116 of file ALib.Files.TextFile.H.
|
inline |
Writes this text file to the given filePath.
| filePath | The path of the file. |
Definition at line 171 of file ALib.Files.TextFile.H.