• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python strFunctions.cap函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中strFunctions.cap函数的典型用法代码示例。如果您正苦于以下问题:Python cap函数的具体用法?Python cap怎么用?Python cap使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了cap函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: writeLocal

def writeLocal(fileOut, name, classes):
  capName = name.upper()
  fileOut.write('#ifdef USE_{0}\n\n'.format(capName))
  fileOut.write('SBMLCONSTRUCTOR_EXCEPTION({0}PkgNamespaces)\n'.format(strFunctions.cap(name)))
  for i in range (0, len(classes)):
    if classes[i]['typecode'] != 'HACK':
      fileOut.write('SBMLCONSTRUCTOR_EXCEPTION({0})\n'.format(classes[i]['name']))
  for i in range (0, len(classes)):
    if (classes[i]['hasListOf'] == True):
      loName = strFunctions.listOfName(classes[i]['name'])
      fileOut.write('SBMLCONSTRUCTOR_EXCEPTION({0})\n'.format(strFunctions.cap(loName)))
  fileOut.write('\n')
  
  for i in range (0, len(classes)):
    if (classes[i]['abstract'] == True or isBaseClassForOthers(classes[i], classes)):
      fileOut.write('/**\n')
      fileOut.write(' * Convert {0} objects into the most specific object possible.\n'.format(classes[i]['name']))
      fileOut.write(' */\n')
      fileOut.write('%typemap(out) {0}*\n'.format(classes[i]['name']))
      fileOut.write('{\n')
      fileOut.write('	$result = SWIG_NewPointerObj($1, GetDowncastSwigTypeForPackage($1, "{0}"), $owner | %newpointer_flags);\n'.format(name))
      fileOut.write('}\n')
      fileOut.write('\n')
  fileOut.write('\n')
  fileOut.write('#endif // USE_{0} \n\n'.format(capName))
开发者ID:skeating,项目名称:auto-generator,代码行数:25,代码来源:writeBindingsFiles.py


示例2: parseAttribute

def parseAttribute(attrib):
  attName = attrib['name']
  capAttName = strFunctions.cap(attName)
  reqd = attrib['reqd']
  if attrib['type'] == 'SId':
    attType = 'string'
    attTypeCode = 'std::string&'
    num = False
  elif attrib['type'] == 'SIdRef':
    attType = 'string'
    attTypeCode = 'std::string&'
    num = False
  elif attrib['type'] == 'UnitSIdRef':
    attType = 'string'
    attTypeCode = 'std::string&'
    num = False
  elif attrib['type'] == 'UnitSId':
    attType = 'string'
    attTypeCode = 'std::string&'
    num = False
  elif attrib['type'] == 'string':
    attType = 'string'
    attTypeCode = 'std::string&'
    num = False
  elif attrib['type'] == 'double':
    attType = 'double'
    attTypeCode = 'double'
    num = True
  elif attrib['type'] == 'int':
    attType = 'integer'
    attTypeCode = 'int'
    num = True
  elif attrib['type'] == 'uint':
    attType = 'unsigned integer'
    attTypeCode = 'unsigned int'
    num = True
  elif attrib['type'] == 'bool':
    attType = 'boolean'
    attTypeCode = 'bool'
    num = False
  elif attrib['type'] == 'element':
    attType = 'element'
    if attrib['name'] == 'math' or attrib['name'] == 'Math':
      attTypeCode = 'ASTNode*'
    else:
      #attTypeCode = 'element-not-done'
      if attrib.has_key('element'):
	    attTypeCode = '{0}*'.format(attrib['element'])
      else:
        attTypeCode = '{0}*'.format(strFunctions.cap(attrib['name']))
    num = False
  elif attrib['type'] == 'lo_element':
    attType = 'lo_element'
    attTypeCode = attrib['element']
    num = False
  else:
    attType = 'FIX ME'
    attTypeCode = 'FIX ME'
    num = False
  return [attName, capAttName, attType, attTypeCode, num, reqd]
开发者ID:hsorby,项目名称:libSEDML,代码行数:60,代码来源:generalFunctions.py


示例3: writePlugins

