From 2b7dd99a68f0d94215fef3c18199d2cb99145e51 Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Fri, 13 May 2022 10:02:06 +1000 Subject: [PATCH] stringid: implement the size query --- stringid.cpp | 10 +++++++++- stringid.hpp | 15 ++++++++------- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/stringid.cpp b/stringid.cpp index ea56784b..5e5dbe7a 100644 --- a/stringid.cpp +++ b/stringid.cpp @@ -54,7 +54,15 @@ stringid::find (std::string_view const &key) const /////////////////////////////////////////////////////////////////////////////// void -stringid::clear (void) +stringid::clear (void) noexcept { m_map.clear (); } + + +//----------------------------------------------------------------------------- +std::size_t +stringid::size (void) const noexcept +{ + return m_map.size (); +} \ No newline at end of file diff --git a/stringid.hpp b/stringid.hpp index d0a5aa70..98286a6d 100644 --- a/stringid.hpp +++ b/stringid.hpp @@ -3,11 +3,12 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * - * Copyright 2014-2018 Danny Robson + * Copyright: + * 2014-2018 Danny Robson + * 2022 Danny Robson */ -#ifndef CRUFT_UTIL_STRINGID_HPP -#define CRUFT_UTIL_STRINGID_HPP +#pragma once #include "view.hpp" @@ -63,12 +64,12 @@ namespace cruft { /////////////////////////////////////////////////////////////////////// - void clear (void); + void clear (void) noexcept; + + std::size_t size (void) const noexcept; private: std::map> m_map; }; -} - -#endif +} \ No newline at end of file