Passwordfile library
5.0.12
C++ library to read/write passwords from/to encrypted files
Loading...
Searching...
No Matches
io
field.h
Go to the documentation of this file.
1
#ifndef PASSWORD_FILE_IO_FIELD_H
2
#define PASSWORD_FILE_IO_FIELD_H
3
4
#include "
../global.h
"
5
6
#include <iostream>
7
#include <string>
8
9
namespace
Io
{
10
11
enum class
FieldType
:
int
{
Normal
,
Password
};
12
13
class
AccountEntry;
14
15
class
PASSWORD_FILE_EXPORT
Field
{
16
public
:
17
Field
();
18
Field
(
AccountEntry
*tiedAccount,
const
std::string &name = std::string(),
const
std::string &value = std::string());
19
Field
(
AccountEntry
*tiedAccount, std::istream &stream);
20
21
bool
isEmpty()
const
;
22
const
std::string &name()
const
;
23
void
setName(
const
std::string &name);
24
const
std::string &value()
const
;
25
void
setValue(
const
std::string &value);
26
FieldType
type()
const
;
27
void
setType(
FieldType
type);
28
AccountEntry
*tiedAccount()
const
;
29
void
make(std::ostream &stream)
const
;
30
static
bool
isValidType(
int
number);
31
32
private
:
33
std::string m_name;
34
std::string m_value;
35
FieldType
m_type;
36
AccountEntry
*m_tiedAccount;
37
38
protected
:
39
std::string
m_extendedData
;
40
};
41
42
inline
Field::Field
()
43
: m_type(
FieldType
::
Normal
)
44
, m_tiedAccount(nullptr)
45
{
46
}
47
51
inline
bool
Field::isEmpty
()
const
52
{
53
return
m_name.empty() && m_value.empty();
54
}
55
59
inline
const
std::string &
Field::name
()
const
60
{
61
return
m_name;
62
}
63
67
inline
void
Field::setName
(
const
std::string &name)
68
{
69
m_name =
name
;
70
}
71
75
inline
const
std::string &
Field::value
()
const
76
{
77
return
m_value;
78
}
79
83
inline
void
Field::setValue
(
const
std::string &value)
84
{
85
m_value =
value
;
86
}
87
91
inline
FieldType
Field::type
()
const
92
{
93
return
m_type;
94
}
95
99
inline
void
Field::setType
(
FieldType
type)
100
{
101
m_type =
type
;
102
}
103
107
inline
AccountEntry
*
Field::tiedAccount
()
const
108
{
109
return
m_tiedAccount;
110
}
111
115
inline
bool
Field::isValidType
(
int
number)
116
{
117
return
number >= 0 && number <= 1;
118
}
119
}
// namespace Io
120
121
#endif
// PASSWORD_FILE_IO_FIELD_H
Io::AccountEntry
The exception that is thrown when a parsing error occurs.
Definition
entry.h:170
Io::Field
The Field class holds field information which consists of a name and a value and is able to serialize...
Definition
field.h:15
Io::Field::setName
void setName(const std::string &name)
Sets the name.
Definition
field.h:67
Io::Field::setValue
void setValue(const std::string &value)
Sets the value.
Definition
field.h:83
Io::Field::name
const std::string & name() const
Returns the name.
Definition
field.h:59
Io::Field::Field
Field()
Definition
field.h:42
Io::Field::isValidType
static bool isValidType(int number)
Returns whether the specified number is a valid field type.
Definition
field.h:115
Io::Field::value
const std::string & value() const
Returns the value.
Definition
field.h:75
Io::Field::setType
void setType(FieldType type)
Sets the type.
Definition
field.h:99
Io::Field::isEmpty
bool isEmpty() const
Returns an indication whether the entry is empty.
Definition
field.h:51
Io::Field::type
FieldType type() const
Returns the type.
Definition
field.h:91
Io::Field::tiedAccount
AccountEntry * tiedAccount() const
Returns the tied account.
Definition
field.h:107
Io::Field::m_extendedData
std::string m_extendedData
Definition
field.h:39
global.h
PASSWORD_FILE_EXPORT
#define PASSWORD_FILE_EXPORT
Marks the symbol to be exported by the passwordfile library.
Definition
global.h:14
Io
Contains all IO related classes.
Definition
cryptoexception.h:9
Io::FieldType
FieldType
Definition
field.h:11
Io::FieldType::Normal
@ Normal
Io::FieldType::Password
@ Password
Generated on Tue Aug 6 2024 22:26:30 for Passwordfile library by
1.11.0