def writePlugins(fileOut, name, plugins):
  capName = name.upper()
  fileOut.write('#ifdef USE_{0}\n'.format(capName))
  fileOut.write('if (pkgName == "{0}")\n'.format(name))
  fileOut.write('{\n')
  for i in range (0, len(plugins)):
    plugin = plugins[i]
    if (i == 0):
      fileOut.write('  if ')
    else:
      fileOut.write('  else if ')
    typecode = 'SBML_{0}'.format(createSBase(plugin['sbase'].upper()))
    if plugin.has_key('typecode') and plugin['typecode'] != None:
      typecode = plugin['typecode']
    fileOut.write('(sb->getTypeCode() == {0})\n'.format(typecode))
    fileOut.write('  {\n')
    if typecode != 'SBML_LIST_OF':
      fileOut.write('    return SWIGTYPE_p_{0}{1}Plugin;\n'.format(strFunctions.cap(name), plugin['sbase']))
    else:

      fileOut.write('    std::string name = sb->getElementName();\n')
      fileOut.write('    if(name == "{0}")\n'.format(strFunctions.lowerFirst(plugin['sbase'])))
      fileOut.write('      return SWIGTYPE_p_{0}{1}Plugin;\n'.format(strFunctions.cap(name), plugin['sbase']))
    
    fileOut.write('  }\n')
  fileOut.write('}\n')
  fileOut.write('\n')
  fileOut.write('#endif // USE_{0} \n\n'.format(capName))
开发者ID:skeating,项目名称:auto-generator,代码行数:28,代码来源:writeBindingsFiles.py


示例4: writeCreateObject

def writeCreateObject(outFile, element, sbmltypecode, attribs, isSedListOf, hasChildren=False, hasMath=False,baseClass='SedBase'):  
  if (isSedListOf == True or hasChildren == False) and baseClass  == 'SedBase':
    return;
  outFile.write('/**\n')
  outFile.write(' * return the SEDML object corresponding to next XMLToken.\n')
  outFile.write(' */\n')
  outFile.write('SedBase*\n{0}::createObject(XMLInputStream& stream)\n'.format(element))
  outFile.write('{\n')
  if baseClass == 'SedBase':
    outFile.write('\tSedBase* object = NULL;\n\n')
  else:
    outFile.write('\tSedBase* object = {0}::createObject(stream);\n\n'.format(baseClass))
  if hasChildren or hasMath:
    outFile.write('\tconst string& name   = stream.peek().getName();\n\n')
  for i in range (0, len(attribs)):
    current = attribs[i]
    if current.has_key('lo_elementName'):        
      outFile.write('\tif (name == "{0}")\n'.format(current['lo_elementName']))	
      outFile.write('\t{\n')	
      outFile.write('\t\tobject = &m{0};\n'.format(strFunctions.capp(current['name'])))	
      outFile.write('\t}\n\n')
    elif current['type'] == 'lo_element':
      outFile.write('\tif (name == "listOf{0}")\n'.format(strFunctions.capp(current['name'])))	
      outFile.write('\t{\n')	
      outFile.write('\t\tobject = &m{0};\n'.format(strFunctions.capp(current['name'])))	
      outFile.write('\t}\n\n')
    elif current['type'] == 'element' and (current['name'] !='Math' and current['name'] != 'math'):
      outFile.write('\tif (name == "{0}")\n'.format(current['name']))	
      outFile.write('\t{\n')	
      outFile.write('\t\tm{0}= new {1}();\n'.format(strFunctions.cap(current['name']), current['element']))	
      outFile.write('\t\tobject = m{0};\n'.format(strFunctions.cap(current['name'])))	
      outFile.write('\t}\n\n')
  outFile.write('\tconnectToChild();\n\n')
  outFile.write('\treturn object;\n')  
  outFile.write('}\n\n\n')  
开发者ID:jeicher,项目名称:libSEDML,代码行数:35,代码来源:generalFunctions.py


示例5: writeCopyAttributes

