59 | | //! Read instance properties according the data stored in the Setting structure |
60 | | //! |
61 | | //! It has to be called only through user_info class, therefore it is protected |
| 65 | /*! |
| 66 | \brief Read instance properties according the data stored in the Setting structure. |
| 67 | It has to be called only through UI class, therefore it is protected |
| 68 | |
| 69 | At the begining of this method, it is obligatory to call |
| 70 | the corresponding base::from_setting method. Sometimes, there can be |
| 71 | an exception from this rule. If so, the programmer is encouraged |
| 72 | to describe the reasons for this exception in the documentation in detail. |
| 73 | |
| 74 | Then, all the configuration components should be read through the UI mechanism. |
| 75 | Those with UI::SettingPresence set to optional shoud have their defaults fulfilled |
| 76 | within the body of this method. |
| 77 | |
| 78 | For instance, declaring a class \c trunk derived from our #root class, |
| 79 | the implementation of the from_setting method should look like this |
| 80 | |
| 81 | \code |
| 82 | |
| 83 | public trunk : public root { |
| 84 | |
| 85 | anytype xxx, yyy; |
| 86 | |
| 87 | virtual void from_setting ( const Setting &set ) { |
| 88 | root::from_setting( set ); |
| 89 | |
| 90 | UI::get ( xxx, set, "xxx", UI::compulsory ); |
| 91 | |
| 92 | if ( !UI::get ( yyy, set, "yyy", UI::optional ) ) { |
| 93 | ... // here, it is necessary to set the default of attribute yyy |
| 94 | } |
| 95 | |
| 96 | ... // another stuff related to trunk class |
| 97 | } |
| 98 | |
| 99 | ... // other members of this class |
| 100 | }; |
| 101 | |
| 102 | \endcode |
| 103 | */ |
65 | | //! Save all the instance properties into the Setting structure |
66 | | //! |
67 | | //! It has to be called only through user_info class, therefore it is protected |
| 107 | /*! |
| 108 | \brief Save all the instance properties into the Setting structure. |
| 109 | It has to be called only through UI class, therefore it is protected |
| 110 | |
| 111 | The only obligatory rule concerning the body of this method is to call |
| 112 | the corresponding base::to_setting method first. Sometimes, there can |
| 113 | be an exception from this rule. If so, the programmer is encouraged |
| 114 | to describe the reasons for this exception in the documentation in detail. |
| 115 | |
| 116 | For instance, declaring |
| 117 | a class \c trunk derived from our #root class, the implementation of |
| 118 | the to_setting method should look like this |
| 119 | |
| 120 | \code |
| 121 | public trunk : public root { |
| 122 | |
| 123 | anytype xxx; |
| 124 | |
| 125 | virtual void to_setting ( const Setting &set ) { |
| 126 | root::to_setting( set ); |
| 127 | |
| 128 | UI::save ( xxx, set, "xxx" ); |
| 129 | |
| 130 | ... // another stuff related directly to trunk class |
| 131 | |
| 132 | } |
| 133 | |
| 134 | ... // other members of this class |
| 135 | |
| 136 | }; |
| 137 | |
| 138 | \endcode |
| 139 | */ |
103 | | //! Check that all internal structures has been correctly set-up. Called at the end of from_setting. |
| 175 | /*! |
| 176 | \brief This method checks that all internal structures has been set up correctly. |
| 177 | |
| 178 | It is called automatically after the call of the #from_setting method by the mechanism of the UI class. |
| 179 | However, it can be called in any other situation to assure the correctness of an instance. |
| 180 | |
| 181 | The only obligatory rule concerning the body of this method is to call |
| 182 | the corresponding base::validate method first. Sometimes, there can be |
| 183 | an exception from this rule. If so, the programmer is encouraged |
| 184 | to describe the reasons for this exception in the documentation in detail. |
| 185 | |
| 186 | Then, only those checks which are not implemented in the base method |
| 187 | are implemented here. For instance, declaring a class \c trunk derived from our |
| 188 | #root class, the implementation of the method validate should |
| 189 | look like this |
| 190 | |
| 191 | \code |
| 192 | public trunk : public root { |
| 193 | |
| 194 | virtual void validate ( ) { |
| 195 | root::validate( ); |
| 196 | |
| 197 | ... // checks related directly to trunk class |
| 198 | } |
| 199 | |
| 200 | ... // other members of this class |
| 201 | |
| 202 | }; |
| 203 | |
| 204 | \endcode |
| 205 | |
| 206 | */ |