Beispiel #1
0
 def process(self, raw_entry):
     entry = EntryConverter.process(self, raw_entry)
     # Add headerfile paths as list of strings.
     for s in raw_entry.headerfiles:
         entry.addHeaderfile(s.text.text.strip())
     # Add deprecation messages as list of TextNodes.
     for s in raw_entry.deprecation_msgs:
         entry.addDeprecationMsg(
             self.rawTextToTextNode(s.text,
                                    strip_lt_line_space=True,
                                    verbatim=True))
     # Add signatures as a text node with code.
     for s in raw_entry.signatures:
         entry.addSignature(
             self.rawTextToTextNode(s.text,
                                    strip_lt_line_space=True,
                                    verbatim=True))
     # Use sig_parser to convert the signature texts to SigEntry objects.
     # They are used for the list of functions/metafunctions for a type.
     if self.parse_signature:
         for s in raw_entry.signatures:
             try:
                 sig_entry = sig_parser.SigParser(s.text.text).parse()
                 entry.addSignatureEntry(sig_entry)
             except sig_parser.SigParseException, e:
                 print >> sys.stderr, '\nWARNING: Could not parse signature: %s' % e
                 print >> sys.stderr, 'Signature is: %s' % s.text.text.strip(
                 )
Beispiel #2
0
 def testValid(self):
     txt = 'enum EnumName'
     parser = sig_parser.SigParser(txt)
     entry = parser.parse()
     self.assertEqual(entry.kind, 'enum')
     self.assertEqual(entry.name, 'EnumName')
     txt = 'enum EnumName;'
     self.assertEqual(entry.toString(), txt)
Beispiel #3
0
 def testEmptyParams(self):
     txt = 'void foo()'
     parser = sig_parser.SigParser(txt)
     entry = parser.parse()
     self.assertEqual(entry.kind, 'function')
     self.assertEqual(entry.return_type, 'void')
     self.assertEqual(entry.is_tpl, False)
     self.assertEqual(len(entry.params), 0)
Beispiel #4
0
 def testValid(self):
     txt = 'concept ConceptConcept'
     parser = sig_parser.SigParser(txt)
     entry = parser.parse()
     self.assertEqual(entry.kind, 'concept')
     self.assertEqual(entry.name, 'ConceptConcept')
     txt = 'concept ConceptConcept;'
     self.assertEqual(entry.toString(), txt)
Beispiel #5
0
 def testValid(self):
     txt = 'class ClassName'
     parser = sig_parser.SigParser(txt)
     entry = parser.parse()
     self.assertEqual(entry.kind, 'class')
     self.assertEqual(entry.name, 'ClassName')
     txt = 'class ClassName;'
     self.assertEqual(entry.toString(), txt)
Beispiel #6
0
 def testValid(self):
     txt = 'struct StructName'
     parser = sig_parser.SigParser(txt)
     entry = parser.parse()
     self.assertEqual(entry.kind, 'struct')
     self.assertEqual(entry.name, 'StructName')
     txt = 'struct StructName;'
     self.assertEqual(entry.toString(), txt)
Beispiel #7
0
 def testValid(self):
     txt = 'Type variable;'
     parser = sig_parser.SigParser(txt)
     entry = parser.parse()
     self.assertEqual(entry.kind, 'variable')
     self.assertEqual(entry.var_type, 'Type')
     self.assertEqual(entry.name, 'variable')
     txt = 'Type variable;'
     self.assertEqual(entry.toString(), txt)
Beispiel #8
0
 def testTypeInterfaceNoParam(self):
     txt = 'Klass#Metafunction<>::Type'
     parser = sig_parser.SigParser(txt)
     entry = parser.parse()
     self.assertEqual(entry.kind, 'metafunction')
     self.assertEqual(entry.name, 'Klass#Metafunction')
     self.assertEqual(entry.return_name, 'Type')
     self.assertEqual(len(entry.tparams), 0)
     txt = 'Klass#Metafunction<>::Type;'
     self.assertEqual(entry.toString(), txt)
Beispiel #9
0
 def testEmptyParams(self):
     txt = ('template <>\n' 'class C')
     parser = sig_parser.SigParser(txt)
     entry = parser.parse()
     self.assertEqual(entry.kind, 'class')
     self.assertEqual(entry.name, 'C')
     self.assertEqual(entry.is_tpl, True)
     self.assertEqual(len(entry.tparams), 0)
     txt = ('template <>\n' 'class C;')
     self.assertEqual(entry.toString(), txt)