def writeCopyAttributes(attrs, output, tabs, name):
  for i in range(0, len(attrs)):
    attName = strFunctions.cap(attrs[i]['name'])
    atttype = attrs[i]['type']
    if atttype == 'array':
      output.write('{0}m{1}  = NULL;\n'.format(tabs, attName, name))
      output.write('{0}set{1}({2}.m{1}, {2}.m{1}Length);\n'.format(tabs, attName, name))
    elif atttype != 'lo_element' and  atttype != 'inline_lo_element':
      if atttype != 'element':
        output.write('{0}m{1}  = {2}.m{1};\n'.format(tabs, attName, name))
      else:
        output.write('{0}if ({2}.m{1} != NULL)\n'.format(tabs, strFunctions.cap(attrs[i]['name']), name))
        output.write('{0}'.format(tabs))
        output.write('{\n')
        if attrs[i]['name'] != 'math':
          output.write('{0}  m{1} = {2}.m{1}->clone();\n'.format(tabs, strFunctions.cap(attrs[i]['name']), name))
        else:
          output.write('{0}  m{1} = {2}.m{1}->deepCopy();\n'.format(tabs, strFunctions.cap(attrs[i]['name']), name))
        output.write('{0}'.format(tabs))
        output.write('}\n')
        output.write('{0}else\n'.format(tabs))
        output.write('{0}'.format(tabs))
        output.write('{\n')
        output.write('{0}  m{1} = NULL;\n'.format(tabs, strFunctions.cap(attrs[i]['name'])))
        output.write('{0}'.format(tabs))
        output.write('}\n')
    else:
      if attName.endswith('x'):
        output.write('{0}m{1}es  = {2}.m{1}es;\n'.format(tabs, attName, name))
      elif attName.endswith('s'):
        output.write('{0}m{1}  = {2}.m{1};\n'.format(tabs, attName, name))
      else:
        output.write('{0}m{1}s  = {2}.m{1}s;\n'.format(tabs, attName, name))
    if atttype == 'double' or atttype == 'int' or atttype == 'uint' or atttype == 'bool':
      output.write('{0}mIsSet{1}  = {2}.mIsSet{1};\n'.format(tabs, attName, name))
开发者ID:skeating,项目名称:auto-generator,代码行数:35,代码来源:writeCode.py


示例6: writeWriteElementsCPPCode

def writeWriteElementsCPPCode(outFile, element, attributes, hasChildren=False, hasMath=False, baseClass='SedBase'):
  writeInternalStart(outFile)
  outFile.write('/*\n')
  outFile.write(' * write contained elements\n')
  outFile.write(' */\n')
  outFile.write('void\n{0}::writeElements (XMLOutputStream& stream) const\n'.format(element))
  outFile.write('{\n')
  outFile.write('\t{0}::writeElements(stream);\n'.format(baseClass))
  if hasChildren == True:
    for i in range(0, len(attributes)):
      if attributes[i]['type'] == 'element' and (attributes[i]['name'] != 'Math' and attributes[i]['name'] != 'math'):
        outFile.write('\tif (isSet{0}() == true)\n'.format(strFunctions.cap(attributes[i]['name'])))
        outFile.write('\t{\n\t\t')
        outFile.write('m{0}->write(stream);'.format(strFunctions.cap(attributes[i]['name'])))
        outFile.write('\n\t}\n')
      if attributes[i]['type'] == 'lo_element':
        outFile.write('\tif (getNum{0}s() > 0)\n'.format(strFunctions.cap(attributes[i]['name'])))
        outFile.write('\t{\n\t\t')
        outFile.write('m{0}.write(stream);'.format(strFunctions.cap(attributes[i]['name'])))
        outFile.write('\n\t}\n')
  if hasMath == True:
    for i in range(0, len(attributes)):
      if attributes[i]['type'] == 'element' and attributes[i]['name'] == 'Math' or attributes[i]['name'] == 'math':
        outFile.write('\tif (isSet{0}() == true)\n'.format('Math'))
        outFile.write('\t{\n\t\twriteMathML(getMath(), stream, NULL);\n\t}\n')
  outFile.write('}\n\n\n')
  writeInternalEnd(outFile)
开发者ID:hsorby,项目名称:libSEDML,代码行数:27,代码来源:generalFunctions.py


示例7: writeCopyAttributes

