diff --git a/Jupiter/Hash_Table.h b/Jupiter/Hash_Table.h index 81fb230..8d89bb8 100644 --- a/Jupiter/Hash_Table.h +++ b/Jupiter/Hash_Table.h @@ -70,6 +70,7 @@ namespace Jupiter * @return Pointer to the value of the entry if it exists, nullptr otherwise */ ValueT *get(const InKeyT &in_key) const; + const InValueT &get(const InKeyT &in_key, const InValueT &in_value) const; /** * @brief Sets the value for an entry in the bucket @@ -157,6 +158,7 @@ namespace Jupiter * @return Value of the entry if it exists, nullptr otherwise */ ValueT *get(const InKeyT &in_key) const; + const InValueT &get(const InKeyT &in_key, const InValueT &in_value) const; /** * @brief Sets the value for an entry in the table diff --git a/Jupiter/Hash_Table_Imp.h b/Jupiter/Hash_Table_Imp.h index 4676538..d5c78bb 100644 --- a/Jupiter/Hash_Table_Imp.h +++ b/Jupiter/Hash_Table_Imp.h @@ -78,6 +78,16 @@ ValueT *Jupiter::Hash_Table::Bucket::get( return nullptr; } +template +const InValueT &Jupiter::Hash_Table::Bucket::get(const InKeyT &in_key, const InValueT &in_value) const +{ + for (Jupiter::SLList::Node *node = m_entries.getHead(); node != nullptr; node = node->next) + if (node->data->key == in_key) + return node->data->value; + + return in_value; +} + template bool Jupiter::Hash_Table::Bucket::set(const InKeyT &in_key, const InValueT &in_value) { @@ -199,6 +209,12 @@ ValueT *Jupiter::Hash_Table::get(const In return m_buckets[HashF(in_key) % m_buckets_size].get(in_key); } +template +const InValueT &Jupiter::Hash_Table::get(const InKeyT &in_key, const InValueT &in_value) const +{ + return m_buckets[HashF(in_key) % m_buckets_size].get(in_key, in_value); +} + template bool Jupiter::Hash_Table::set(const InKeyT &in_key, const InValueT &in_value) { diff --git a/Jupiter/IRC_Client.h b/Jupiter/IRC_Client.h index b6ed530..8494c4f 100644 --- a/Jupiter/IRC_Client.h +++ b/Jupiter/IRC_Client.h @@ -884,8 +884,8 @@ namespace Jupiter /** * @brief Constructor for a client. * - * @param in_primary_section INIFile section to search first for a configuration option - * @param in_secondary_section INIFile section to search second for a configuration, before using a pre-defined default value + * @param in_primary_section Config section to search first for a configuration option + * @param in_secondary_section Config section to search second for a configuration, before using a pre-defined default value */ Client(const Jupiter::Config *in_primary_section, const Jupiter::Config *in_secondary_section);