diff options
author | Marcelo Lira <marcelo.lira@openbossa.org> | 2011-08-02 17:01:40 -0300 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2012-03-08 16:17:07 -0300 |
commit | f9e9189be4b622b74d0df2787a09f93fe7a5d0ae (patch) | |
tree | 37e5c07fb73a638e65a13352cb3c50304135d6e7 /generator/shibokengenerator.h | |
parent | 3e8c945bdc731fb7c9eaff0007abc02bfa1e5c37 (diff) |
Disassembled ShibokenGenerator's writeCodeSnips method.
Also added writeConversionRule methods to CppGenerator.
Reviewed by Hugo Parente <hugo.lima@openbossa.org>
Reviewed by Luciano Wolf <luciano.wolf@openbossa.org>
Reviewed by Renato Araújo <renato.filho@openbossa.org>
Diffstat (limited to 'generator/shibokengenerator.h')
-rw-r--r-- | generator/shibokengenerator.h | 39 |
1 files changed, 22 insertions, 17 deletions
diff --git a/generator/shibokengenerator.h b/generator/shibokengenerator.h index 256977690..605b205e6 100644 --- a/generator/shibokengenerator.h +++ b/generator/shibokengenerator.h @@ -111,26 +111,31 @@ public: const AbstractMetaFunction* func, Options options = NoOption) const; QString functionReturnType(const AbstractMetaFunction* func, Options options = NoOption) const; - /** - * Write a code snip into the buffer \p s. - * CodeSnip are codes inside inject-code tags. - * \param s the buffer - * \param code_snips a list of code snips - * \param position the position to insert the code snip - * \param language the kind of code snip - * \param func the cpp function - * \param lastArg last argument whose value is available, usually the last; - * a NULL pointer indicates that no argument will be available, - * i.e. a call without arguments. - * \param context the class context for the place where the code snip will be written - */ - void writeCodeSnips(QTextStream &s, - const CodeSnipList &code_snips, + + /// Utility function for writeCodeSnips. + static QMap<int, QString> getArgumentReplacement(const AbstractMetaFunction* func, + bool usePyArgs, TypeSystem::Language language, + const AbstractMetaArgument* lastArg); + + /// Write user's custom code snippets at class or module level. + void writeCodeSnips(QTextStream& s, + const CodeSnipList& codeSnips, CodeSnip::Position position, TypeSystem::Language language, - const AbstractMetaFunction* func = 0, - const AbstractMetaArgument* lastArg = 0, const AbstractMetaClass* context = 0); + /// Write user's custom code snippets at function level. + void writeCodeSnips(QTextStream& s, + const CodeSnipList& codeSnips, + CodeSnip::Position position, + TypeSystem::Language language, + const AbstractMetaFunction* func, + const AbstractMetaArgument* lastArg = 0); + + /// Returns a string with the user's custom code snippets that comply with \p position and \p language. + QString getCodeSnippets(const CodeSnipList& codeSnips, CodeSnip::Position position, TypeSystem::Language language); + + /// Replaces variables for the user's custom code at global or class level. + void processCodeSnip(QString& code, const AbstractMetaClass* context = 0); /// Replaces the %CONVERTTOPYTHON type system variable. void replaceConvertToPythonTypeSystemVariable(QString& code); |