Logic for reading or writing to a file as well as navigating filesystems or other common file operations.
More...
|
| | File () |
| | Default constructor.
|
| | File (const File &file) |
| | Copy constructor.
|
| | File (const String &full_path) |
| | Constructs a File from a full path string.
|
| | File (const String &resource_name, const String &path_id) |
| | Constructs a File from a resource name and path identifier.
|
| | File (const StringView &full_path) |
| | Constructs a File from a StringView of a full path.
|
| | File (File &&file) noexcept |
| | Move constructor.
|
| | File (String &&full_path) |
| | Constructs a File by moving a path string.
|
| | ~File () |
| | Destructor.
|
| File & | append (const char &s) |
| | Appends a single character to the file path.
|
| File & | append (const StringView &s) |
| | Appends a string to the file path.
|
| File & | appendPath (const char *cs) |
| | Appends a path component to this file path.
|
| File & | appendPath (const String &cs) |
| | Appends a path component to this file path.
|
| File & | appendPath (const StringView &cs) |
| | Appends a path component to this file path.
|
| uint08 | availableDiskSpace (bool privelaged=true) const |
| | Queries the available disk space on the drive containing this file.
|
| bool | cachedExist () const |
| | Checks whether the file exists using cached data rather than querying the filesystem.
|
|
void | close () |
| | Closes the file if it is open.
|
| bool | copyTo (const File &cs, bool override_file, LogPtr log=LogPtr()) const |
| | Copies this file to a destination.
|
| void | create (bool override_file) const |
| | Creates the file or directory on disk.
|
| const FileCachedData & | currentCache () const |
| | Returns the current cached file metadata.
|
| void | deleteFile (LogPtr log=LogPtr()) |
| | Deletes this file from disk.
|
| bool | exists () const |
| | Checks whether this file or directory exists on disk.
|
|
void | expandEnvironmentalVars () |
| | Expands any environment variables present in the file path.
|
| FILE * | filePtr () const |
| | Returns the underlying C FILE pointer for this file.
|
| uint08 | fileSize () const |
| | Gets the size of the file in bytes.
|
| File | findNonExistingSuitableName () const |
| | Generates a unique file name based on this path that does not conflict with existing files.
|
|
void | flush () |
| | Flushes any buffered data to disk.
|
| File | generateTempFile () const |
| | Generates a temporary file path derived from this file's directory.
|
| Time | getAccessTime () const |
| | Gets the last access time of the file.
|
| FileBuffer | getChildren () const |
| | Retrieves all direct children of this directory.
|
| FileBuffer | getChildrenMatching (const Buffer< String > &include_patterns, bool recursive=false, uint04 max_count=Constant< uint04 >::Max) const |
| | Retrieves children of this directory matching any of the given patterns.
|
| FileBuffer | getChildrenMatching (const Buffer< String > &include_patterns, const Buffer< String > &exclude_patterns, bool recursive=false, uint04 max_count=Constant< uint04 >::Max) const |
| | Retrieves children matching include patterns while excluding others.
|
| FileBuffer | getChildrenMatching (const Buffer< StringView > &include_patterns, bool recursive=false, uint04 max_count=Constant< uint04 >::Max) const |
| | Retrieves children of this directory matching any of the given StringView patterns.
|
| FileBuffer | getChildrenMatching (const Buffer< StringView > &include_patterns, const Buffer< StringView > &exclude_patterns, bool recursive=false, uint04 max_count=Constant< uint04 >::Max) const |
| | Retrieves children matching include patterns while excluding others, using StringView patterns.
|
| FileBuffer | getChildrenMatching (const StringView &include_pattern, bool recursive=false, uint04 max_count=Constant< uint04 >::Max) const |
| | Retrieves children of this directory matching a pattern.
|
| Time | getCreationTime () const |
| | Gets the creation time of the file.
|
| Buffer< uint01 > | getData () |
| | Reads the entire file contents into a byte buffer.
|
| HighCapacityBuffer< uint01 > | getDataExtended () |
| | Reads the entire file contents into a high-capacity byte buffer for large files.
|
| String | getDriveDescription () const |
| | Retrieves a human-readable description of the drive this file resides on.
|
| void | getFileTimes (Time &modified_time, Time &creation_time, Time &access_time) const |
| | Retrieves all three file timestamps at once.
|
| StringView | getFolderName (bool trailing_mark=false) const |
| | Retrieves the folder name portion of the file path.
|
| Time | getModifiedTime () const |
| | Gets the last modified time of the file.
|
| File | getParentDirectory () const |
| | Gets the parent directory of this file.
|
| StringView | getPath (uint01 file_parts) const |
| | Retrieves a subset of the file path based on the specified parts.
|
| UUID | getUUID () const |
| | Gets a UUID that uniquely identifies this file on the filesystem.
|
| bool | hasNullBytes (uint08 max_length=Constant< uint08 >::Max) |
| | Checks whether the file contains null bytes within the specified range.
|
|
void | invalidateCache () |
| | Invalidates the cached file metadata, forcing a refresh on next access.
|
| bool | isDirectory () const |
| | Checks whether this path refers to a directory.
|
| bool | isDrive () const |
| | Checks whether this path refers to a drive root.
|
| bool | isHidden () const |
| | Checks whether this file is hidden.
|
| bool | isMTP () const |
| | Checks whether this file path refers to an MTP (Media Transfer Protocol) device.
|
| bool | isOpen () const |
| | Checks whether this file is currently open.
|
| void | makeReadOnly (bool read_only) |
| | Sets or clears the read-only attribute on this file.
|
| bool | moveTo (File &file, bool override_file, LogPtr log=LogPtr(), bool is_source_temp=false) |
| | Moves this file to a new location.
|
| FILE * | open (OpenMode mode, bool append=false) |
| | Opens the file with the specified mode.
|
| size_t | operator() () const |
| | Functor operator for use as a hash key in standard containers.
|
| bool | operator<< (const Buffer< uint01 > &values) |
| | Writes a byte buffer to the file.
|
| bool | operator<< (const fltp04 &value) |
| | Writes a 32-bit floating-point value to the file.
|
| bool | operator<< (const fltp08 &value) |
| | Writes a 64-bit floating-point value to the file.
|
| bool | operator<< (const HighCapacityBuffer< uint01 > &values) |
| | Writes a high-capacity byte buffer to the file.
|
| bool | operator<< (const StringView &value) |
| | Writes a string to the file.
|
| File & | operator= (const File &value) |
| | Copy assignment operator.
|
| File & | operator= (File &&value) noexcept |
| | Move assignment operator.
|
| File & | operator= (String &value) |
| | Assignment operator from a String reference.
|
| bool | parentDirectoryExists () const |
| | Checks whether the parent directory of this file exists.
|
| const String & | pathID () const |
| | Gets the path identifier string for this file.
|
| StringView | pathNameID () const |
| | Gets a combined path and name identifier for this file.
|
| String | relativePathTo (const File &reference) const |
| | Computes the relative path from this file to a reference file.
|
|
void | removeInvalidChars () |
| | Removes characters from the path that are invalid for the current filesystem.
|
|
void | removeOpenOwnership () |
| | Releases ownership of the open file handle without closing it.
|
| bool | resolveMTPPath () const |
| | Resolves the actual filesystem path from an MTP device path.
|
| bool | resolveNameFromMTPPath () |
| | Resolves the display name from an MTP device path.
|
| void | setFolderName (const StringView &folder_name) |
| | Sets the folder name portion of the file path.
|
| void | setFromDisplayString (const StringView &display_string) |
| | Sets this file path from a user-friendly display string.
|
|
void | setInternalVars () |
| | Recalculates internal cached path component indices from the current path string.
|
| void | setPath (const StringView &path, uint01 part) |
| | Sets a specific part of the file path.
|
|
void | throwIfNotExist () const |
| | Throws an exception if this file does not exist.
|
| String | toDisplayString () |
| | Converts this file path to a user-friendly display string.
|
| bool | updateAccessedTime () const |
| | Updates the last accessed time of the file to the current time.
|
| bool | updateAccessedTime (Time access_time) const |
| | Updates the last accessed time of the file to a specific time.
|
|
void | updateCache () const |
| | Updates the cached file metadata from the filesystem.
|
| void | updateCache (const FileCachedData &cache) |
| | Updates the cached file metadata with the provided data.
|
|
constexpr | String () noexcept |
| | Constructor used to create an empty String*.
|
| constexpr | String (const char *const string, uint04 size) |
| | String Constructor char arrays when the size is known.
|
| | String (const char *string) |
| | String Constructor for null terminated array of chars.
|
| template<std::size_t N> |
| constexpr | String (const char(&string)[N]) |
| | String Constructor for static char arrays.
|
|
constexpr | String (const String &string) |
| | Copy Constructor.
|
| constexpr | String (const StringView &string) |
| | Constructor for string view.
|
| template<class t_type> |
| | String (const t_type &value) |
| | String Constructor that creates a string based off an object.
|
| template<std::size_t N> |
| | String (const wchar(&string)[N]) |
| | String Constructor for static wchar arrays of UTF16 data.
|
|
constexpr | String (String &&string) noexcept |
| | Move contructor (No new memory allocation).
|
| constexpr | String (uint04 size, const char &value) |
| | String Constructor creates a string of a size and fills it with a character.
|
| void | addUTF16AsUTF8 (const wchar *unicode) |
| | Converts a unicode null terminated string of UTF16 wchars into UTF8 and appends it to the end of the String.
|
| bool | addUTF16CharAsUTF8 (const wchar *unicode, uint04 &advance) |
| | Converts a single unicode character at advance into UTF8 and appends it to the end of the String.
|
| void | addWChar (const wchar &object) |
| | Converts a single unicode character UTF16 character into one or more UTF8 characters and appends them to the end of this String.
|
| String & | addWhiteSpace (uint04 desired_string_size, uint04 desired_right_alignment_location=0, char whitespace=' ') |
| | Used for formatting, will, if necessary, add white space so that the string becomes a certain length.
|
| String & | append (char value) |
| | Appends an object to the back of this string.
|
| String & | append (const char *value) |
| | Appends a string to the back of this string.
|
| template<size_t t_size> |
| String & | append (const char(&value)[t_size]) |
| | Appends a string to the back of this string.
|
| String & | append (const StringView &string) |
| | Appends a string to the back of this string.
|
| template<class t_type> |
| String & | append (const t_type &value) |
| | Appends a string to the back of this string.
|
| String & | append (const wchar *value) |
| | Appends a string to the back of this string.
|
| String & | append (const wchar value) |
| | Appends a wchar utf16 to the back of this string as utf8.
|
| template<size_t t_size> |
| String & | append (const wchar(&value)[t_size]) |
| | Appends a string to the back of this string.
|
| bool | beginsWith (const StringView &s, bool ignore_case=false) const |
| | Tests if this String starts with the specified prefix.
|
| constexpr const char * | c_str () const |
| | Used to access the raw memory of this string.
|
| bool | endsWith (const StringView &s, bool ignore_case=false) const |
| | Tests if this String ends with the specified suffix.
|
| String & | formatNumberString (bool add_comma, uint04 decimals) |
| | For a string representing a number, makes the decimals equal to the the provided value and adds comma seperators if number is large enough.
|
| String & | formatNumberString (bool add_comma, uint04 min_decimals, uint04 max_decimals, uint04 min_digits, char decimal='.', char comma=',') |
| | Modifies the contents of this string, that represents a given number using the provided rules.
|
| String & | formatNumberString (uint04 decimals) |
| | For a string representing a number, makes the decimals equal to the the provided value Example: String("1000000").formatNumberString(2); will make "1000000.00".
|
| uint04 | fromHex () const |
| | Converts a hex value into an unsigned 4 byte number.
|
| template<class t_type> |
| decltype(auto) | getAs () const |
| | Converts a string into an object.
|
| constexpr uint08 | hash () const |
| | Creates a simple, quick hash of the object.
|
| uint08 | hashLower () const |
| | Creates a simple, quick hash of the object.
|
| uint08 | hashUpper () const |
| | Creates a simple, quick hash of the object.
|
| bool | hasSubString (const StringView &sub_string, bool ignore_case=false, uint04 start_idx=0) const |
| | Tests if this String contains the specified substring.
|
| uint04 | indexOf (const char &sub_string) const |
| | Given a substring specified by the input, returns the first index of that string, if it exists.
|
| uint04 | indexOf (const char &sub_string, uint04 start_pos) const |
| | Given a substring specified by the input, returns the first index of that string, if it exists.
|
| uint04 | indexOf (const char &sub_string, uint04 start_pos, uint04 size) const |
| | Given a substring specified by the input, returns the first index of that string, if it exists.
|
| uint04 | indexOf (const char *sub_string, bool ignore_case, uint04 start_index, uint04 size) const |
| | Given a substring specified by the input, returns the first index of that string, if it exists.
|
| uint04 | indexOf (const char *sub_string, bool ignore_case=false, uint04 start_index=0) const |
| | Given a substring specified by the input, returns the first index of that string, if it exists.
|
| uint04 | indexOf (const char *sub_string, char escape_char, bool ignore_case=false, uint04 start_index=0) const |
| | Given a substring specified by the input, returns the first index of that string, if it exists.
|
| uint04 | indexOf (const String &sub_string, bool ignore_case=false, uint04 start_index=0) const |
| | Given a substring specified by the input, returns the first index of that string, if it exists.
|
| uint04 | indexOf (const StringView &sub_string, bool ignore_case=false, uint04 start_index=0) const |
| | Given a substring specified by the input, returns the first index of that string, if it exists.
|
| String | insertNewLines (uint04 max_line_size) const |
| | Finds key areas to insert new lines such that the rows are at most, the length provided.
|
| bool | isNumeric () const |
| | Checks to see if the string is a numeric string.
|
| bool | isSameNoCase (const StringView &s) const |
| | Checks whether two strings match in a case-insensitive way.
|
| uint04 | lastIndexOf (const char *sub_string, bool ignore_case=false) const |
| | Given a substring specified by the input, returns the last index of that string, if it exists.
|
| uint04 | lastIndexOf (const char value, bool ignore_case=false) const |
| | Given a value specified by the input, returns the last index of that char, if it exists.
|
| uint04 | lastIndexOf (const StringView &sub_string, bool ignore_case=false) const |
| | Given a substring specified by the input, returns the last index of that string, if it exists.
|
| bool | matchesWildcard (const StringView &pattern) const |
| | Checks whether two strings match allowing '' to be used as a wildcard pattern.
|
| String | predictNextStringIncrement () const |
| | Looks in the string for key markers that might be an index, and attempts to increment the index.
|
| String & | removeNonAlphaNumeric (bool remove_tab=true, bool remove_space=true, bool remove_new_line=true, bool remove_r=true, bool remove_numbers=false) |
| | Removes any characters that aren't numbers or letters with other options available.
|
| String & | removeNonNumeric () |
| | Removes anything that is not a number or decimal ('0'-'9' or .).
|
| String & | replace (const StringView &sub_string, const StringView &replace_sub_string, bool ignore_case=false, uint04 start_index=0) |
| | Replaces ALL instances of a given substring with the provided replacement.
|
| String & | replace (const StringViewBuffer &sub_string, const StringBuffer &replace_sub_string, bool ignore_case=false, uint04 start_index=0) |
| | Replaces ALL instances of the given substrings with the provided replacements.
|
| String & | replace (const StringViewBuffer &sub_string, const StringViewBuffer &replace_sub_string, bool ignore_case=false, uint04 start_index=0) |
| | Replaces ALL instances of the given substrings with the provided replacements.
|
| StringAllocatingView | shortenString (uint04 size) const |
| | Shortens the string to the max size provided.
|
| StringViewBuffer | split (char delimiter, bool preserve_empty=true) const |
| | Given a delimiter, breaks the string into subsections, returning an array of each subsection.
|
| StringViewBuffer | split (const Buffer< char > &delimiter, bool preserve_empty=true) const |
| | Given multiple delimiter, breaks the string into subsections, returning an array of each subsection.
|
| void | splitString (char delimiter, StringViewBuffer &strings, bool preserve_empty=true) const |
| | Given multiple delimiter, breaks the string into subsections, and APPENDS each substring to the given Buffer.
|
| void | splitString (const Buffer< char > &delimiter, StringViewBuffer &strings, bool preserve_empty=true) const |
| | Given multiple delimiter, breaks the string into subsections, and APPENDS each substring to the given Buffer.
|
| StringView | substr (uint04 start) const |
| | Creates a substring from a given start position, to the end of the string.
|
| StringView | substr (uint04 start, uint04 end) const |
| | Creates a substring from a given start position, to the given end position, non-inclusive of the end index.
|
| StringAllocatingView | toLower () const |
| | changes all upper case characters into lower case characters.
|
| String | toTitleString () const |
| | Formats the string to be a title, capitalizing important characters and replacing underscores with spaces.
|
| StringAllocatingView | toUpper () const |
| | changes all lower case characters into upper case characters.
|
| String & | trimWhiteSpace () |
| | Trims any white space (tabs, spaces, etc) from the beginning and end of the string.
|
|
constexpr | Buffer () noexcept |
| | Creates an empty buffer.
|
| | ~Buffer () |
| void | add (char &&object) |
| | Adds object to the end of the buffer.
|
| void | addSpace (t_index_type space_to_add) |
| | Adds a space to the end of the buffer.
|
| operator decltype | auto () const |
| | Gets the first location of type* in the array.
|
| sint04 | compare (const Buffer &value) const |
| | Compares this Buffer to another to determine their relative ordering.
|
| Buffer< t_other_type, t_other_memory_manager > | getAs () const |
| | Gets a copy of this buffer, with filled objects t_other_type, where all objects are created using the contents of this buffer.
|
| void | insert (t_index_type location, const char &object) |
| | Adds an object to a specific location.
|
| void | removeAllOrdered (const char &object) |
| | Removes all instances of the object.
|
| void | removeAllOrderedFn (const t_functor &functor) |
| | Removes all items based on the functor.
|
| void | removeAllUnordered (const char &object) |
| | Removes all unordered described by object.
|