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

Python strFunctions.objAbbrev函数代码示例

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

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



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

示例1: writeUnsetFunction

def writeUnsetFunction(attrib, output, element):
    att = generalFunctions.parseAttributeForC(attrib)
    attName = att[0]
    capAttName = att[1]
    attType = att[2]
    attTypeCode = att[3]
    num = att[4]
    if attrib["type"] == "element" or attrib["type"] == "lo_element" or attrib["type"] == "inline_lo_element":
        return
    output.write("/**\n")
    output.write(' * Unsets the value of the "{0}" attribute of the given \n'.format(attName))
    output.write(" * {0}_t structure.\n *\n".format(element))
    output.write(" * @param {0} the {1}_t structure.\n *\n".format(strFunctions.objAbbrev(element), element))
    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. @[email protected]~ The possible values\n")
    output.write(" * returned by this function are:\n")
    output.write(" * @li @link OperationReturnValues_t#LIBSBML_OPERATION_SUCCESS [email protected]\n")
    output.write(" * @li @link OperationReturnValues_t#LIBSBML_OPERATION_FAILED [email protected]\n")
    output.write(" * @li @link OperationReturnValues_t#LIBSBML_INVALID_OBJECT [email protected]\n *\n")
    output.write(" * @member of {0}_t\n".format(element))
    output.write(" */\n")
    output.write("LIBSBML_EXTERN\n")
    output.write("int\n")
    output.write("{0}_unset{1}".format(element, capAttName))
    output.write("({0}_t * {1});\n\n\n".format(element, strFunctions.objAbbrev(element)))
开发者ID:skeating,项目名称:auto-generator,代码行数:26,代码来源:writeCHeader.py


示例2: writeSetFunction

def writeSetFunction(attrib, output, element):
  att = generalFunctions.parseAttributeForC(attrib)
  attName = att[0]
  capAttName = att[1]
  attType = att[2]
  attTypeCode = att[3]
  num = att[4]
  if attrib['type'] == 'std::vector<double>':
    return
  elif attrib['type'] != 'element' and attrib['type'] != 'lo_element' and attrib['type'] != 'XMLNode*':
    output.write('LIBSEDML_EXTERN\n')
    output.write('int\n')
    output.write('{0}_set{1}'.format(element, capAttName))
    output.write('({0}_t * {1},'.format(element, strFunctions.objAbbrev(element)))
    output.write(' {0} {1});\n\n\n'.format(attTypeCode, attName))
  elif attrib['type'] == 'XMLNode*':
    output.write('LIBSEDML_EXTERN\n')
    output.write('int\n')
    output.write('{0}_set{1}'.format(element, capAttName))
    output.write('({0}_t * {1},'.format(element, strFunctions.objAbbrev(element)))
    output.write(' XMLNode_t* {0});\n\n\n'.format(attName))
  elif attrib['type'] == 'element':
    if attrib['name'] == 'Math' or attrib['name'] == 'math':
      output.write('LIBSEDML_EXTERN\n')
      output.write('int\n')
      output.write('{0}_setMath'.format(element))
      output.write('({0}_t * {1},'.format(element, strFunctions.objAbbrev(element)))
      output.write(' ASTNode_t* {0});\n\n\n'.format(attName))
    else:
      output.write('LIBSEDML_EXTERN\n')
      output.write('int\n')
      output.write('{0}_set{1}'.format(element, capAttName))
      output.write('({0}_t * {1},'.format(element, strFunctions.objAbbrev(element)))
      output.write(' {0}_t* {1});\n\n\n'.format(attrib['element'], attName))
开发者ID:0u812,项目名称:libSEDML,代码行数:34,代码来源:writeCHeader.py


示例3: 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


示例4: writeHasReqdElementsFunction

