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