libkeepass 0.2.0
KeePass key database importer/exporter library
Loading...
Searching...
No Matches
keepass::Group Class Referencefinal

A KeePass group (a folder) that contains entries and subgroups. More...

#include <group.hh>

Inheritance diagram for keepass::Group:

Public Member Functions

 Group ()
 Creates an empty group.
 
const std::array< uint8_t, 16 > & uuid () const
 Returns the group's unique identifier (UUID).
 
void set_uuid (const std::array< uint8_t, 16 > &uuid)
 Sets the group's unique identifier (UUID).
 
uint32_t icon () const
 Returns the index of the stock icon.
 
void set_icon (const uint32_t &icon)
 Sets the index of the stock icon.
 
std::weak_ptr< Icon > custom_icon () const
 Returns a weak reference to the custom icon (if any).
 
void set_custom_icon (std::weak_ptr< Icon > icon)
 Sets the custom icon.
 
const std::string & name () const
 Returns the group name.
 
void set_name (const std::string &name)
 Sets the group name.
 
const std::string & notes () const
 Returns the group notes.
 
void set_notes (const std::string &notes)
 Sets the group notes.
 
const std::string & tags () const
 Returns the tags (space-separated).
 
void set_tags (const std::string &tags)
 Sets the tags (space-separated).
 
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.
 
void set_previous_parent_group (const std::optional< std::array< uint8_t, 16 > > &uuid)
 
std::time_t creation_time () const
 Returns the creation time.
 
void set_creation_time (const std::time_t &time)
 Sets the creation time.
 
std::time_t modification_time () const
 Returns the last modification time.
 
void set_modification_time (const std::time_t &time)
 Sets the last modification time.
 
std::time_t access_time () const
 Returns the last access time.
 
void set_access_time (const std::time_t &time)
 Sets the last access time.
 
std::time_t expiry_time () const
 Returns the expiry time.
 
void set_expiry_time (const std::time_t &time)
 Sets the expiry time.
 
std::time_t move_time () const
 Returns the last move time.
 
void set_move_time (const std::time_t &time)
 Sets the last move time.
 
uint16_t flags () const
 Returns the group flags.
 
void set_flags (const uint16_t &flags)
 Sets the group flags.
 
bool expires () const
 Returns whether the group expires.
 
void set_expires (bool expires)
 Sets whether the group expires.
 
bool expanded () const
 Returns whether the group is expanded in the UI.
 
void set_expanded (bool expanded)
 Sets whether the group is expanded in the UI.
 
uint32_t usage_count () const
 Returns the usage count.
 
void set_usage_count (uint32_t usage_count)
 Sets the usage count.
 
const std::string & default_autotype_sequence () const
 Returns the default auto-type sequence.
 
void set_default_autotype_sequence (std::string sequence)
 Sets the default auto-type sequence.
 
bool autotype () const
 Returns whether auto-type is enabled for this group.
 
void set_autotype (bool autotype)
 Sets whether auto-type is enabled for this group.
 
bool search () const
 Returns whether search is enabled for this group.
 
void set_search (bool search)
 Sets whether search is enabled for this group.
 
std::weak_ptr< Entry > last_visible_entry () const
 Returns a weak reference to the last visible entry.
 
void set_last_visible_entry (std::weak_ptr< Entry > entry)
 Sets the last visible entry.
 
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.
 
std::weak_ptr< Group > parent () const
 Returns the parent group (empty if this is the root group).
 
void set_parent (std::weak_ptr< Group > parent)
 Sets the parent group.
 
bool is_root_group () const
 Returns whether this group is the root group.
 
std::string path () const
 Returns the full path of this group from the database root.
 
size_t entries_count () const
 Returns the number of entries directly contained in this group.
 
size_t groups_count () const
 Returns the number of subgroups directly contained in this group.
 
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.
 
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.
 
void AddGroup (const std::shared_ptr< Group > &group)
 Adds a subgroup to this group.
 
void RemoveGroup (const std::shared_ptr< Group > &group)
 Removes a subgroup from this group.
 
void AddEntry (const std::shared_ptr< Entry > &entry)
 Adds an entry to this group.
 
void RemoveEntry (const std::shared_ptr< Entry > &entry)
 Removes an entry from this group.
 
bool HasNonMetaEntries () const
 Returns whether the group contains any non-metadata entries.
 
std::string ToJson (bool include_attachments=false) const
 
bool operator== (const Group &other) const
 Equality comparison.
 
bool operator!= (const Group &other) const
 Inequality comparison.
 

Detailed Description

A KeePass group (a folder) that contains entries and subgroups.

A Group forms the hierarchical structure of a database. Every database has a root group; groups can contain Entry objects and nested groups.

Member Function Documentation

◆ FindEntries()

std::vector< std::shared_ptr< Entry > > keepass::Group::FindEntries ( const std::string &  query,
bool  regex = false,
bool  recursive = true 
) const

Finds entries matching the given query in this group's subtree.

Parameters
queryThe title to search for.
regexWhether the query is a regular expression (matches anywhere in the title, case-insensitive). Otherwise the query must be a case-insensitive substring of the title.
recursiveWhether to also search in subgroups.
Returns
The matching entries.

◆ FindGroups()

std::vector< std::shared_ptr< Group > > keepass::Group::FindGroups ( const std::string &  query,
bool  regex = false,
bool  recursive = true 
) const

Finds groups matching the given query in this group's subtree.

Parameters
queryThe name to search for.
regexWhether the query is a regular expression (matches anywhere in the name, case-insensitive). Otherwise the query must be a case-insensitive substring of the name.
recursiveWhether to also search in subgroups.
Returns
The matching groups.

◆ set_previous_parent_group()

void keepass::Group::set_previous_parent_group ( const std::optional< std::array< uint8_t, 16 > > &  uuid)
inline

Sets the UUID of the previous parent group (KDBX 4.1); pass std::nullopt to unset.

◆ ToJson()

std::string keepass::Group::ToJson ( bool  include_attachments = false) const

Serializes the group to a JSON object.

Parameters
include_attachmentsInclude attachment payloads as base64.

The documentation for this class was generated from the following file: