aboutsummaryrefslogtreecommitdiffstats
path: root/generator/cppgenerator.h
diff options
context:
space:
mode:
authorRenato Filho <renato.filho@openbossa.org>2011-04-13 20:55:47 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-08 16:15:21 -0300
commit1155fe8c710818eac3c0490724b34adef95d9999 (patch)
tree8b01b22519863425c44299421cb02894e6ca860c /generator/cppgenerator.h
parent50d1b114b35f34f97aefca1f42c3dbf9327e0d3a (diff)
Implemented generation code for mapping protocol
Fixex bug #743. Reviewer: Marcelo Lira <marcelo.lira@openbossa.org> Hugo Parente Lima <hugo.pl@gmail.com>
Diffstat (limited to 'generator/cppgenerator.h')
-rw-r--r--generator/cppgenerator.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/generator/cppgenerator.h b/generator/cppgenerator.h
index d7674385b..2115230f7 100644
--- a/generator/cppgenerator.h
+++ b/generator/cppgenerator.h
@@ -131,10 +131,15 @@ private:
void writeClassDefinition(QTextStream& s, const AbstractMetaClass* metaClass);
void writeMethodDefinitionEntry(QTextStream& s, const AbstractMetaFunctionList overloads);
void writeMethodDefinition(QTextStream& s, const AbstractMetaFunctionList overloads);
+
/// Writes the implementation of all methods part of python sequence protocol
void writeSequenceMethods(QTextStream& s, const AbstractMetaClass* metaClass);
- /// Writes the struct PySequenceMethods for types thats supports the python sequence protocol
void writeTypeAsSequenceDefinition(QTextStream& s, const AbstractMetaClass* metaClass);
+
+ /// Writes the struct PyMappingMethods for types thats supports the python mapping protocol
+ void writeTypeAsMappingDefinition(QTextStream& s, const AbstractMetaClass* metaClass);
+ void writeMappingMethods(QTextStream& s, const AbstractMetaClass* metaClass);
+
void writeTypeAsNumberDefinition(QTextStream& s, const AbstractMetaClass* metaClass);
void writeCopyFunction(QTextStream& s, const AbstractMetaClass *metaClass);
@@ -185,6 +190,9 @@ private:
/// Returns true if the given class supports the python sequence protocol
bool supportsSequenceProtocol(const AbstractMetaClass* metaClass);
+ /// Returns true if the given class supports the python mapping protocol
+ bool supportsMappingProtocol(const AbstractMetaClass* metaClass);
+
/// Returns true if generator should produce getters and setters for the given class.
bool shouldGenerateGetSetList(const AbstractMetaClass* metaClass);
@@ -201,6 +209,10 @@ private:
// Maps special function names to function parameters and return types
// used by CPython API in the sequence protocol.
QHash<QString, QPair<QString, QString> > m_sequenceProtocol;
+
+ // Maps special function names to function parameters and return types
+ // used by CPython API in the mapping protocol.
+ QHash<QString, QPair<QString, QString> > m_mappingProtocol;
int m_currentErrorCode;
};