def writeCopyAttributes(attrs, output, tabs, name):
  for i in range(0, len(attrs)):
    attName = strFunctions.cap(attrs[i]['name'])
    atttype = attrs[i]['type']
    if atttype == 'element' and attName == 'Math':
      output.write('{0}m{1}  = {2}.m{1} != NULL ? {2}.m{1}->deepCopy() : NULL;\n'.format(tabs, strFunctions.cap(attrs[i]['name']), name))
    else:
      output.write('{0}m{1}  = {2}.m{1};\n'.format(tabs, strFunctions.cap(attrs[i]['name']), name))
    if atttype == 'double' or atttype == 'int' or atttype == 'uint' or atttype == 'bool':
      output.write('{0}mIsSet{1}  = {2}.mIsSet{1};\n'.format(tabs, strFunctions.cap(attrs[i]['name']), name))
开发者ID:hsorby,项目名称:libSEDML,代码行数:10,代码来源:writeCode.py


示例8: writeReadOtherXMLCPPCode

def writeReadOtherXMLCPPCode(outFile, element, hasMath = True, attribs = None, baseClass='SedBase'):
  writeInternalStart(outFile)
  outFile.write('bool\n{0}::readOtherXML (XMLInputStream& stream)\n'.format(element))
  outFile.write('{\n')
  outFile.write('  bool          read = false;\n')
  outFile.write('  const string& name = stream.peek().getName();\n\n')
  if hasMath == True: 
    outFile.write('  if (name == "math")\n  {\n')
    outFile.write('    const XMLToken elem = stream.peek();\n')
    outFile.write('    const std::string prefix = checkMathMLNamespace(elem);\n\n')
    #outFile.write('    if (stream.getSedNamespaces() == NULL)\n    {\n')
    #outFile.write('      stream.setSedNamespaces(new SedNamespaces(getLevel(), getVersion()));\n    }\n\n')
    outFile.write('    delete mMath;\n')
    outFile.write('    mMath = readMathML(stream, prefix);\n')
    #outFile.write('    if (mMath != NULL)\n    {\n      mMath->setParentSEDMLObject(this);\n    }\n')
    outFile.write('    read = true;\n  }\n\n')
  elif containsType(attribs, 'XMLNode*'):
    node = getByType(attribs, 'XMLNode*')
    outFile.write('  if (name == "{0}")\n'.format(node['name']))
    outFile.write('  {\n')	
    outFile.write('    const XMLToken& token = stream.next();\n')	
    outFile.write('    stream.skipText();\n')	
    outFile.write('    m{0} = new XMLNode(stream);\n'.format(strFunctions.cap(node['name'])))	
    outFile.write('    stream.skipPastEnd(token);\n')	
    outFile.write('    read = true;\n  }\n\n')
  elif containsType(attribs, 'DimensionDescription*'):
    node = getByType(attribs, 'DimensionDescription*')
    outFile.write('  if (name == "{0}")\n'.format(node['name']))
    outFile.write('  {\n')	
    outFile.write('    const XMLToken& token = stream.next();\n')	
    outFile.write('    m{0} = new DimensionDescription();\n'.format(strFunctions.cap(node['name'])))	
    outFile.write('    m{0}->read(stream);\n'.format(strFunctions.cap(node['name'])))	
    outFile.write('    stream.skipPastEnd(token);\n')	
    outFile.write('    read = true;\n  }\n\n')
  elif containsType(attribs, 'std::vector<double>'):
    elem = getByType(attribs, 'std::vector<double>')
    outFile.write('  while (stream.peek().getName() == "{0}")\n'.format(elem['name']))
    outFile.write('  {\n')
    outFile.write('    stream.next(); // consume start\n')
    outFile.write('    stringstream text;\n')
    outFile.write('    while(stream.isGood() && stream.peek().isText())\n')
    outFile.write('      text << stream.next().getCharacters();\n')
    outFile.write('    double value; text >> value;\n')
    outFile.write('    if (!text.fail())\n')
    outFile.write('      m{0}.push_back(value);\n'.format(strFunctions.capp(elem['name'])))
    outFile.write('    stream.next(); // consume end\n')
    outFile.write('    read = true;\n')
    outFile.write('  }\n')
  outFile.write('  if ({0}::readOtherXML(stream))\n'.format(baseClass))
  outFile.write('  {\n    read = true;\n  }\n')
  outFile.write('  return read;\n')
  outFile.write('}\n\n\n')
  writeInternalEnd(outFile)
开发者ID:0u812,项目名称:libSEDML,代码行数:53,代码来源:generalFunctions.py


示例9: writeCopyAttributes