Beispiel #10
0
 def testValueInterfaceNoParam(self):
     txt = 'TInt Klass#Metafunction<>::VALUE'
     parser = sig_parser.SigParser(txt)
     entry = parser.parse()
     self.assertEqual(entry.kind, 'metafunction')
     self.assertEqual(entry.name, 'Klass#Metafunction')
     self.assertEqual(entry.return_type, 'TInt')
     self.assertEqual(entry.return_name, 'VALUE')
     self.assertEqual(len(entry.tparams), 0)
     txt = 'TInt Klass#Metafunction<>::VALUE;'
     self.assertEqual(entry.toString(), txt)
Beispiel #11
0
 def testDestructorNoParams(self):
     txt = 'String::~String()'
     parser = sig_parser.SigParser(txt)
     entry = parser.parse()
     self.assertEqual(entry.kind, 'function')
     self.assertEqual(entry.name, 'String::~String')
     self.assertEqual(entry.return_type, None)
     self.assertEqual(entry.is_tpl, False)
     self.assertEqual(len(entry.params), 0)
     txt = 'String::~String();'
     self.assertEqual(entry.toString(), txt)
Beispiel #12
0
 def testTypeWithParam(self):
     txt = 'Metafunction<T1, T2>::Type'
     parser = sig_parser.SigParser(txt)
     entry = parser.parse()
     self.assertEqual(entry.kind, 'metafunction')
     self.assertEqual(entry.name, 'Metafunction')
     self.assertEqual(entry.return_name, 'Type')
     self.assertEqual(len(entry.tparams), 2)
     self.assertEqual(entry.tparams[0].name, 'T1')
     self.assertEqual(entry.tparams[1].name, 'T2')
     txt = 'Metafunction<T1, T2>::Type;'
     self.assertEqual(entry.toString(), txt)
Beispiel #13
0
 def testValueWithParam(self):
     txt = 'TInt Metafunction<T1, T2>::VALUE'
     parser = sig_parser.SigParser(txt)
     entry = parser.parse()
     self.assertEqual(entry.kind, 'metafunction')
     self.assertEqual(entry.name, 'Metafunction')
     self.assertEqual(entry.return_type, 'TInt')
     self.assertEqual(entry.return_name, 'VALUE')
     self.assertEqual(len(entry.tparams), 2)
     self.assertEqual(entry.tparams[0].name, 'T1')
     self.assertEqual(entry.tparams[1].name, 'T2')
     txt = 'TInt Metafunction<T1, T2>::VALUE;'
     self.assertEqual(entry.toString(), txt)
Beispiel #14
0
 def testWithParams(self):
     txt = 'void foo(int x, double y)'
     parser = sig_parser.SigParser(txt)
     entry = parser.parse()
     self.assertEqual(entry.kind, 'function')
     self.assertEqual(entry.return_type, 'void')
     self.assertEqual(entry.is_tpl, False)
     self.assertEqual(len(entry.params), 2)
     self.assertEqual(entry.params[0].type, 'int')
     self.assertEqual(entry.params[0].name, 'x')
     self.assertEqual(entry.params[1].type, 'double')
     self.assertEqual(entry.params[1].name, 'y')
     txt = 'void foo(int x, double y);'
     self.assertEqual(entry.toString(), txt)
Beispiel #15
0
 def testWithParams(self):
     txt = ('template <typename T1, int I>\n' 'class C')
     parser = sig_parser.SigParser(txt)
     entry = parser.parse()
     self.assertEqual(entry.kind, 'class')
     self.assertEqual(entry.is_tpl, True)
     self.assertEqual(len(entry.tparams), 2)
     self.assertEqual(entry.name, 'C')
     self.assertEqual(entry.tparams[0].type, 'typename')
     self.assertEqual(entry.tparams[0].name, 'T1')
     self.assertEqual(entry.tparams[1].type, 'int')
     self.assertEqual(entry.tparams[1].name, 'I')
     txt = ('template <typename T1, int I>\n' 'class C;')
     self.assertEqual(entry.toString(), txt)
Beispiel #16
0
 def testEmptyParams(self):
     txt = ('template <typename T1, int I>\n' 'void foo()')
     parser = sig_parser.SigParser(txt)
     entry = parser.parse()
     self.assertEqual(entry.kind, 'function')
     self.assertEqual(entry.return_type, 'void')
     self.assertEqual(entry.is_tpl, True)
     self.assertEqual(len(entry.params), 0)
     self.assertEqual(len(entry.tparams), 2)
     self.assertEqual(entry.tparams[0].type, 'typename')
     self.assertEqual(entry.tparams[0].name, 'T1')
     self.assertEqual(entry.tparams[1].type, 'int')
     self.assertEqual(entry.tparams[1].name, 'I')
     txt = ('template <typename T1, int I>\n' 'void foo();')
     self.assertEqual(entry.toString(), txt)