def writeHasReqdElementsFunction(output, element):
    output.write("/**\n")
    output.write(" * Predicate returning @c 1 or *c 0 depending on whether all the required\n")
    output.write(" * sub-elements of the given {0}_t structure have been set.\n *\n".format(element))
    output.write(" * @param {0} the {1}_t structure to check.\n *\n".format(strFunctions.objAbbrev(element), element))
    output.write(" * @return @c 1 if all the required sub-elements for this\n")
    output.write(" * structure have been defined, @c 0 otherwise.\n *\n")
    output.write(" * @member of {0}_t\n".format(element))
    output.write(" */\n")
    output.write("LIBSBML_EXTERN\n")
    output.write("int\n")
    output.write("{0}_hasRequiredElements".format(element))
    output.write("(const {0}_t * {1});\n\n\n".format(element, strFunctions.objAbbrev(element)))
开发者ID:skeating,项目名称:auto-generator,代码行数:13,代码来源:writeCHeader.py


示例5: writeConstructors

def writeConstructors(element, package, output):
    indent = strFunctions.getIndent(element)
    output.write("/**\n")
    output.write(" * Creates a new {0}_t structure using the given SBML @p level and\n".format(element))
    output.write(" * @p version values.\n *\n")
    output.write(" * @param level an unsigned int, the SBML level to assign to this\n")
    output.write(" * {0}_t structure.\n *\n".format(element))
    output.write(" * @param version an unsigned int, the SBML version to assign to this\n")
    output.write(" * {0}_t structure.\n *\n".format(element))
    output.write(" * @returns the newly-created {0}_t structure, or a null pointer if\n".format(element))
    output.write(" * an error occurred during construction.\n *\n")
    output.write(" * @copydetails doc_note_setting_lv\n *\n")
    output.write(" * @memberof {0}_t\n".format(element))
    output.write(" */\n")
    output.write("LIBSBML_EXTERN\n")
    output.write("{0}_t *\n".format(element))
    output.write("{0}_create".format(element))
    output.write("(unsigned int level, unsigned int version,\n")
    output.write("{0}       unsigned int pkgVersion);\n\n\n".format(indent))
    #  output.write('LIBSBML_EXTERN\n')
    #  output.write('{0}_t *\n'.format(element))
    #  output.write('{0}_createWithNS'.format(element))
    #  output.write('(SBMLNamespaces_t *sbmlns);\n\n\n')
    output.write("/**\n")
    output.write(" * Frees the given {0}_t structure.\n * \n".format(element))
    output.write(
        " * @param {0} the {1}_t structure to be freed.\n *\n".format(strFunctions.objAbbrev(element), element)
    )
    output.write(" * @memberof {0}_t\n".format(element))
    output.write(" */\n")
    output.write("LIBSBML_EXTERN\n")
    output.write("void\n")
    output.write("{0}_free".format(element))
    output.write("({0}_t * {1});\n\n\n".format(element, strFunctions.objAbbrev(element)))
    output.write("/**\n")
    output.write(" * Creates a deep copy of the given {0}_t structure.\n * \n".format(element))
    output.write(
        " * @param {0} the {1}_t structure to be copied.\n *\n".format(strFunctions.objAbbrev(element), element)
    )
    output.write(" * @returns a (deep) copy of the given {0}_t structure, or a null\n".format(element))
    output.write(" * pointer if a failure occurred.\n *\n")
    output.write(" * @memberof {0}_t\n".format(element))
    output.write(" */\n")
    output.write("LIBSBML_EXTERN\n")
    output.write("{0}_t *\n".format(element))
    output.write("{0}_clone".format(element))
    output.write("({0}_t * {1});\n\n\n".format(element, strFunctions.objAbbrev(element)))
开发者ID:skeating,项目名称:auto-generator,代码行数:47,代码来源:writeCHeader.py


示例6: writeConstructors

def writeConstructors(element, package, output):
  indent = strFunctions.getIndent(element)
  output.write('LIBSEDML_EXTERN\n')
  output.write('{0}_t *\n'.format(element))
  output.write('{0}_create'.format(element))
  output.write('(unsigned int level, unsigned int version);\n\n\n')
