File indexing completed on 2024-05-19 05:42:14

0001 // ct_lvtmdl_physicaltablemodels.h                                     -*-C++-*-
0002 
0003 /*
0004 // Copyright 2023 Codethink Ltd <codethink@codethink.co.uk>
0005 // SPDX-License-Identifier: Apache-2.0
0006 //
0007 // Licensed under the Apache License, Version 2.0 (the "License");
0008 // you may not use this file except in compliance with the License.
0009 // You may obtain a copy of the License at
0010 //
0011 //     http://www.apache.org/licenses/LICENSE-2.0
0012 //
0013 // Unless required by applicable law or agreed to in writing, software
0014 // distributed under the License is distributed on an "AS IS" BASIS,
0015 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0016 // See the License for the specific language governing permissions and
0017 // limitations under the License.
0018 */
0019 
0020 #ifndef INCLUDED_CT_LVTMDL_PHYSICALTABLEMODELS
0021 #define INCLUDED_CT_LVTMDL_PHYSICALTABLEMODELS
0022 
0023 #include <lvtmdl_export.h>
0024 
0025 #include <ct_lvtmdl_basetablemodel.h>
0026 
0027 #include <memory>
0028 #include <string>
0029 #include <vector>
0030 
0031 namespace Codethink::lvtmdl {
0032 
0033 // ================================
0034 // class PhysicalDepsBaseTableModel
0035 // ================================
0036 
0037 class LVTMDL_EXPORT PhysicalDepsBaseTableModel : public BaseTableModel {
0038     // Shares code between models for forward and reverse
0039     // physical dependencies
0040 
0041     Q_OBJECT
0042   public:
0043     PhysicalDepsBaseTableModel();
0044     void refreshData() override;
0045 
0046   protected:
0047     virtual std::vector<std::string> componentRows() = 0;
0048     // Return rows for this table for type() == ComponentType
0049 
0050     virtual std::vector<std::string> packageRows() = 0;
0051     // Return rows for this table for type() == PackageType
0052 };
0053 
0054 // ===============================
0055 // class PhysicalProvidersTableModel
0056 // ===============================
0057 
0058 class LVTMDL_EXPORT PhysicalProvidersTableModel : public PhysicalDepsBaseTableModel {
0059     // Concrete implementation of PhysicalDepsBaseTableModel for forward
0060     // dependencies
0061 
0062     Q_OBJECT
0063   protected:
0064     std::vector<std::string> componentRows() override;
0065     std::vector<std::string> packageRows() override;
0066 };
0067 
0068 // ===============================
0069 // class PhysicalClientsTableModel
0070 // ===============================
0071 
0072 class LVTMDL_EXPORT PhysicalClientsTableModel : public PhysicalDepsBaseTableModel {
0073     // Concrete implementation of PhysicalDepsBaseTableModel for reverse
0074     // dependencies
0075 
0076     Q_OBJECT
0077   protected:
0078     std::vector<std::string> componentRows() override;
0079     std::vector<std::string> packageRows() override;
0080 };
0081 
0082 } // namespace Codethink::lvtmdl
0083 
0084 #endif // INCLUDED_CT_LVTMDL_PHYSICALTABLEMODELS