Salome HOME
updated copyright message
[modules/shaper.git] / src / ExchangePlugin / ExchangePlugin_Validators.h
1 // Copyright (C) 2014-2023  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 #ifndef EXCHANGEPLUGIN_VALIDATORS_H
21 #define EXCHANGEPLUGIN_VALIDATORS_H
22
23 #include "ExchangePlugin.h"
24 #include <ModelAPI_AttributeValidator.h>
25
26 /**
27  * \class ExchangePlugin_FormatValidator
28  * \ingroup Validators
29  * \brief Validator for the imported formats checking
30  *
31  * The configuration file of import/export features contains the information
32  * about which formats are supported and the extension of the associated files.
33  * This validator filters out files that are out of this description.
34  */
35 class ExchangePlugin_FormatValidator : public ModelAPI_AttributeValidator
36 {
37   /**
38    * Parses input arguments "BREP:BREPImport", "STEP|STP:STEPImport"
39    * into list of file formats "BREP","STEP","STP"
40    * and list of corresponding plugins: "BREPImport", "STEPImport"
41    */
42   static bool parseFormats(const std::list<std::string>& theArguments,
43                            std::list<std::string>& outFormats);
44 public:
45   /**
46    * Returns true is the file-name attribute correctly corresponds to the set of
47    * allowed formats.
48    */
49   virtual bool isValid(const AttributePtr& theAttribute,
50                        const std::list<std::string>& theArguments,
51                        Events_InfoMessage& theError) const;
52 };
53
54 /**
55  * \class ExchangePlugin_ImportFormatValidator
56  * \ingroup Validators
57  * \brief Validator for the import format.
58  */
59 class ExchangePlugin_ImportFormatValidator : public ExchangePlugin_FormatValidator
60 {
61
62 };
63
64 /**
65  * \class ExchangePlugin_ExportFormatValidator
66  * \ingroup Validators
67  * \brief Validator for the export format.
68  */
69 class ExchangePlugin_ExportFormatValidator : public ExchangePlugin_FormatValidator
70 {
71
72 };
73
74 /**
75  *  Check the selected result is in history (avoid Origin and coordinate axes and planes).
76  */
77 class ExchangePlugin_InHistoryValidator : public ModelAPI_AttributeValidator
78 {
79 public:
80   /// \return True if the attribute is valid.
81   ///         It checks whether the selected object is in history.
82   /// \param[in] theAttribute an attribute to check
83   /// \param[in] theArguments a filter parameters
84   /// \param[out] theError error message.
85   virtual bool isValid(const AttributePtr& theAttribute,
86                        const std::list<std::string>& theArguments,
87                        Events_InfoMessage& theError) const;
88 };
89
90 #endif