#  output.write('LIBSEDML_EXTERN\n')
#  output.write('{0}_t *\n'.format(element))
#  output.write('{0}_createWithNS'.format(element))
#  output.write('(SedNamespaces_t *sedmlns);\n\n\n')
  output.write('LIBSEDML_EXTERN\n')
  output.write('void\n')
  output.write('{0}_free'.format(element))
  output.write('({0}_t * {1});\n\n\n'.format(element, strFunctions.objAbbrev(element)))
  output.write('LIBSEDML_EXTERN\n')
  output.write('{0}_t *\n'.format(element))
  output.write('{0}_clone'.format(element))
  output.write('({0}_t * {1});\n\n\n'.format(element, strFunctions.objAbbrev(element)))
开发者ID:0u812,项目名称:libSEDML,代码行数:18,代码来源:writeCHeader.py


示例7: writeHasReqdElementsFunction

def writeHasReqdElementsFunction(output, element):
  varname = strFunctions.objAbbrev(element)
  output.write('LIBSBML_EXTERN\n')
  output.write('int\n')
  output.write('{0}_hasRequiredElements'.format(element))
  output.write('(const {0}_t * {1})\n'.format(element, varname))
  output.write('{\n')
  output.write('\treturn ({0} != NULL) ? static_cast<int>({0}->hasRequiredElements()) : 0;\n'.format(varname))
  output.write('}\n\n\n')
开发者ID:hovo1990,项目名称:deviser,代码行数:9,代码来源:writeCCode.py


示例8: writeIsSetFunction

def writeIsSetFunction(attrib, output, element):
    att = generalFunctions.parseAttributeForC(attrib)
    attName = att[0]
    capAttName = att[1]
    attType = att[2]
    attTypeCode = att[3]
    num = att[4]
    if attrib["type"] != "lo_element" and attrib["type"] != "inline_lo_element":
        output.write("/**\n")
        output.write(' * Predicate returning @c 1 if the given {0}_t structure\'s "{1}"\n'.format(element, attName))
        output.write(" * is set.\n *\n")
        output.write(" * @param {0} the {1}_t structure.\n *\n".format(strFunctions.objAbbrev(element), element))
        output.write(' * @return @c 1 if the "{0}" of this {1}_t structure is\n'.format(attName, element))
        output.write(" * set, @c 0 otherwise.\n *\n")
        output.write(" * @member of {0}_t\n".format(element))
        output.write(" */\n")
        output.write("LIBSBML_EXTERN\n")
        output.write("int\n")
        output.write("{0}_isSet{1}".format(element, capAttName))
        output.write("(const {0}_t * {1});\n\n\n".format(element, strFunctions.objAbbrev(element)))
开发者ID:skeating,项目名称:auto-generator,代码行数:20,代码来源:writeCHeader.py


示例9: writeListOfSubElements

def writeListOfSubElements(attrib, output, element):
  loname = generalFunctions.writeListOf(strFunctions.cap(attrib['name']))
  output.write('LIBSEDML_EXTERN\n')
  output.write('int\n')
  output.write('{0}_add{1}({0}_t * {2}, '.format(element, strFunctions.cap(attrib['name']), strFunctions.objAbbrev(element)))
  output.write('{0}_t * {1});\n\n\n'.format(attrib['element'], strFunctions.objAbbrev(attrib['element'])))
  if attrib.has_key('abstract') == False or (attrib.has_key('abstract') and attrib['abstract'] == False):
    output.write('LIBSEDML_EXTERN\n')
    output.write('{0}_t *\n'.format(attrib['element']))
    output.write('{0}_create{1}({0}_t * {2}' .format(element, strFunctions.cap(attrib['name']), strFunctions.objAbbrev(element)))
    output.write(');\n\n\n')
  elif attrib.has_key('concrete'):
    for elem in attrib['concrete']:
      output.write('LIBSEDML_EXTERN\n')
      output.write('{0}_t *\n'.format(elem['element']))
      output.write('{0}_create{1}({0}_t * {2}' .format(element, strFunctions.cap(elem['name']), strFunctions.objAbbrev(element)))
      output.write(');\n\n\n')
  output.write('LIBSEDML_EXTERN\n')
  output.write('SedListOf_t *\n')
  output.write('{0}_get{1}({0}_t * {2})'.format(element, loname, strFunctions.objAbbrev(element)))
  output.write(';\n\n\n')
  output.write('LIBSEDML_EXTERN\n')
  output.write('{0}_t *\n'.format(attrib['element']))
  output.write('{0}_get{1}({0}_t * {2}, '.format(element, strFunctions.cap(attrib['name']), strFunctions.objAbbrev(element)))
  output.write('unsigned int n);\n\n\n')
  output.write('LIBSEDML_EXTERN\n')
  output.write('{0}_t *\n'.format(attrib['element']))
  output.write('{0}_get{1}ById({0}_t * {2}, '.format(element, strFunctions.cap(attrib['name']), strFunctions.objAbbrev(element)))
  output.write('const char * sid);\n\n\n')
  output.write('LIBSEDML_EXTERN\n')
  output.write('unsigned int\n')
  output.write('{0}_getNum{1}s({0}_t * {2}' .format(element, strFunctions.cap(attrib['name']), strFunctions.objAbbrev(element)))
  output.write(');\n\n\n')
  output.write('LIBSEDML_EXTERN\n')
  output.write('{0}_t *\n'.format(attrib['element']))
  output.write('{0}_remove{1}({0}_t * {2}, '.format(element, strFunctions.cap(attrib['name']), strFunctions.objAbbrev(element)))
  output.write('unsigned int n);\n\n\n')
  output.write('LIBSEDML_EXTERN\n')
  output.write('{0}_t *\n'.format(attrib['element']))
  output.write('{0}_remove{1}ById({0}_t * {2}, '.format(element, strFunctions.cap(attrib['name']), strFunctions.objAbbrev(element)))
  output.write('const char * sid);\n\n\n')
