~aleteoryx/muditaos

ref: c30101bb930d0380671b1a8a36384151df6c08f1 muditaos/module-db/queries/phonebook/QueryContactGet.hpp -rw-r--r-- 3.8 KiB
c30101bb — Wojtek Cichoń [EGD-5787] Fixes re fallback font docs 5 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
// 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 <queries/RecordQuery.hpp>
#include <queries/Filter.hpp>
#include <Interface/ContactRecord.hpp>
#include <module-apps/application-phonebook/data/ContactsMap.hpp>

#include <string>

namespace db::query
{
    /**
     * @brief ContactRecord read query, filtered by text.
     *
     */
    class ContactGet : public RecordQuery, public TextFilter, public ContactGroupFilter, public ContactDisplayMode
    {
      public:
        /**
         * @brief Default constructor with an empty filtering string
         *
         * @param filter text filter
         */
        ContactGet(const std::string &filter        = "",
                   const std::uint32_t &groupFilter = 0,
                   const std::uint32_t &displayMode = 0);

        /**
         * @brief Construct read query with limit, offset and filter values
         *
         * @param limit maximum number of records to read
         * @param offset read start offset
         * @param filter text to filter records
         */
        ContactGet(std::size_t limit,
                   std::size_t offset,
                   const std::string &filter        = "",
                   const std::uint32_t &groupFilter = 0,
                   const std::uint32_t &displayMode = 0);

        /**
         * @brief debug info
         *
         * @return class name
         */
        [[nodiscard]] auto debugInfo() const -> std::string override;
    };

    /**
     * @brief A response to the db::query::ContactGet query. Returns a vector of
     * ContactRecord data
     *
     */
    class ContactGetResult : public RecordQueryResult<ContactRecord>
    {
      public:
        /**
         * @brief Construct reply with a vector of results
         *
         * @param records records to be sent
         */
        ContactGetResult(const std::vector<ContactRecord> &records);

        /**
         * @brief debug info
         *
         * @return class name
         */
        [[nodiscard]] auto debugInfo() const -> std::string override;
    };

    /**
     * @brief A query to get a number of contacts filtered with a text
     *
     */
    class ContactGetSize : public RecordsSizeQuery,
                           public TextFilter,
                           public ContactGroupFilter,
                           public ContactDisplayMode
    {
      public:
        /**
         * @brief Construct query with a filter value
         *
         * @param filter text to filter contacts with
         */
        ContactGetSize(const std::string &filter        = "",
                       const std::uint32_t &groupFilter = 0,
                       const std::uint32_t &displayMode = 0);

        /**
         * @brief debug info
         *
         * @return class name
         */
        [[nodiscard]] auto debugInfo() const -> std::string override;
    };

    class ContactGetLetterMap : public RecordQuery,
                                public TextFilter,
                                public ContactGroupFilter,
                                public ContactDisplayMode
    {
      public:
        ContactGetLetterMap(const std::string &filter        = "",
                            const std::uint32_t &groupFilter = 0,
                            const std::uint32_t &displayMode = 0);

        ContactGetLetterMap(std::size_t limit,
                            std::size_t offset,
                            const std::string &filter        = "",
                            const std::uint32_t &groupFilter = 0,
                            const std::uint32_t &displayMode = 0);
    };

    class ContactGetLetterMapResult : public LetterMapResult
    {
      public:
        ContactGetLetterMapResult(ContactsMapData &LetterMap);
    };

}; // namespace db::query