def writeCopyAttributes(attrs, output, tabs, name):
  for i in range(0, len(attrs)):
    attName = strFunctions.cap(attrs[i]['name'])
    atttype = attrs[i]['type']
    if atttype == 'element' and attName == 'Math':
      output.write('{0}m{1}  = {2}.m{1} != NULL ? {2}.m{1}->deepCopy() : NULL;\n'.format(tabs, strFunctions.cap(attrs[i]['name']), name))
    elif atttype == 'XMLNode*' or atttype == 'DimensionDescription*':
      output.write('{0}m{1}  = {2}.m{1} != NULL ? {2}.m{1}->clone() : NULL;\n'.format(tabs, strFunctions.cap(attrs[i]['name']), name))
    else:
      output.write('{0}m{1}  = {2}.m{1};\n'.format(tabs, strFunctions.capp(attrs[i]['name'], atttype == 'lo_element' or atttype == 'std::vector<double>'), name))
    if atttype == 'double' or atttype == 'int' or atttype == 'uint' or atttype == 'bool':
      output.write('{0}mIsSet{1}  = {2}.mIsSet{1};\n'.format(tabs, strFunctions.cap(attrs[i]['name']), name))
开发者ID:0u812,项目名称:libSEDML,代码行数:12,代码来源:writeCode.py


示例10: writeJavaNS

def writeJavaNS(fileOut, name):
  capName = name.upper()
  fileOut.write('/**\n')
  fileOut.write(' * casting to most specific SBMLNamespaces object\n */\n\n')
  fileOut.write('#ifdef USE_{0}\n'.format(capName))
  fileOut.write('%pragma(java) modulecode =\n')
  fileOut.write('%{\n')
  fileOut.write('  if (ns.hasURI({0}Extension.getXmlnsL3V1V1()))\n'.format(strFunctions.cap(name)))
  fileOut.write('  {\n')
  fileOut.write('    return new {0}PkgNamespaces(cPtr, owner);\n'.format(strFunctions.cap(name)))
  fileOut.write('  }\n')
  fileOut.write('%}\n')
  fileOut.write('#endif /* USE_{0} */\n\n'.format(capName))
开发者ID:skeating,项目名称:auto-generator,代码行数:13,代码来源:writeBindingsFiles.py


示例11: writeAtt

def writeAtt(atttype, name, output, constType, pkg):
  if atttype == 'SId' or atttype == 'SIdRef' or atttype == 'UnitSId' or atttype == 'UnitSIdRef' or atttype == 'string':
    output.write('\t, m{0} ("")\n'.format(strFunctions.cap(name)))
  elif atttype == 'element' or atttype == 'XMLNode*':
    output.write('\t, m{0} (NULL)\n'.format(strFunctions.cap(name)))
  elif atttype == 'lo_element':
    output.write('\t, m{0} ('.format(strFunctions.capp(name)))
    if constType == 0:
      output.write(')\n')
    elif constType == 1:
      output.write('level, version)\n')
    elif constType == 2:
      output.write('{0}ns)\n'.format(pkg))
  elif atttype == 'double':
    output.write('\t, m{0} (numeric_limits<double>::quiet_NaN())\n'.format(strFunctions.cap(name)))
    output.write('\t, mIsSet{0} (false)\n'.format(strFunctions.cap(name)))
  elif atttype == 'int' or atttype == 'uint':
    output.write('\t, m{0} (SEDML_INT_MAX)\n'.format(strFunctions.cap(name)))
    output.write('\t, mIsSet{0} (false)\n'.format(strFunctions.cap(name)))
  elif atttype == 'bool':
    output.write('\t, m{0} (false)\n'.format(strFunctions.cap(name)))
    output.write('\t, mIsSet{0} (false)\n'.format(strFunctions.cap(name)))
  elif atttype == 'std::vector<double>':
    output.write('\t, m{0} ()\n'.format(strFunctions.capp(name)))
  else:
    output.write('\tFIX ME   {0};\n'.format(name))
开发者ID:jeicher,项目名称:libSEDML,代码行数:26,代码来源:writeCode.py


示例12: writeListOfSubFunctions