开发者ID:0u812,项目名称:libSEDML,代码行数:41,代码来源:writeCHeader.py


示例10: writeHasReqdAttrFunction

def writeHasReqdAttrFunction(output, element):
  varname = strFunctions.objAbbrev(element)
  output.write('/**\n')
  output.write(' * write comments\n')
  output.write(' */\n')
  output.write('LIBSEDML_EXTERN\n')
  output.write('int\n')
  output.write('{0}_hasRequiredAttributes'.format(element))
  output.write('({0}_t * {1})\n'.format(element, varname))
  output.write('{\n')
  output.write('\treturn ({0} != NULL) ? static_cast<int>({0}->hasRequiredAttributes()) : 0;\n'.format(varname))
  output.write('}\n\n\n')
开发者ID:hsorby,项目名称:libSEDML,代码行数:12,代码来源:writeCCode.py


示例11: writeClass

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


示例12: writeSetFunction

def writeSetFunction(attrib, output, element):
  att = generalFunctions.parseAttributeForC(attrib)
  attName = att[0]
  cleanName = strFunctions.cleanStr(attName)
  capAttName = att[1]
  attType = att[2]
  attTypeCode = att[3]
  num = att[4]
  if attrib['type'] == 'lo_element' or attrib['type'] == 'inline_lo_element':
    return
  if attrib['type'] == 'array':
    return
  varname = strFunctions.objAbbrev(element)
  if attrib['type'] != 'element' and attrib['type'] != 'lo_element' and attrib['type'] != 'inline_lo_element':
      output.write('LIBSBML_EXTERN\n')
      output.write('int\n')
      output.write('{0}_set{1}'.format(element, capAttName))
      output.write('({0}_t * {1},'.format(element, varname))
      output.write(' {0} {1})\n'.format(attTypeCode, cleanName))
      output.write('{\n')
      output.write('  if ({0} != NULL)\n'.format(varname))
      if num or attrib['type'] == 'enum':
        output.write('    return {1}->set{2}({0});\n'.format(cleanName, varname, capAttName))
      elif attrib['type'] == 'array':
        output.write('    return ({0} == NULL) ? {1}->unset{2}() : {1}->set{2}({0});\n'.format(cleanName, varname, capAttName))
      else:
        output.write('    return ({0} == NULL) ? {1}->set{2}("") : {1}->set{2}({0});\n'.format(cleanName, varname, capAttName))
      output.write('  else\n')
      output.write('    return LIBSBML_INVALID_OBJECT;\n')
