X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2Fpy2yacs%2Fpy2yacs.hxx;h=2205475b3ac19a4050fa1a776b67afd559c943c5;hb=fc23b8dcb9236e2a86bacc06af8b360ba9c30c69;hp=b0ca9c40924cc9b82f4d8df9dd8e22d4f2f9092e;hpb=e3255204c864201f5bc1aa040d4273ed2f44e8cd;p=modules%2Fyacs.git diff --git a/src/py2yacs/py2yacs.hxx b/src/py2yacs/py2yacs.hxx index b0ca9c409..2205475b3 100644 --- a/src/py2yacs/py2yacs.hxx +++ b/src/py2yacs/py2yacs.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2006-2016 CEA/DEN, EDF R&D +// Copyright (C) 2006-2021 CEA/DEN, EDF R&D // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -19,16 +19,27 @@ #ifndef _PY2YACS_H_ #define _PY2YACS_H_ +#ifdef WIN32 +# if defined py2yacslib_EXPORTS +# define PY2YACSLIB_EXPORT __declspec( dllexport ) +# else +# define PY2YACSLIB_EXPORT __declspec( dllimport ) +# endif +#else +# define PY2YACSLIB_EXPORT +#endif + + #include #include #include -class Py2yacsException: std::exception +class PY2YACSLIB_EXPORT Py2yacsException: std::exception { public: Py2yacsException(const std::string& what); - virtual ~Py2yacsException()throw (); - virtual const char *what() const throw (); + virtual ~Py2yacsException() noexcept; + virtual const char *what() const noexcept; private: std::string _what; }; @@ -41,7 +52,7 @@ namespace YACS }; }; -struct FunctionProperties +struct PY2YACSLIB_EXPORT FunctionProperties { public: std::string _name; @@ -55,7 +66,7 @@ struct FunctionProperties * This class converts a string containing a python script to a yacs schema * containing a python script node. */ -class Py2yacs +class PY2YACSLIB_EXPORT Py2yacs { public: Py2yacs(); @@ -93,9 +104,29 @@ class Py2yacs */ YACS::ENGINE::Proc* createProc(const std::string& python_function)const; + /*! + * Syntax errors when parsing python and py2yacs global errors. + * \return a list of errors. + */ const std::list& getGlobalErrors() const; + const std::list& getFunctionProperties()const; + /*! + * Get a string containing global errors and errors specific to py2yacs for + * every function in python script. + * An empty string means there is no error. + */ + std::string getAllErrors()const; + + /*! + * Same as getAllErrors but only for one function. + * py2yacs errors for other functions are ignored. + * If the function name is not found, you get an error message in the + * returned string. + */ + std::string getFunctionErrors(const std::string& functionName)const; + private: std::string _python_parser_module; std::string _python_parser_function;