def writeListOfSubFunctions(attrib, output, element, elementDict):
  loname = generalFunctions.writeListOf(strFunctions.cap(attrib['name']))
  output.write('  /**\n')
  output.write('   * Returns the  \"{0}\"'.format(loname))
  output.write(' in this {0} object.\n'.format(element))
  output.write('   *\n')
  output.write('   * @return the \"{0}\"'.format(loname))
  output.write(' attribute of this {0}.\n'.format(element))
  output.write('   */\n')
  output.write('  const {0}*'.format(loname))
  output.write(' getListOf{0}s() const;\n\n\n'.format(strFunctions.cap(attrib['name'])))
  writeListOfHeader.writeGetFunctions(output, strFunctions.cap(attrib['name']), attrib['element'], True, element)
  output.write('  /**\n')
  output.write('   * Adds a copy the given \"{0}\" to this {1}.\n'.format(attrib['element'], element))
  output.write('   *\n')
  output.write('   * @param {0}; the {1} object to add\n'.format(strFunctions.objAbbrev(attrib['element']), attrib['element']))
  output.write('   *\n')
  output.write('   * @return integer value indicating success/failure of the\n')
  output.write('   * function.  @if clike The value is drawn from the\n')
  output.write('   * enumeration #OperationReturnValues_t. @endif The possible values\n')
  output.write('   * returned by this function are:\n')
  output.write('   * @li LIBSEDML_OPERATION_SUCCESS\n')
  output.write('   * @li LIBSEDML_INVALID_ATTRIBUTE_VALUE\n')
  output.write('   */\n')
  output.write('  int add{0}(const {1}* {2});\n\n\n'.format(strFunctions.cap(attrib['name']), attrib['element'], strFunctions.objAbbrev(attrib['element'])))
  output.write('  /**\n')
  output.write('   * Get the number of {0} objects in this {1}.\n'.format(attrib['element'], element))
  output.write('   *\n')
  output.write('   * @return the number of {0} objects in this {1}\n'.format(attrib['element'], element))
  output.write('   */\n')
  output.write('  unsigned int getNum{0}s() const;\n\n\n'.format(strFunctions.cap(attrib['name'])))
  if attrib.has_key('abstract') == False or (attrib.has_key('abstract') and attrib['abstract'] == False):
    output.write('  /**\n')
    output.write('   * Creates a new {0} object, adds it to this {1}s\n'.format(attrib['element'], element))
    output.write('   * {0} and returns the {1} object created.\n'.format(loname, attrib['element']))
    output.write('   *\n')
    output.write('   * @return a new {0} object instance\n'.format(attrib['element']))
    output.write('   *\n')
    output.write('   * @see add{0}(const {1}* {2})\n'.format(strFunctions.cap(attrib['name']), attrib['element'], strFunctions.objAbbrev(attrib['element'])))
    output.write('   */\n')
    output.write('  {0}* create{1}();\n\n\n'.format(attrib['element'], strFunctions.cap(attrib['name'])))
  elif attrib.has_key('concrete'):
    for elem in attrib['concrete']:
      output.write('  /**\n')
      output.write('   * Creates a new {0} object, adds it to this {1}s\n'.format(elem['element'], element))
      output.write('   * {0} and returns the {1} object created.\n'.format(loname, elem['element']))
      output.write('   *\n')
      output.write('   * @return a new {0} object instance\n'.format(elem['element']))
      output.write('   *\n')
      output.write('   * @see add{0}(const {0}* {1})\n'.format(attrib['element'], strFunctions.objAbbrev(attrib['element'])))
      output.write('   */\n')
      output.write('  {0}* create{1}();\n\n\n'.format(elem['element'], strFunctions.cap(elem['name'])))
  writeListOfHeader.writeRemoveFunctions(output, strFunctions.cap(attrib['name']), attrib['element'], True, element)
开发者ID:0u812,项目名称:libSEDML,代码行数:53,代码来源:writeHeader.py


示例13: writeUnsetFunction