#      output.write('  return ({0} != NULL) ? {0}->set{1}({2}) : LIBSBML_INVALID_OBJECT;\n'.format(varname, capAttName, attName))
      output.write('}\n\n\n')
  elif attrib['type'] == 'element':
    if attrib['name'] == 'Math' or attrib['name'] == 'math':
      output.write('LIBSBML_EXTERN\n')
      output.write('int\n')
      output.write('{0}_set{1}'.format(element, capAttName))
      output.write('({0}_t * {1},'.format(element, varname))
      output.write(' const {0} {1})\n'.format('ASTNode_t*', cleanName))
      output.write('{\n')
      output.write('\treturn ({0} != NULL) ? {0}->set{1}({2}) : LIBSBML_INVALID_OBJECT;\n'.format(varname, capAttName, cleanName))
      output.write('}\n\n\n')
    else:
      output.write('LIBSBML_EXTERN\n')
      output.write('int\n')
      output.write('{0}_set{1}'.format(element, capAttName))
      output.write('({0}_t * {1},'.format(element, varname))
      output.write(' {0}_t* {1})\n'.format(attrib['element'], cleanName))
      output.write('{\n')
      output.write('\treturn ({0} != NULL) ? {0}->set{1}({2}) : LIBSBML_INVALID_OBJECT;\n'.format(varname, capAttName, cleanName))
      output.write('}\n\n\n')
开发者ID:hovo1990,项目名称:deviser,代码行数:50,代码来源:writeCCode.py


示例13: writeIsSetFunction

def writeIsSetFunction(attrib, output, element):
  att = generalFunctions.parseAttributeForC(attrib)
  attName = att[0]
  capAttName = att[1]
  attType = att[2]
  attTypeCode = att[3]
  num = att[4]
  if attrib['type'] == 'std::vector<double>':
    return
  elif attrib['type'] != 'lo_element':
    output.write('LIBSEDML_EXTERN\n')
    output.write('int\n')
    output.write('{0}_isSet{1}'.format(element, capAttName))
    output.write('({0}_t * {1});\n\n\n'.format(element, strFunctions.objAbbrev(element)))
开发者ID:0u812,项目名称:libSEDML,代码行数:14,代码来源:writeCHeader.py


示例14: writeUnsetFunction

def writeUnsetFunction(attrib, output, element):
  att = generalFunctions.parseAttributeForC(attrib)
  attName = att[0]
  capAttName = att[1]
  attType = att[2]
  attTypeCode = att[3]
  num = att[4]
  if attrib['type'] == 'lo_element' or attrib['type'] == 'inline_lo_element' or attrib['type'] == 'element':
    return
  varname = strFunctions.objAbbrev(element)
  output.write('LIBSBML_EXTERN\n')
  output.write('int\n')
  output.write('{0}_unset{1}'.format(element, capAttName))
  output.write('({0}_t * {1})\n'.format(element, varname))
  output.write('{\n')
  output.write('  return ({0} != NULL) ? {0}->unset{1}() : LIBSBML_INVALID_OBJECT;\n'.format(varname, capAttName))
  output.write('}\n\n\n')
开发者ID:hovo1990,项目名称:deviser,代码行数:17,代码来源:writeCCode.py


示例15: writeIsSetFunction

def writeIsSetFunction(attrib, output, element):
  att = generalFunctions.parseAttributeForC(attrib)
  attName = att[0]
  capAttName = att[1]
  attType = att[2]
  attTypeCode = att[3]
  num = att[4]
  if attrib['type'] == 'lo_element' or attrib['type'] == 'inline_lo_element':
    return
  varname = strFunctions.objAbbrev(element)
  output.write('LIBSBML_EXTERN\n')
  output.write('int\n')
  output.write('{0}_isSet{1}'.format(element, capAttName))
  output.write('(const {0}_t * {1})\n'.format(element, varname))
  output.write('{\n')
  output.write('  return ({0} != NULL) ? static_cast<int>({0}->isSet{1}()) : 0;\n'.format(varname, capAttName))
  output.write('}\n\n\n')
开发者ID:hovo1990,项目名称:deviser,代码行数:17,代码来源:writeCCode.py


示例16: writeSetFunction

