libkeepass
0.2.0
KeePass key database importer/exporter library
Loading...
Searching...
No Matches
visitor.hh
Go to the documentation of this file.
1
/*
2
* libkeepass - KeePass key database importer/exporter
3
* Copyright (C) 2014 Christian Kindahl
4
* Copyright (C) 2024 Dominik Krümpelmann
5
*
6
* This program is free software: you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation, either version 3 of the License, or
9
* (at your option) any later version.
10
*
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with this program. If not, see <http://www.gnu.org/licenses/>.
18
*/
19
25
#pragma once
26
#include <iosfwd>
27
28
#include "
libkeepass/export.hh
"
29
30
namespace
keepass {
31
32
class
Entry;
33
class
Group;
34
42
class
LIBKEEPASS_API
Visitor
{
43
public
:
44
virtual
~Visitor
() =
default
;
45
47
virtual
void
Visit
(
Group
& group);
48
50
virtual
void
Visit
(
Entry
& entry);
51
};
52
56
class
LIBKEEPASS_API
PrintVisitor
:
public
Visitor
{
57
public
:
59
explicit
PrintVisitor
(std::ostream& os) : os_(os) {}
60
61
void
Visit
(
Group
& group)
override
;
62
void
Visit
(
Entry
& entry)
override
;
63
64
private
:
65
std::ostream& os_;
66
};
67
69
73
LIBKEEPASS_API
void
Visit
(
Group
& group,
Visitor
& visitor);
74
75
}
// namespace keepass
keepass::Entry
A single KeePass entry (a username/password record).
Definition
entry.hh:55
keepass::Group
A KeePass group (a folder) that contains entries and subgroups.
Definition
group.hh:45
keepass::PrintVisitor
Visitor that prints the path of every group and entry to a stream.
Definition
visitor.hh:56
keepass::PrintVisitor::Visit
void Visit(Group &group) override
Called for every group during traversal.
keepass::PrintVisitor::Visit
void Visit(Entry &entry) override
Called for every entry during traversal.
keepass::PrintVisitor::PrintVisitor
PrintVisitor(std::ostream &os)
Creates a visitor that writes to the given output stream.
Definition
visitor.hh:59
keepass::Visitor
Visitor pattern over a KeePass group/entry tree.
Definition
visitor.hh:42
keepass::Visitor::Visit
virtual void Visit(Entry &entry)
Called for every entry during traversal.
keepass::Visitor::Visit
virtual void Visit(Group &group)
Called for every group during traversal.
export.hh
Visibility/export macro for the shared library.
LIBKEEPASS_API
#define LIBKEEPASS_API
Marks a class, function or variable as part of the public ABI.
Definition
export.hh:43
keepass::Visit
LIBKEEPASS_API void Visit(Group &group, Visitor &visitor)
Traverses the tree rooted at the given group, visiting every group and entry.
src
include
libkeepass
visitor.hh
Generated by
1.9.8