1 /***************************************************************************
2  * SPDX-FileCopyrightText: 2021 S. MANKOWSKI stephane@mankowski.fr
3  * SPDX-FileCopyrightText: 2021 G. DE BURE support@mankowski.fr
4  * SPDX-License-Identifier: GPL-3.0-or-later
5  ***************************************************************************/
6 #ifndef SKGSUBOPERATIONOBJECT_H
7 #define SKGSUBOPERATIONOBJECT_H
8 /** @file
9  * This file defines classes SKGSubOperationObject.
10  *
11  * @author Stephane MANKOWSKI / Guillaume DE BURE
12  */
13 
14 #include "skgbankmodeler_export.h"
15 #include "skgobjectbase.h"
16 class SKGOperationObject;
17 class SKGCategoryObject;
18 class SKGTrackerObject;
19 
20 /**
21  * This class manages suboperation object
22  */
23 class SKGBANKMODELER_EXPORT SKGSubOperationObject final : public SKGObjectBase
24 {
25 public:
26     /**
27      * Default constructor
28      */
29     explicit SKGSubOperationObject();
30 
31     /**
32      * Constructor
33      * @param iDocument the document containing the object
34      * @param iID the identifier in @p iTable of the object
35      */
36     explicit SKGSubOperationObject(SKGDocument* iDocument, int iID = 0);
37 
38     /**
39      * Copy constructor
40      * @param iObject the object to copy
41      */
42     SKGSubOperationObject(const SKGSubOperationObject& iObject);
43 
44     /**
45      * Copy constructor
46      * @param iObject the object to copy
47      */
48     explicit SKGSubOperationObject(const SKGObjectBase& iObject);
49 
50     /**
51      * Operator affectation
52      * @param iObject the object to copy
53      */
54     SKGSubOperationObject& operator= (const SKGObjectBase& iObject);
55 
56     /**
57      * Operator affectation
58      * @param iObject the object to copy
59      */
60     SKGSubOperationObject& operator= (const SKGSubOperationObject& iObject);
61 
62     /**
63      * Destructor
64      */
65     virtual ~SKGSubOperationObject();
66 
67     /**
68      * Set date of this suboperation
69      * @param iDate the date
70      * @return an object managing the error
71      *   @see SKGError
72      */
73     // cppcheck-suppress passedByValue
74     SKGError setDate(QDate iDate);
75 
76     /**
77      * Get date of this suboperation
78      * @return the date
79      */
80     QDate getDate() const;
81 
82     /**
83      * Set the order of suboperation
84      * @param iOrder the order
85      * @return an object managing the error
86      *   @see SKGError
87      */
88     SKGError setOrder(int iOrder);
89 
90     /**
91      * Get order of this suboperation
92      * @return the order
93      */
94     int getOrder() const;
95 
96     /**
97      * Set the comment of suboperation
98      * @param iComment the comment
99      * @return an object managing the error
100      *   @see SKGError
101      */
102     SKGError setComment(const QString& iComment);
103 
104     /**
105      * Get the comment of this suboperation
106      * @return the comment
107      */
108     QString getComment() const;
109 
110     /**
111      * Get the parent operation
112      * @param oOperation the parent operation
113      * @return an object managing the error.
114      *   @see SKGError
115      */
116     SKGError getParentOperation(SKGOperationObject& oOperation) const;
117 
118     /**
119      * Set the parent operation
120      * @param iOperation the parent operation
121      * @return an object managing the error.
122      *   @see SKGError
123      */
124     SKGError setParentOperation(const SKGOperationObject& iOperation);
125 
126     /**
127      * Set the category
128      * @param iCategory the category
129      * @return an object managing the error
130      *   @see SKGError
131      */
132     SKGError setCategory(const SKGCategoryObject& iCategory);
133 
134     /**
135      * Get the category
136      * @param oCategory the category
137      * @return an object managing the error
138      *   @see SKGError
139      */
140     SKGError getCategory(SKGCategoryObject& oCategory) const;
141 
142     /**
143      * Set the tracker
144      * @param iTracker the tracker
145      * @param iForce force the change of the tracker even if closed
146      * @return an object managing the error
147      *   @see SKGError
148      */
149     SKGError setTracker(const SKGTrackerObject& iTracker, bool iForce = false);
150 
151     /**
152      * Get the tracker
153      * @param oTracker the tracker
154      * @return an object managing the error
155      *   @see SKGError
156      */
157     SKGError getTracker(SKGTrackerObject& oTracker) const;
158 
159     /**
160      * Set the quantity of the suboperation
161      * @param iValue the value
162      * @return an object managing the error
163      *   @see SKGError
164      */
165     SKGError setQuantity(double iValue);
166 
167     /**
168      * Get the quantity of the suboperation
169      * @return the value
170      */
171     double getQuantity() const;
172 
173     /**
174      * Set the formula
175      * @param iFormula the formula
176      * @return an object managing the error
177      *   @see SKGError
178      */
179     SKGError setFormula(const QString& iFormula);
180 
181     /**
182      * Get the formula
183      * @return the formula
184      */
185     QString getFormula() const;
186 };
187 
188 /**
189  * Declare the class
190  */
191 Q_DECLARE_TYPEINFO(SKGSubOperationObject, Q_MOVABLE_TYPE);
192 #endif
193