def writeSetFunction(attrib, output, element):
  att = generalFunctions.parseAttributeForC(attrib)
  attName = att[0]
  capAttName = att[1]
  attType = att[2]
  attTypeCode = att[3]
  num = att[4]
  if attrib['type'] == 'lo_element':
    return
  varname = strFunctions.objAbbrev(element)
  output.write('/**\n')
  output.write(' * write comments\n')
  output.write(' */\n')
  if attrib['type'] == 'std::vector<double>':
    return
  elif attrib['type'] != 'element' and attrib['type'] != 'lo_element':
    output.write('LIBSEDML_EXTERN\n')
    output.write('int\n')
    output.write('{0}_set{1}'.format(element, capAttName))
    output.write('({0}_t * {1},'.format(element, varname))
    output.write(' {0} {1})\n'.format(attTypeCode, attName))
    output.write('{\n')
    output.write('\treturn ({0} != NULL) ? {0}->set{1}({2}) : LIBSEDML_INVALID_OBJECT;\n'.format(varname, capAttName, attName))
    output.write('}\n\n\n')
  elif attrib['type'] == 'element':
    if attrib['name'] == 'Math' or attrib['name'] == 'math':
      output.write('LIBSEDML_EXTERN\n')
      output.write('int\n')
      output.write('{0}_set{1}'.format(element, capAttName))
      output.write('({0}_t * {1},'.format(element, varname))
      output.write(' {0} {1})\n'.format('ASTNode_t*', attName))
      output.write('{\n')
      output.write('\treturn ({0} != NULL) ? {0}->set{1}({2}) : LIBSEDML_INVALID_OBJECT;\n'.format(varname, capAttName, attName))
      output.write('}\n\n\n')
    else:
      output.write('LIBSEDML_EXTERN\n')
      output.write('int\n')
      output.write('{0}_set{1}'.format(element, capAttName))
      output.write('({0}_t * {1},'.format(element, varname))
      output.write(' {0}_t* {1})\n'.format(attrib['element'], attName))
      output.write('{\n')
      output.write('\treturn ({0} != NULL) ? {0}->set{1}({2}) : LIBSEDML_INVALID_OBJECT;\n'.format(varname, capAttName, attName))
      output.write('}\n\n\n')
开发者ID:jeicher,项目名称:libSEDML,代码行数:43,代码来源:writeCCode.py


示例17: writeAddFunction

def writeAddFunction(code, type, listOf, name):
  code.write('/**\n')
  code.write(' * Adds a copy the given \"{0}\" to this {1}.\n'.format(type, listOf))
  code.write(' *\n')
  code.write(' * @param {0}; the {1} object to add\n'.format(strFunctions.objAbbrev(type), type))
  code.write(' *\n')
  code.write(' * @return integer value indicating success/failure of the\n')
  code.write(' * function.  @if clike The value is drawn from the\n')
  code.write(' * enumeration #OperationReturnValues_t. @endif The possible values\n')
  code.write(' * returned by this function are:\n')
  code.write(' * @li LIBSBML_OPERATION_SUCCESS\n')
  code.write(' * @li LIBSBML_INVALID_ATTRIBUTE_VALUE\n')
  code.write(' */\n')
  code.write('int\n')
  code.write('{0}::add{1}(const {2}* {3})\n'.format(listOf, strFunctions.cap(name), type, strFunctions.objAbbrev(type)))
  code.write('{\n')

  code.write('  if ({0} == NULL)\n'.format(strFunctions.objAbbrev(type)))
  code.write('  {\n')
  code.write('    return LIBSBML_OPERATION_FAILED;\n')
  code.write('  }\n')
  code.write('  else if ({0}->hasRequiredAttributes() == false)\n'.format(strFunctions.objAbbrev(type)))
  code.write('  {\n')
  code.write('    return LIBSBML_INVALID_OBJECT;\n')
  code.write('  }\n')
  code.write('  else if (getLevel() != {0}->getLevel())\n'.format(strFunctions.objAbbrev(type)))
  code.write('  {\n')
  code.write('    return LIBSBML_LEVEL_MISMATCH;\n')
  code.write('  }\n')
  code.write('  else if (getVersion() != {0}->getVersion())\n'.format(strFunctions.objAbbrev(type)))
  code.write('  {\n')
  code.write('    return LIBSBML_VERSION_MISMATCH;\n')
  code.write('  }\n')
  code.write(
    '  else if (matchesRequiredSBMLNamespacesForAddition(static_cast<const SBase *>({0})) == false)\n'.format(
      strFunctions.objAbbrev(type)))
  code.write('  {\n')
  code.write('    return LIBSBML_NAMESPACES_MISMATCH;\n')
  code.write('  }\n')
  code.write('  else\n')
  code.write('  {\n')
  code.write('\tappend({0});\n'.format(strFunctions.objAbbrev(type)))
  code.write('    return LIBSBML_OPERATION_SUCCESS;\n')
  code.write('  }\n')
  code.write('}\n\n\n')
