~aleteoryx/muditaos

ref: b7e710ef9e8e55667ab2cf3605a0d9c5ebc90b04 muditaos/module-services/service-fileindexer/notesIndexer.hpp -rw-r--r-- 1.0 KiB
b7e710ef — Przemyslaw Brudny [EGD-6867] Renamed TopBar into StatusBar 4 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// Copyright (c) 2017-2020, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#pragma once

#include <string>
#include <cstddef>

namespace service::detail
{
    //! Index text file class
    class notesIndexer
    {
      public:
        explicit notesIndexer(std::string_view path);
        [[nodiscard]] auto getWords() const noexcept
        {
            return mWordCount;
        }
        [[nodiscard]] auto getLines() const noexcept
        {
            return mLinesCount;
        }
        [[nodiscard]] auto getChars() const noexcept
        {
            return mCharCount;
        }
        [[nodiscard]] auto getFileSize() const noexcept
        {
            return mCharCount;
        }

      private:
        auto updateLineStats(std::string_view line) noexcept -> void;

      private:
        std::size_t mWordCount{};
        std::size_t mLinesCount{};
        std::size_t mCharCount{};
        std::size_t mFileSize{};
    };
} // namespace service::detail