Ejemplo n.º 1
0
 def __init__(self, mod_prefix, yinNode):
     #yinNode.cpp_type = iutil.namingConvert_Luc(yinNode.getKeyPath())
     new_cpp_type = None
     if yinNode.match('container'):
         new_cpp_type = 'c_' + iutil.namingConvert_Luc(yinNode.identifier)
         yinNode.cpp_type = new_cpp_type
     else:
         # is list_item
         new_cpp_type = 'l_' + iutil.namingConvert_Luc(yinNode.identifier)
     ormClass.__init__(self, mod_prefix, yinNode, new_cpp_type)
     
     self.mf_getElementType.impBody = []
     self.mf_getElementType.impBody.append('return E_Element_Container;')
     
     self.isListItem = False
Ejemplo n.º 2
0
 def __init__(self, mod_prefix, yinNode):
     yinNode.cpp_type = iutil.namingConvert_Luc(yinNode.identifier)
     ormClass.__init__(self, mod_prefix, yinNode, yinNode.cpp_type)
     
     self.mf_getElementType.impBody = []
     self.mf_getElementType.impBody.append('return E_Element_Leaf_List;')
     
     # Vector part
     self.leafType = None
     self.itemName = None
Ejemplo n.º 3
0
    def __init__(self, mod_prefix, yinNode):
        yinNode.cpp_type = 'ca_' + iutil.namingConvert_Luc(yinNode.identifier)
        ormClass.__init__(self, mod_prefix, yinNode, yinNode.cpp_type)

        self.mf_getElementType.impBody = []
        self.mf_getElementType.impBody.append('return E_Element_Case;')
        
        self.mf_getCaseName = simple_syntax.function(yin_common.tString, 'getCaseName', [])
        self.mf_getCaseName.inline = True
        self.mf_getCaseName.impBody = []
        self.mf_getCaseName.impBody.append('return %s(\"%s\");' % (yin_common.tString, self.yinNode.identifier))
Ejemplo n.º 4
0
 def output_with_namespace(self):
     out = list()
     out.append('namespace %s {' % iutil.namingConvert_Luc(self.namespace))
     for subNode in self.subNodes:
         for o in subNode.output():
             out.append(iutil.tab + o)
     for c in self.contents:
         out.append(c)
     out.append('')
     out.append('}')
     return out
Ejemplo n.º 5
0
    def __init__(self, mod_prefix, yinNode):
        #yinNode.cpp_type = iutil.namingConvert_Luc(yinNode.getKeyPath())
        #new_cpp_type = iutil.namingConvert_Luc(yinNode.getKeyPath()) + '_lm'
        new_cpp_type = 'lm_' + iutil.namingConvert_Luc(yinNode.identifier)
        yinNode.cpp_type = new_cpp_type
        map_item_type = 'l_' + iutil.namingConvert_Luc(yinNode.identifier)
        ormClass.__init__(self, mod_prefix, yinNode, new_cpp_type)
        
        self.mf_getElementType.impBody = []
        self.mf_getElementType.impBody.append('return E_Element_List;')
        
        # Map part
        self.itemName = map_item_type
        self.itemPair = ('%s_map_pair' % self.itemName)
        self.itemMap = ('%s_map' % self.itemName)
        self.itemIter = ('%s_map_iter' % self.itemName)
        
        mv = simple_syntax.variable(self.itemIter, 'iter')
        mv.complex = True
        self.pri_memb.append(mv)
                
        # Special functions for list
        self.mf_beginInst = simple_syntax.function('bool', 'beginInst', [])
        self.mf_beginInst.inline = True
        self.mf_beginInst.impBody.append("iter = list_m.begin();")
        self.mf_beginInst.impBody.append("return iter != list_m.end();")

        self.mf_isNextInstAvail = simple_syntax.function('bool', 'isNextInstAvail', [])
        self.mf_isNextInstAvail.inline = True
        #self.mf_isNextInstAvail.impBody.append("iter = %s.begin();\n" % self.itemName)
        self.mf_isNextInstAvail.impBody.append("return iter != list_m.end();")
        
        self.mf_getNextInst = simple_syntax.function('bool', 'getNextInst', [])
        self.mf_getNextInst.inline = True
        self.mf_getNextInst.impBody.append("iter ++;")
        self.mf_getNextInst.impBody.append("return true;")
        
        self.mf_flushInstances = simple_syntax.function('bool', 'flushInstances', [])
        self.mf_flushInstances.inline = True
        self.mf_flushInstances.impBody.append("list_m.clear();")
        self.mf_flushInstances.impBody.append("return true;")
Ejemplo n.º 6
0
    def __init__(self, mod_prefix, yinNode):
        yinNode.cpp_type = 'ch_' + iutil.namingConvert_Luc(yinNode.identifier)
        ormClass.__init__(self, mod_prefix, yinNode, yinNode.cpp_type)

        self.cases = {}

        self.mf_getElementType.impBody = []
        self.mf_getElementType.impBody.append('return E_Element_Choice;')

        self.mv_curCase = simple_syntax.variable(yin_common.tString, 'm_curCase')
        self.pri_memb.append(self.mv_curCase)
        
        self.mf_getCurCase = simple_syntax.function(yin_common.tString, 'getCurCase', [])
        self.mf_getCurCase.impBody = []
        self.mf_getCurCase.impBody.append('return %s;' % self.mv_curCase.identifier)
        self.pub_func.append(self.mf_getCurCase)
    
        params = [simple_syntax.var_param(yin_common.tString, 'strCase', False, True, False, False, False)]
        self.mf_setCurCase = simple_syntax.function('bool', 'setCurCase', params)
        self.pub_func.append(self.mf_setCurCase)
Ejemplo n.º 7
0
 def get_namespace_ident(self):
     return iutil.namingConvert_Luc(self.namespace)