开发者ID:hovo1990,项目名称:deviser,代码行数:45,代码来源:writeListOfCode.py


示例18: writeConstructors

def writeConstructors(element, package, output):
  indent = strFunctions.getIndent(element)
  output.write('/**\n')
  output.write(' * write comments\n')
  output.write(' */\n')
  output.write('LIBSEDML_EXTERN\n')
  output.write('{0}_t *\n'.format(element))
  output.write('{0}_create'.format(element))
  output.write('(unsigned int level, unsigned int version)\n')
  output.write('{\n')
  output.write('\treturn new {0}(level, version);\n'.format(element))
  output.write('}\n\n\n')
#  output.write('/**\n')
#  output.write(' * write comments\n')
#  output.write(' */\n')
#  output.write('LIBSEDML_EXTERN\n')
#  output.write('{0}_t *\n'.format(element))
#  output.write('{0}_createWithNS'.format(element))
#  output.write('(SedNamespaces_t *sedmlns)\n')
#  output.write('{\n')
#  output.write('\treturn new {0}(sedmlns);\n'.format(element))
#  output.write('}\n\n\n')
  output.write('/**\n')
  output.write(' * write comments\n')
  output.write(' */\n')
  output.write('LIBSEDML_EXTERN\n')
  output.write('void\n')
  output.write('{0}_free'.format(element))
  output.write('({0}_t * {1})\n'.format(element, strFunctions.objAbbrev(element)))
  output.write('{\n')
  output.write('\tif ({0} != NULL)\n'.format(strFunctions.objAbbrev(element)))
  output.write('\t\tdelete {0};\n'.format(strFunctions.objAbbrev(element)))
  output.write('}\n\n\n')
  output.write('/**\n')
  output.write(' * write comments\n')
  output.write(' */\n')
  output.write('LIBSEDML_EXTERN\n')
  output.write('{0}_t *\n'.format(element))
  output.write('{0}_clone'.format(element))
  output.write('({0}_t * {1})\n'.format(element, strFunctions.objAbbrev(element)))
  output.write('{\n')
  output.write('\tif ({0} != NULL)\n'.format(strFunctions.objAbbrev(element)))
  output.write('\t{\n')
  output.write('\t\treturn static_cast<{0}_t*>({1}->clone());\n'.format(element, strFunctions.objAbbrev(element)))
  output.write('\t}\n')
  output.write('\telse\n')
  output.write('\t{\n')
  output.write('\t\treturn NULL;\n')
  output.write('\t}\n')
  output.write('}\n\n\n')
开发者ID:hsorby,项目名称:libSEDML,代码行数:50,代码来源:writeCCode.py


示例19: writeIsSetFunction

def writeIsSetFunction(attrib, output, element):
  att = generalFunctions.parseAttributeForC(attrib)
  attName = att[0]
  capAttName = att[1]
  attType = att[2]
  attTypeCode = att[3]
  num = att[4]
  if attrib['type'] == 'lo_element':
    return
  if attrib['type'] == 'std::vector<double>':
    return
  varname = strFunctions.objAbbrev(element)
  output.write('/**\n')
  output.write(' * write comments\n')
  output.write(' */\n')
  output.write('LIBSEDML_EXTERN\n')
  output.write('int\n')
  output.write('{0}_isSet{1}'.format(element, capAttName))
  output.write('({0}_t * {1})\n'.format(element, varname))
  output.write('{\n')
  output.write('\treturn ({0} != NULL) ? static_cast<int>({0}->isSet{1}()) : 0;\n'.format(varname, capAttName))
  output.write('}\n\n\n')
