47 std::array<uint8_t, 16> uuid_;
49 std::weak_ptr<Icon> custom_icon_;
50 std::weak_ptr<Group> parent_;
54 std::optional<std::array<uint8_t, 16>> previous_parent_group_;
55 std::time_t creation_time_ = 0;
56 std::time_t modification_time_ = 0;
57 std::time_t access_time_ = 0;
58 std::time_t expiry_time_ = 0;
59 std::time_t move_time_ = 0;
61 bool expires_ =
false;
62 bool expanded_ =
false;
63 uint32_t usage_count_ = 0;
64 std::string default_autotype_sequence_;
65 bool autotype_ =
false;
67 std::weak_ptr<Entry> last_visible_entry_;
69 std::vector<std::shared_ptr<Group>> groups_;
70 std::vector<std::shared_ptr<Entry>> entries_;
77 const std::array<uint8_t, 16>&
uuid()
const {
return uuid_; }
80 void set_uuid(
const std::array<uint8_t, 16>& uuid) { uuid_ = uuid; }
83 uint32_t
icon()
const {
return icon_; }
86 void set_icon(
const uint32_t& icon) { icon_ = icon; }
89 std::weak_ptr<Icon>
custom_icon()
const {
return custom_icon_; }
92 void set_custom_icon(std::weak_ptr<Icon> icon) { custom_icon_ = std::move(icon); }
95 const std::string&
name()
const {
return name_; }
98 void set_name(
const std::string& name) { name_ = name; }
101 const std::string&
notes()
const {
return notes_; }
104 void set_notes(
const std::string& notes) { notes_ = notes; }
107 const std::string&
tags()
const {
return tags_; }
110 void set_tags(
const std::string& tags) { tags_ = tags; }
114 return previous_parent_group_;
120 previous_parent_group_ = uuid;
154 uint16_t
flags()
const {
return flags_; }
157 void set_flags(
const uint16_t& flags) { flags_ = flags; }
182 default_autotype_sequence_ = std::move(sequence);
202 last_visible_entry_ = std::move(entry);
206 const std::vector<std::shared_ptr<Group>>&
Groups()
const;
209 const std::vector<std::shared_ptr<Entry>>&
Entries()
const;
212 std::weak_ptr<Group>
parent()
const {
return parent_; }
215 void set_parent(std::weak_ptr<Group> parent) { parent_ = std::move(parent); }
238 std::vector<std::shared_ptr<Entry>>
FindEntries(
const std::string& query,
bool regex =
false,
239 bool recursive =
true)
const;
250 std::vector<std::shared_ptr<Group>>
FindGroups(
const std::string& query,
bool regex =
false,
251 bool recursive =
true)
const;
254 void AddGroup(
const std::shared_ptr<Group>& group);
260 void AddEntry(
const std::shared_ptr<Entry>& entry);
270 std::string
ToJson(
bool include_attachments =
false)
const;
A KeePass group (a folder) that contains entries and subgroups.
Definition group.hh:45
const std::array< uint8_t, 16 > & uuid() const
Returns the group's unique identifier (UUID).
Definition group.hh:77
void RemoveGroup(const std::shared_ptr< Group > &group)
Removes a subgroup from this group.
std::weak_ptr< Entry > last_visible_entry() const
Returns a weak reference to the last visible entry.
Definition group.hh:198
void set_usage_count(uint32_t usage_count)
Sets the usage count.
Definition group.hh:175
void set_search(bool search)
Sets whether search is enabled for this group.
Definition group.hh:195
void set_default_autotype_sequence(std::string sequence)
Sets the default auto-type sequence.
Definition group.hh:181
void set_previous_parent_group(const std::optional< std::array< uint8_t, 16 > > &uuid)
Definition group.hh:119
std::weak_ptr< Group > parent() const
Returns the parent group (empty if this is the root group).
Definition group.hh:212
bool expires() const
Returns whether the group expires.
Definition group.hh:160
const std::string & tags() const
Returns the tags (space-separated).
Definition group.hh:107
std::string path() const
Returns the full path of this group from the database root.
const std::string & notes() const
Returns the group notes.
Definition group.hh:101
void set_creation_time(const std::time_t &time)
Sets the creation time.
Definition group.hh:127
void AddEntry(const std::shared_ptr< Entry > &entry)
Adds an entry to this group.
std::time_t access_time() const
Returns the last access time.
Definition group.hh:136
void set_uuid(const std::array< uint8_t, 16 > &uuid)
Sets the group's unique identifier (UUID).
Definition group.hh:80
bool is_root_group() const
Returns whether this group is the root group.
Definition group.hh:218
void set_autotype(bool autotype)
Sets whether auto-type is enabled for this group.
Definition group.hh:189
void set_expiry_time(const std::time_t &time)
Sets the expiry time.
Definition group.hh:145
bool autotype() const
Returns whether auto-type is enabled for this group.
Definition group.hh:186
const std::vector< std::shared_ptr< Group > > & Groups() const
Returns the list of subgroups.
const std::vector< std::shared_ptr< Entry > > & Entries() const
Returns the list of entries in this group.
void set_access_time(const std::time_t &time)
Sets the last access time.
Definition group.hh:139
bool search() const
Returns whether search is enabled for this group.
Definition group.hh:192
void set_parent(std::weak_ptr< Group > parent)
Sets the parent group.
Definition group.hh:215
void set_modification_time(const std::time_t &time)
Sets the last modification time.
Definition group.hh:133
bool HasNonMetaEntries() const
Returns whether the group contains any non-metadata entries.
size_t entries_count() const
Returns the number of entries directly contained in this group.
Definition group.hh:224
std::time_t creation_time() const
Returns the creation time.
Definition group.hh:124
size_t groups_count() const
Returns the number of subgroups directly contained in this group.
Definition group.hh:227
std::time_t modification_time() const
Returns the last modification time.
Definition group.hh:130
std::string ToJson(bool include_attachments=false) const
std::time_t move_time() const
Returns the last move time.
Definition group.hh:148
void set_last_visible_entry(std::weak_ptr< Entry > entry)
Sets the last visible entry.
Definition group.hh:201
std::vector< std::shared_ptr< Entry > > FindEntries(const std::string &query, bool regex=false, bool recursive=true) const
Finds entries matching the given query in this group's subtree.
void set_name(const std::string &name)
Sets the group name.
Definition group.hh:98
void set_notes(const std::string ¬es)
Sets the group notes.
Definition group.hh:104
void set_expires(bool expires)
Sets whether the group expires.
Definition group.hh:163
void set_flags(const uint16_t &flags)
Sets the group flags.
Definition group.hh:157
void set_icon(const uint32_t &icon)
Sets the index of the stock icon.
Definition group.hh:86
const std::string & name() const
Returns the group name.
Definition group.hh:95
void set_move_time(const std::time_t &time)
Sets the last move time.
Definition group.hh:151
uint32_t usage_count() const
Returns the usage count.
Definition group.hh:172
void RemoveEntry(const std::shared_ptr< Entry > &entry)
Removes an entry from this group.
uint32_t icon() const
Returns the index of the stock icon.
Definition group.hh:83
std::time_t expiry_time() const
Returns the expiry time.
Definition group.hh:142
void AddGroup(const std::shared_ptr< Group > &group)
Adds a subgroup to this group.
Group()
Creates an empty group.
const std::string & default_autotype_sequence() const
Returns the default auto-type sequence.
Definition group.hh:178
bool operator!=(const Group &other) const
Inequality comparison.
bool operator==(const Group &other) const
Equality comparison.
void set_tags(const std::string &tags)
Sets the tags (space-separated).
Definition group.hh:110
void set_expanded(bool expanded)
Sets whether the group is expanded in the UI.
Definition group.hh:169
uint16_t flags() const
Returns the group flags.
Definition group.hh:154
const std::optional< std::array< uint8_t, 16 > > & previous_parent_group() const
Returns the UUID of the previous parent group (KDBX 4.1); empty if unset.
Definition group.hh:113
std::weak_ptr< Icon > custom_icon() const
Returns a weak reference to the custom icon (if any).
Definition group.hh:89
void set_custom_icon(std::weak_ptr< Icon > icon)
Sets the custom icon.
Definition group.hh:92
bool expanded() const
Returns whether the group is expanded in the UI.
Definition group.hh:166
std::vector< std::shared_ptr< Group > > FindGroups(const std::string &query, bool regex=false, bool recursive=true) const
Finds groups matching the given query in this group's subtree.
Type representing a single KeePass entry.
Visibility/export macro for the shared library.
#define LIBKEEPASS_API
Marks a class, function or variable as part of the public ABI.
Definition export.hh:43