def writeUnsetFunction(attrib, output, element):
  attName = attrib['name']
  capAttName = strFunctions.cap(attName)
  if attrib['type'] == 'lo_element' or attrib['type'] == 'inline_lo_element':
    return
  elif attrib['type'] == 'element':
    output.write('  /**\n')
    output.write('   * Unsets the \"{0}\"'.format(attName))
    output.write(' element of this {0}.\n'.format(element))
    output.write('   *\n')
    output.write('   * @return integer value indicating success/failure of the\n')
    output.write('   * function.  @if clike The value is drawn from the\n')
    output.write('   * enumeration #OperationReturnValues_t. @endif The possible values\n')
    output.write('   * returned by this function are:\n')
    output.write('   * @li LIBSBML_OPERATION_SUCCESS\n')
    output.write('   * @li LIBSBML_OPERATION_FAILED\n')
    output.write('   */\n')
    output.write('  virtual int unset{0}();\n\n\n'.format(capAttName))
  else:
    output.write('  /**\n')
    output.write('   * Unsets the value of the \"{0}\"'.format(attName))
    output.write(' attribute of this {0}.\n'.format(element))
    output.write('   *\n')
    output.write('   * @return integer value indicating success/failure of the\n')
    output.write('   * function.  @if clike The value is drawn from the\n')
    output.write('   * enumeration #OperationReturnValues_t. @endif The possible values\n')
    output.write('   * returned by this function are:\n')
    output.write('   * @li LIBSBML_OPERATION_SUCCESS\n')
    output.write('   * @li LIBSBML_OPERATION_FAILED\n')
    output.write('   */\n')
    output.write('  virtual int unset{0}();\n\n\n'.format(capAttName))
开发者ID:skeating,项目名称:auto-generator,代码行数:31,代码来源:writeHeader.py


示例14: writeSetDocCPPCode

def writeSetDocCPPCode(outFile, element,attribs, baseClass='SedBase'):
  writeInternalStart(outFile)
  outFile.write('/*\n')
  outFile.write(' * Sets the parent SedDocument.\n')
  outFile.write(' */\n')
  outFile.write('void\n{0}::setSedDocument (SedDocument* d)\n'.format(element))
  outFile.write('{\n')
  outFile.write('\t{0}::setSedDocument(d);\n'.format(baseClass))
  for i in range (0, len(attribs)):
    if attribs[i]['type'] == 'lo_element' or ( attribs[i]['type'] == 'element' and attribs[i]['name'] != 'math'):
      if attribs[i]['reqd'] == True or attribs[i]['type'] == 'lo_element':
        outFile.write('\tm{0}.setSedDocument(d);\n'.format(strFunctions.capp(attribs[i]['name'], attribs[i]['type'] == 'lo_element')))
      else:
        outFile.write('\tif (m{0} != NULL)\n'.format(strFunctions.cap(attribs[i]['name'])))
        outFile.write('\t\tm{0}->setSedDocument(d);\n'.format(strFunctions.cap(attribs[i]['name'])))
  outFile.write('}\n\n\n')
  writeInternalEnd(outFile)
开发者ID:jeicher,项目名称:libSEDML,代码行数:17,代码来源:generalFunctions.py


示例15: writeExt

def writeExt(fileOut, name):
  capName = name.upper()
  fileOut.write('#ifdef USE_{0}\n'.format(capName))
  fileOut.write('if (pkgName == "{0}")\n'.format(name))
  fileOut.write('{\n')
  fileOut.write('  return SWIGTYPE_p_{0}Extension;\n'.format(strFunctions.cap(name)))
  fileOut.write('}\n')
  fileOut.write('#endif // USE_{0} \n\n'.format(capName))
开发者ID:skeating,项目名称:auto-generator,代码行数:8,代码来源:writeBindingsFiles.py


示例16: writeConnectToParent

def writeConnectToParent(outFile, element, sbmltypecode, attribs, isSedListOf, hasChildren=False, hasMath=False, baseClass='SedBase'):  
  #print 'isSedListOf={0} hasChildren={1} hasMath={2}'.format(isSedListOf, hasChildren, hasMath)
  if isSedListOf or hasChildren == False:
    return;
  outFile.write('/*\n')
  outFile.write(' * Read values from the given XMLAttributes set into their specific fields.\n')
  outFile.write(' */\n')
  outFile.write('void\n{0}::connectToChild ()\n'.format(element))
  outFile.write('{\n')
  outFile.write('\t{0}::connectToChild();\n\n'.format(baseClass))
  for i in range (0, len(attribs)):
    if attribs[i]['type'] == 'lo_element' or ( attribs[i]['type'] == 'element' and attribs[i]['name'] != 'math'):
      if attribs[i]['reqd'] == True or attribs[i]['type'] == 'lo_element':
        outFile.write('\tm{0}.connectToParent(this);\n'.format(strFunctions.capp(attribs[i]['name'],attribs[i]['type'] == 'lo_element')))
      else:
        outFile.write('\tif (m{0} != NULL)\n'.format(strFunctions.cap(attribs[i]['name'])))
        outFile.write('\t\tm{0}->connectToParent(this);\n'.format(strFunctions.cap(attribs[i]['name'])))
  outFile.write('}\n\n\n')  