开发者ID:jeicher,项目名称:libSEDML,代码行数:22,代码来源:writeCCode.py


示例20: writeListOfSubFunctions

def writeListOfSubFunctions(attrib, output, element):
  loname = generalFunctions.writeListOf(strFunctions.cap(attrib['name']))
  att = generalFunctions.parseAttribute(attrib)
  attName = att[0]
  capAttName = att[1]
  attType = att[2]
  attTypeCode = att[3]
  num = att[4]
  output.write('/*\n')
  output.write(' * Returns the  \"{0}\"'.format(loname))
  output.write(' in this {0} object.\n'.format(element))
  output.write(' */\n')
  output.write('const {0}*\n'.format(loname))
  output.write('{0}::getListOf{1}s() const\n'.format(element, strFunctions.cap(attrib['name'])))
  output.write('{\n')
  output.write('\treturn &m{0};\n'.format(strFunctions.capp(attName)))
  output.write('}\n\n\n')
  writeListOfCode.writeRemoveFunctions(output, strFunctions.cap(attrib['name']), attrib['element'], True, element, capAttName)
  writeListOfCode.writeGetFunctions(output, strFunctions.cap(attrib['name']), attrib['element'], True, element, capAttName)
  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\n')
  output.write('{0}::add{1}(const {2}* {3})\n'.format(element, strFunctions.cap(attrib['name']), attrib['element'], strFunctions.objAbbrev(attrib['element'])))
  output.write('{\n')
  output.write('\tif({0} == NULL) return LIBSEDML_INVALID_ATTRIBUTE_VALUE;\n'.format(strFunctions.objAbbrev(attrib['element'])))
  output.write('\tm{0}.append({1});\n'.format(strFunctions.capp(attrib['name']),strFunctions.objAbbrev(attrib['element'])))
  output.write('\treturn LIBSEDML_OPERATION_SUCCESS;\n')
  output.write('}\n\n\n')
  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 \n')
  output.write('{0}::getNum{1}s() const\n'.format(element, strFunctions.cap(attrib['name'])))
  output.write('{\n')
  output.write('\treturn m{0}.size();\n'.format(strFunctions.capp(attrib['name'])))
  output.write('}\n\n')
  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(element, 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 {0}* {1})\n'.format(attrib['element'], strFunctions.objAbbrev(attrib['element'])))
    output.write(' */\n')
    output.write('{0}* \n'.format(attrib['element']))
    output.write('{0}::create{1}()\n'.format(element, strFunctions.cap(attrib['name'])))
    output.write('{\n')
    output.write('\t{0} *temp = new {0}();\n'.format(attrib['element']))
    output.write('\tif (temp != NULL) m{0}.appendAndOwn(temp);\n'.format(strFunctions.capp(attrib['name'])))
    output.write('\treturn temp;\n')
    output.write('}\n\n')
  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(element, 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 {1}* {2})\n'.format(strFunctions.cap(elem['name']), attrib['element'], strFunctions.objAbbrev(attrib['element'])))
      output.write(' */\n')
      output.write('{0}* \n'.format(elem['element']))
      output.write('{0}::create{1}()\n'.format(element, strFunctions.cap(elem['name'])))
      output.write('{\n')
      output.write('\t{0} *temp = new {0}();\n'.format(elem['element']))
      output.write('\tif (temp != NULL) m{0}.appendAndOwn(temp);\n'.format(strFunctions.capp(attrib['name'])))
      output.write('\treturn temp;\n')
      output.write('}\n\n')
开发者ID:jeicher,项目名称:libSEDML,代码行数:81,代码来源:writeCode.py



注:本文中的strFunctions.objAbbrev函数示例由


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python strategy_test.datetime_from_date函数代码示例发布时间:2022-05-27
下一篇:
Python strFunctions.cap函数代码示例发布时间: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