Represents the parsed contents of a password file.
More...
#include <filecontent.h>
|
| static auto | parse (const QString &fileContent, const QStringList &templateFields, bool allFields) -> FileContent |
| | parse parses the given fileContent in a FileContent object. The password is accessible through getPassword. The named value pairs (name: value) are parsed and depeding on the templateFields and allFields parameters accessible through getNamedValues, getRemainingData or getRemainingDataForDisplay.
|
Represents the parsed contents of a password file.
Splits the file into a password line, named key/value fields, and remaining data. Use FileContent::parse to construct an instance.
Definition at line 57 of file filecontent.h.
◆ getNamedValues()
| auto FileContent::getNamedValues |
( |
| ) |
const -> NamedValues |
|
nodiscard |
- Returns
- the named values in the file in the order of appearence, with template values first.
◆ getPassword()
| auto FileContent::getPassword |
( |
| ) |
const -> QString |
|
nodiscard |
- Returns
- the password from the parsed file.
◆ getRemainingData()
| auto FileContent::getRemainingData |
( |
| ) |
const -> QString |
|
nodiscard |
- Returns
- the data that is not the password and not in getNamedValues.
◆ getRemainingDataForDisplay()
| auto FileContent::getRemainingDataForDisplay |
( |
| ) |
const -> QString |
|
nodiscard |
Like getRemainingData but without data that should not be displayed (like a TOTP secret).
- Returns
- Remaining data string safe for display.
◆ parse()
| auto FileContent::parse |
( |
const QString & | fileContent, |
|
|
const QStringList & | templateFields, |
|
|
bool | allFields ) -> FileContent |
|
static |
parse parses the given fileContent in a FileContent object. The password is accessible through getPassword. The named value pairs (name: value) are parsed and depeding on the templateFields and allFields parameters accessible through getNamedValues, getRemainingData or getRemainingDataForDisplay.
- Parameters
-
| fileContent | the file content to parse. |
| templateFields | the fields in the template. Fields in the template will always be in getNamedValues() at the beginning of the list in the same order. |
| allFields | whether all fields should be considered as named values. If set to false only templateFields are returned in getNamedValues(). |
- Returns
- A FileContent instance with password, named values, and remaining data populated from the parsed input.
The documentation for this class was generated from the following file: