Salome HOME
Error management -- Attribute validator returns an error.
[modules/shaper.git] / src / ExchangePlugin / ExchangePlugin_Validators.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:    ExchangePlugin_Validators.h
4 // Created: Aug 01, 2014
5 // Author:  Sergey BELASH
6
7 #ifndef EXCHANGEPLUGIN_VALIDATORS_H
8 #define EXCHANGEPLUGIN_VALIDATORS_H
9
10 #include "ExchangePlugin.h"
11 #include <ModelAPI_AttributeValidator.h>
12
13 /**\class ExchangePlugin_ImportFormatValidator
14  * \ingroup Validators
15  * \brief Validator for the imported formats checking
16  *
17  * The configuration file of import/export features contains the information
18  * about which formats are supported and the extension of the associated files.
19  * This validator filters out files that are out of this description.
20  */
21 class ExchangePlugin_FormatValidator : public ModelAPI_AttributeValidator
22 {
23   /**
24    * Parses input arguments "BREP:BREPImport", "STEP|STP:STEPImport"
25    * into list of file formats "BREP","STEP","STP"
26    * and list of corresponding plugins: "BREPImport", "STEPImport"
27    */
28   static bool parseFormats(const std::list<std::string>& theArguments,
29                            std::list<std::string>& outFormats);
30 public:
31   /**
32    * Returns true is the file-name attribute correctly corresponds to the set of
33    * allowed formats.
34    */
35   virtual bool isValid(const AttributePtr& theAttribute,
36                        const std::list<std::string>& theArguments,
37                        std::string& theError) const;
38 };
39
40 class ExchangePlugin_ImportFormatValidator : public ExchangePlugin_FormatValidator
41 {
42
43 };
44
45 class ExchangePlugin_ExportFormatValidator : public ExchangePlugin_FormatValidator
46 {
47
48 };
49
50 #endif