diff -r 42188c7ea2d9 -r 82f11024044a Orb/python/doxygen/linkinserter.py --- a/Orb/python/doxygen/linkinserter.py Thu Jan 21 17:29:01 2010 +0000 +++ b/Orb/python/doxygen/linkinserter.py Thu Mar 18 18:26:18 2010 +0000 @@ -18,6 +18,7 @@ import os.path import logging import shutil +from guidiser import Guidiser __version__ = "0.1" @@ -28,6 +29,9 @@ string representation with inserted ids for linking to cxxFunctions. """ + def __init__(self, guidise=False): + self.guidiser = Guidiser() + self.guidise = guidise def _get_cxxfunction_elems(self, elem): """ Takes an elements and generates a list of all child elements that are called cxxFunction @@ -82,6 +86,9 @@ function_scoped_name+="::" apiname_id = "".join([function_scoped_name,func_elem.find("apiName").text,"()"]) + + if self.guidise: + apiname_id = self.guidiser._get_guid(apiname_id) func_elem.find("apiName").attrib["id"] = apiname_id return func_elem @@ -160,7 +167,7 @@ def insertlinks(xml_dir): - link_inserter = LinkInserter(LinkFile()) + link_inserter = LinkInserter(LinkFile(guidise=True)) link_inserter.linkify_dir(xml_dir) @@ -391,7 +398,120 @@ returned = self.link_file.get_linkified(file_as_string) self.assertEquals(etree.fromstring(returned).find("cxxFunction/apiName").attrib["id"], "BTrace::Init0()") + + def test__insert_a_guidised_id_into_cxxfunction_apiname(self): + self.link_file = LinkFile(guidise=True) + func_str = """ + Init0 + + + + + + void + BTrace + static void Init0(TUint32 a0) + BTrace::Init0(TUint32 a0) + + + + TUint32 + + a0 + + + + + + + + + + + + + + """ + func_elem = etree.fromstring(func_str) + returned = self.link_file._insert_id_into_cxxfunction_apiname(func_elem) + self.assertEquals(returned.find("apiName").attrib["id"], "GUID-C8A77671-4E2F-3290-9592-84A70B14F88D") + def test__insert_a_guidised_id_into_cxxfunction_apiname_when_the_cxxfunction_has_no_scoped_name(self): + self.link_file = LinkFile(guidise=True) + func_str = """ + Init0 + + + + + + void + + static void Init0(TUint32 a0) + BTrace::Init0(TUint32 a0) + + + + TUint32 + + a0 + + + + + + + + + + + + + + """ + func_elem = etree.fromstring(func_str) + returned = self.link_file._insert_id_into_cxxfunction_apiname(func_elem) + self.assertEquals(returned.find("apiName").attrib["id"], "GUID-76C4A377-8597-3952-9E6B-3E61D068EE38") + + def test_i_can_insert_a_guidised_id_to_a_cxxfunction_apiname(self): + self.link_file = LinkFile(guidise=True) + file_as_string = """ + + + Init0 + + + + + + void + BTrace + static void Init0(TUint32 a0) + BTrace::Init0(TUint32 a0) + + + + TUint32 + + a0 + + + + + + + + + + + + + + + """ + returned = self.link_file.get_linkified(file_as_string) + self.assertEquals(etree.fromstring(returned).find("cxxFunction/apiName").attrib["id"], "GUID-C8A77671-4E2F-3290-9592-84A70B14F88D") + basic_class_file_str = """\