开发者ID:jeicher,项目名称:libSEDML,代码行数:18,代码来源:generalFunctions.py


示例17: writeCreateObject

def writeCreateObject(fileOut, mem, ifCount, pkg):
  name = strFunctions.cap(mem['name'])
  if ifCount == 1:
    fileOut.write('    if (name == "{0}" ) \n'.format(strFunctions.lowerFirst(name)))
  else:
    fileOut.write('    else if (name == "{0}" ) \n'.format(strFunctions.lowerFirst(name)))
  fileOut.write('    { \n')
  fileOut.write('      m{0} = new {0}({1}ns);\n\n'.format(name, pkg.lower()))
  fileOut.write('      object = m{0};\n\n'.format(name))
  fileOut.write('    } \n')
开发者ID:skeating,项目名称:auto-generator,代码行数:10,代码来源:writePluginCode.py


示例18: writeCode

def writeCode(name):
	capName = name.upper()
	codeName = name + '-register.cxx'
	fileOut = open(codeName, 'w')
	fileHeaders.addFilename(fileOut, codeName, name)
	fileHeaders.addLicence(fileOut)
	fileOut.write('\n')
	fileOut.write('#ifdef USE_{0}\n'.format(capName))
	fileOut.write('  {0}Extension::init();\n'.format(strFunctions.cap(name)))
	fileOut.write('#endif\n')
开发者ID:hovo1990,项目名称:deviser,代码行数:10,代码来源:createRegisterFiles.py


示例19: writeSwigHeader

def writeSwigHeader(fileOut, name, plugins, classes):
  capName = strFunctions.cap(name)
  fileOut.write('#ifdef USE_{0}\n\n'.format(name.upper()))
  fileOut.write('#include <sbml/packages/{0}/extension/{1}Extension.h>\n'.format(name, capName))
  alreadyIncluded = []
  for plugin in plugins:
    package = name
    if plugin.has_key('package') and plugin['package'] != None:
      package = plugin['package']
    capPackageName = strFunctions.cap(package)
    if package != name and alreadyIncluded.count(package) == 0:
      alreadyIncluded.append(package)
      fileOut.write('#include <sbml/packages/{0}/extension/{1}Extension.h>\n'.format(package, capPackageName))
      fileOut.write('#include <sbml/packages/{0}/common/{1}ExtensionTypes.h>\n'.format(package, capPackageName))
    fileOut.write('#include <sbml/packages/{0}/extension/{1}{2}Plugin.h>\n'.format(name, capName, plugin['sbase']))
  fileOut.write('#include <sbml/packages/{0}/common/{1}ExtensionTypes.h>\n'.format(name, capName))
  for clazz in classes:
    if clazz['typecode'] != 'HACK':
      fileOut.write('#include <sbml/packages/{0}/sbml/{1}.h>\n'.format(name, clazz['name']))
  fileOut.write('\n')
  fileOut.write('#endif // USE_{0} \n\n'.format(name.upper()))
开发者ID:skeating,项目名称:auto-generator,代码行数:21,代码来源:writeBindingsFiles.py


示例20: createHeader

def createHeader(element, header):
  type = element['name']
  name = element['name']
  if element.has_key('elementName'):
    name = strFunctions.cap(element['elementName']) 
  if element.has_key('element'):
    type = element['element']
  writeClass(header, name, type, element['package'], element)

 

  
开发者ID:0u812,项目名称:libSEDML,代码行数:8,代码来源:writeListOfHeader.py



注:本文中的strFunctions.cap函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python strFunctions.objAbbrev函数代码示例发布时间:2022-05-27
下一篇:
Python port_dispenser.genHa函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap