michael@13: michael@13: cpp_default_defs michael@13: cpp_h_extension "h" cpp_src_extension "cpp" java_extension "java" php_extension "php" python_extension "py" idl_extension "idl" michael@13: michael@13: type_forms 15 // uml cpp java idl cpp_in cpp_out cpp_inout cpp_return michael@13: "void" "void" "void" "void" "${type}" "${type} &" "${type}" "${type}" michael@13: "any" "void *" "Object" "any" "const ${type}" "${type}" "${type} &" "${type}" michael@13: "bool" "bool" "boolean" "boolean" "${type}" "${type} &" "${type} &" "${type}" michael@13: "char" "char" "char" "char" "${type}" "${type} &" "${type} &" "${type}" michael@13: "uchar" "unsigned char" "char" "octet" "${type}" "${type} &" "${type} &" "${type}" michael@13: "byte" "unsigned char" "byte" "octet" "${type}" "${type} &" "${type} &" "${type}" michael@13: "short" "short" "short" "short" "${type}" "${type} &" "${type} &" "${type}" michael@13: "ushort" "unsigned short" "short" "unsigned short" "${type}" "${type} &" "${type} &" "${type}" michael@13: "int" "int" "int" "long" "${type}" "${type} &" "${type} &" "${type}" michael@13: "uint" "unsigned int" "int" "unsigned long" "${type}" "${type} &" "${type} &" "${type}" michael@13: "long" "long" "long" "long" "${type}" "${type} &" "${type} &" "${type}" michael@13: "ulong" "unsigned long" "long" "unsigned long" "${type}" "${type} &" "${type} &" "${type}" michael@13: "float" "float" "float" "float" "${type}" "${type} &" "${type} &" "${type}" michael@13: "double" "double" "double" "double" "${type}" "${type} &" "${type} &" "${type}" michael@13: "string" "string" "String" "string" "${type}" "${type} &" "${type} &" "${type}" michael@13: michael@13: relations_stereotypes 5 // uml cpp java pythonidl michael@13: "sequence" "vector" "Vector" "list" "sequence" michael@13: "vector" "vector" "Vector" "list" "sequence" michael@13: "list" "list" "List" "list" "sequence" michael@13: "set" "set" "Set" "set" "sequence" michael@13: "map" "map" "Map" "dict" "sequence" michael@13: michael@13: classes_stereotypes 14 // uml cpp java php python idl michael@13: "class" "class" "class" "class" "class" "valuetype" michael@13: "interface" "class" "interface" "interface" "class" "interface" michael@13: "exception" "class" "class" "class" "class" "exception" michael@13: "enum" "enum" "enum" "enum" "enum" "enum" michael@13: "enum_pattern" "enum" "enum_pattern" "enum" "enum" "enum" michael@13: "struct" "struct" "class" "class" "class" "struct" michael@13: "union" "union" "class" "class" "class" "union" michael@13: "typedef" "typedef" "ignored" "ignored" "ignored" "typedef" michael@13: "boundary" "class" "class" "class" "class" "interface" michael@13: "control" "class" "class" "class" "class" "valuetype" michael@13: "entity" "class" "class" "class" "class" "valuetype" michael@13: "actor" "ignored" "ignored" "ignored" "ignored" "ignored" michael@13: "@interface" "ignored" "@interface" "ignored" "ignored" "ignored" michael@13: "stereotype" "ignored" "ignored" "ignored" "ignored" "ignored" michael@13: michael@13: cpp_enum_default_type_forms "${type}" "${type} &" "${type} &" "${type}" // in out inout return michael@13: other_cpp_types_default_type_forms "const ${type} &" "${type} &" "${type} &" "${type}" // in out inout return michael@13: michael@13: cpp_default_h_content "#ifndef ${NAMESPACE}_${NAME}_H michael@13: #define ${NAMESPACE}_${NAME}_H michael@13: michael@13: ${comment} michael@13: ${includes} michael@13: ${declarations} michael@13: ${namespace_start} michael@13: ${definition} michael@13: ${namespace_end} michael@13: #endif michael@13: " michael@13: cpp_default_src_content "${comment} michael@13: ${includes} michael@13: ${namespace_start} michael@13: ${members} michael@13: ${namespace_end}" michael@13: cpp_default_class_decl "${comment}${template}class ${name}${inherit} { michael@13: ${members}}; michael@13: ${inlines} michael@13: " michael@13: cpp_default_external_class_decl "${name} michael@13: #include <${name}.h> michael@13: " michael@13: cpp_default_struct_decl "${comment}${template}struct ${name}${inherit} { michael@13: ${members}}; michael@13: ${inlines} michael@13: " michael@13: cpp_default_union_decl "${comment}${template}union ${name} { michael@13: ${members}}; michael@13: ${inlines} michael@13: " michael@13: cpp_default_enum_decl "${comment}enum ${name} { michael@13: ${items} michael@13: }; michael@13: " michael@13: cpp_default_typedef_decl "${comment}typedef ${type} ${name}; michael@13: " michael@13: cpp_default_attribute_declaration " ${comment}${static}${mutable}${volatile}${const}${type} ${name}${value}; michael@13: " // multiplicity 1 michael@13: " ${comment}${static}${mutable}${volatile}${const}${stereotype}<${type}> ${name}${value}; michael@13: " // multiplicity * a..b michael@13: " ${comment}${static}${mutable}${volatile}${const}${type} ${name}${multiplicity}${value}; michael@13: " // multiplicity [..] michael@13: cpp_default_enum_item_declaration " ${name}${value},${comment}" michael@13: cpp_association_aggregation_declaration michael@13: " ${comment}${static}${mutable}${volatile}${const}${type} * ${name}${value}; michael@13: " // multiplicity 1 michael@13: " ${comment}${static}${mutable}${volatile}${const}${stereotype}<${type} *> ${name}${value}; michael@13: " // multiplicity * a..b michael@13: " ${comment}${static}${mutable}${volatile}${const}${type} * ${name}${multiplicity}${value}; michael@13: " // multiplicity [..] michael@13: cpp_aggregation_by_value_declaration michael@13: " ${comment}${static}${mutable}${volatile}${const}${type} ${name}${value}; michael@13: " // multiplicity 1 michael@13: " ${comment}${static}${mutable}${volatile}${const}${stereotype}<${type}> ${name}${value}; michael@13: " // multiplicity * a..b michael@13: " ${comment}${static}${mutable}${volatile}${const}${type} ${name}${multiplicity}${value}; michael@13: " // multiplicity [..] michael@13: cpp_get "get_${name}" inline const value_const public michael@13: cpp_set "set_${name}" public michael@13: cpp_default_operation_declaration " ${comment}${friend}${static}${inline}${virtual}${type} ${name}${(}${)}${const}${volatile}${throw}${abstract}; michael@13: " michael@13: cpp_default_operation_definition "${comment}${inline}${type} ${class}::${name}${(}${)}${const}${volatile}${throw}${staticnl}{ michael@13: ${body}} michael@13: " michael@13: java_default_src_content "${comment} michael@13: ${package} michael@13: ${imports} michael@13: ${definition}" michael@13: java_default_class_decl "${comment}${@}${visibility}${final}${abstract}class ${name}${extends}${implements} { michael@13: ${members}} michael@13: " michael@13: java_default_external_class_decl "${name}" michael@13: java_default_interface_decl "${comment}${@}${visibility}interface ${name}${extends} { michael@13: ${members}} michael@13: " michael@13: java5_default_enum_decl "${comment}${@}${visibility}${final}${abstract}enum ${name}${implements} { michael@13: ${items}; michael@13: ${members}} michael@13: " michael@13: java_default_enum_decl "${comment}${@}${visibility}final class ${name} { michael@13: ${members} michael@13: private final int value; michael@13: michael@13: public int value() { michael@13: return value; michael@13: } michael@13: michael@13: public static ${name} fromInt(int value) { michael@13: switch (value) { michael@13: ${cases} default: throw new Error(); michael@13: } michael@13: michael@13: } michael@13: private ${name}(int v) { value = v; }; michael@13: } michael@13: " michael@13: java_default_attribute_declaration " ${comment}${@}${visibility}${static}${final}${transient}${volatile}${type} ${name}${value}; michael@13: " // multiplicity 1 michael@13: " ${comment}${@}${visibility}${static}${final}${transient}${volatile}${stereotype}<${type}> ${name}${value}; michael@13: " // multiplicity * a..b michael@13: " ${comment}${@}${visibility}${static}${final}${transient}${volatile}${type}${multiplicity} ${name}${value}; michael@13: " // multiplicity N michael@13: java5_default_enum_item_declaration " ${@}${name}${value},${comment}" michael@13: java_default_enum_item_declaration " ${comment}${@}public static final int _${name}${value}; michael@13: public static final ${class} ${name} = new ${class}(_${name}); michael@13: " michael@13: java_default_enum_case " case _${name}: return ${name}; michael@13: " michael@13: java_association_aggregation_declaration michael@13: " ${comment}${@}${visibility}${static}${final}${transient}${volatile}${type} ${name}${value}; michael@13: " // multiplicity 1 michael@13: " ${comment}${@}${visibility}${static}${final}${transient}${volatile}${stereotype}<${type}> ${name}${value}; michael@13: " // multiplicity * a..b michael@13: " ${comment}${@}${visibility}${static}${final}${transient}${volatile}${type}${multiplicity} ${name}${value}; michael@13: " // multiplicity N michael@13: java_get "get${Name}" final public michael@13: java_set "set${Name}" public michael@13: java_default_operation_definition " ${comment}${@}${visibility}${final}${static}${abstract}${synchronized}${type} ${name}${(}${)}${throws}${staticnl}{ michael@13: ${body}} michael@13: " michael@13: php_default_src_content " michael@13: " michael@13: php_default_class_decl "${comment}${final}${visibility}${abstract}class ${name}${extends}${implements} { michael@13: ${members}} michael@13: " michael@13: php_default_enum_decl "${comment}${visibility}final class ${name} { michael@13: ${items}} michael@13: " michael@13: php_default_external_class_decl "${name}" michael@13: php_default_interface_decl "${comment}${visibility}interface ${name} { michael@13: ${members}} michael@13: " michael@13: php_default_attribute_declaration " ${comment}${visibility}${const}${static}${var}${name}${value}; michael@13: " michael@13: php_default_enum_item_decl " const ${name}${value};${comment} michael@13: " michael@13: php_default_relation_declaration" ${comment}${visibility}${const}${static}${var}${name}${value}; michael@13: " michael@13: php_get "get${Name}" final michael@13: php_set "set${Name}" michael@13: php_default_operation_definition " ${comment}${final}${visibility}${abstract}${static}function ${name}${(}${)} michael@13: { michael@13: ${body}} michael@13: " michael@13: python_2_2 michael@13: python_indent_step " " michael@13: python_default_src_content "${comment} michael@13: ${import} michael@13: ${definition}" michael@13: python_default_class_decl "class ${name}${inherit}: michael@13: ${docstring}${members} michael@13: " michael@13: python_default_enum_decl "class ${name}: michael@13: ${docstring}${members} michael@13: " michael@13: python_default_external_class_decl "${name}" michael@13: python_default_attribute_declaration "${comment}${self}${name} = ${value} michael@13: " // multiplicity 1 michael@13: "${comment}${self}${name} = ${stereotype}() michael@13: " // multiplicity != 1 michael@13: python_default_enum_item_decl "${comment}${self}${name} = ${value} michael@13: " michael@13: python_default_relation_declaration"${comment}${self}${name} = ${value} michael@13: " // multiplicity 1 michael@13: "${comment}${self}${name} = ${stereotype}() michael@13: " // multiplicity != 1 michael@13: python_default_composition_declaration"${comment}${self}${name} = ${type}() michael@13: " // multiplicity 1 michael@13: "${comment}${self}${name} = ${stereotype}() michael@13: " // multiplicity != 1 michael@13: python_default_operation_definition "${@}${static}${abstract}def ${name}${(}${)}: michael@13: ${docstring}${body} michael@13: " michael@13: python_get "get${Name}" michael@13: python_set "set${Name}" michael@13: idl_default_src_content "#ifndef ${MODULE}_${NAME}_H michael@13: #define ${MODULE}_${NAME}_H michael@13: michael@13: ${comment} michael@13: ${includes} michael@13: ${module_start} michael@13: ${definition} michael@13: ${module_end} michael@13: #endif michael@13: " michael@13: idl_default_interface_decl "${comment}${abstract}${local}interface ${name}${inherit} { michael@13: ${members}}; michael@13: " michael@13: idl_default_valuetype_decl "${comment}${abstract}${custom}valuetype ${name}${inherit} { michael@13: ${members}}; michael@13: " michael@13: idl_default_struct_decl "${comment}struct ${name} { michael@13: ${members}}; michael@13: " michael@13: idl_default_typedef_decl "${comment}typedef ${type} ${name}; michael@13: " michael@13: idl_default_exception_decl "${comment}exception ${name} { michael@13: ${members}}; michael@13: " michael@13: idl_default_union_decl "${comment}union ${name} switch(${switch}) { michael@13: ${members}}; michael@13: " michael@13: idl_default_enum_decl "${comment}enum ${name} { michael@13: ${items}}; michael@13: " michael@13: idl_default_external_class_decl "${name} michael@13: #include \"${name}.idl\" michael@13: " michael@13: idl_default_attribute_declaration " ${comment}${readonly}${attribute}${type} ${name}; michael@13: " // multiplicity 1 michael@13: " ${comment}${readonly}${attribute}${stereotype}<${type}> ${name}; michael@13: " // multiplicity * a..b michael@13: " ${comment}${readonly}${attribute}${stereotype}<${type},${multiplicity}> ${name}; michael@13: " // multiplicity N michael@13: idl_default_valuetype_attribute_declaration " ${comment}${visibility}${type} ${name}; michael@13: " // multiplicity 1 michael@13: " ${comment}${visibility}${stereotype}<${type}> ${name}; michael@13: " // multiplicity * a..b michael@13: " ${comment}${visibility}${stereotype}<${type},${multiplicity}> ${name}; michael@13: " // multiplicity N michael@13: idl_default_const_declaration " ${comment}const ${type} ${name}${value}; michael@13: " // multiplicity 1 michael@13: " ${comment}const ${stereotype}<${type}> ${name}${value}; michael@13: " // multiplicity * a..b michael@13: " ${comment}const ${stereotype}<${type},${multiplicity}> ${name}${value}; michael@13: " // multiplicity N michael@13: idl_default_enum_item_declaration " ${name},${comment}" michael@13: idl_default_union_item_declaration " ${comment}case ${case} : ${readonly}${type} ${name};" // multiplicity 1 michael@13: " ${comment}case ${case} : ${readonly}${stereotype}<${type}> ${name};" // multiplicity * a..b michael@13: " ${comment}case ${case} : ${readonly}${stereotype}<${type},${multiplicity}> ${name};" // multiplicity N michael@13: idl_association_aggregation_declaration michael@13: " ${comment}${readonly}${attribute}${type} ${name}; michael@13: " // multiplicity 1 michael@13: " ${comment}${readonly}${attribute}${stereotype}<${type}> ${name}; michael@13: " // multiplicity * a..b michael@13: " ${comment}${readonly}${attribute}${stereotype}<${type},${multiplicity}> ${name}; michael@13: " // multiplicity N michael@13: idl_valuetype_association_aggregation_declaration michael@13: " ${comment}${visibility}${type} ${name}; michael@13: " // multiplicity 1 michael@13: " ${comment}${visibility}${stereotype}<${type}> ${name}; michael@13: " // multiplicity * a..b michael@13: " ${comment}${visibility}${stereotype}<${type},${multiplicity}> ${name}; michael@13: " // multiplicity N michael@13: idl_union_association_aggregation_declaration michael@13: " ${comment}case ${case} : ${readonly}${type} ${name};" // multiplicity 1 michael@13: " ${comment}case ${case} : ${readonly}${stereotype}<${type}> ${name};" // multiplicity * a..b michael@13: " ${comment}case ${case} : ${readonly}${stereotype}<${type},${multiplicity}> ${name};" // multiplicity N michael@13: idl_get "get_${name}" michael@13: idl_set "set_${name}" twoways michael@13: idl_default_operation_declaration " ${comment}${oneway}${type} ${name}${(}${)}${raisesnl}${raises}; michael@13: " michael@13: uml_get_name uml uml_set_name uml michael@13: end