diff options
author | Ansgar Radermacher | 2016-01-16 23:21:13 +0000 |
---|---|---|
committer | Ansgar Radermacher | 2016-01-17 13:03:01 +0000 |
commit | 36b670f0a9f5dd59422a9f368dfe035d0b5f719c (patch) | |
tree | 7bb419a329ba5c568f5b3062b7661ed0b3e78d46 /extraplugins/codegen/org.eclipse.papyrus.cpp.codegen | |
parent | 47dd8f8ebd64192956b097cb70f783d7446138ab (diff) | |
download | org.eclipse.papyrus-36b670f0a9f5dd59422a9f368dfe035d0b5f719c.tar.gz org.eclipse.papyrus-36b670f0a9f5dd59422a9f368dfe035d0b5f719c.tar.xz org.eclipse.papyrus-36b670f0a9f5dd59422a9f368dfe035d0b5f719c.zip |
Bug 484701 - [QDesigner] Refactoring - code generators, architecture exploration and component based design should be organised in common directory
Bug 478797 - [model library] Decide which model library to use for C++ primitive types
Change-Id: Idade4edfcf803da3528c0873aa04b754915866fd
Diffstat (limited to 'extraplugins/codegen/org.eclipse.papyrus.cpp.codegen')
50 files changed, 0 insertions, 4628 deletions
diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/.classpath b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/.classpath deleted file mode 100644 index 358df1bc1d1..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/.classpath +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="src" path="xtend-gen"/> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> - <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> - <classpathentry kind="src" path="src"/> - <classpathentry kind="output" path="bin"/> -</classpath> diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/.project b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/.project deleted file mode 100644 index 1b4a71a36b8..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/.project +++ /dev/null @@ -1,52 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>org.eclipse.papyrus.cpp.codegen</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.xtext.ui.shared.xtextBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.ManifestBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.SchemaBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.acceleo.ide.ui.acceleoBuilder</name> - <arguments> - <dictionary> - <key>compilation.kind</key> - <value>compilation.absolute.path</value> - </dictionary> - <dictionary> - <key>compliance</key> - <value>pragmatic</value> - </dictionary> - <dictionary> - <key>resource.kind</key> - <value>xmi</value> - </dictionary> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.acceleo.ide.ui.acceleoNature</nature> - <nature>org.eclipse.jdt.core.javanature</nature> - <nature>org.eclipse.pde.PluginNature</nature> - <nature>org.eclipse.xtext.ui.shared.xtextNature</nature> - </natures> -</projectDescription> diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/META-INF/MANIFEST.MF b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/META-INF/MANIFEST.MF deleted file mode 100644 index 508918952e5..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/META-INF/MANIFEST.MF +++ /dev/null @@ -1,41 +0,0 @@ -Manifest-Version: 1.0
-Require-Bundle: org.eclipse.ui,
- org.eclipse.core.runtime,
- org.eclipse.jface.text,
- org.eclipse.uml2.uml;bundle-version="4.1.0",
- org.eclipse.core.resources,
- org.eclipse.papyrus.cpp.profile;bundle-version="1.2.0",
- org.eclipse.ui.ide;bundle-version="3.8.0",
- org.eclipse.core.filesystem;bundle-version="1.3.200",
- org.eclipse.cdt.core;resolution:=optional,
- org.eclipse.papyrus.infra.core.log;bundle-version="1.2.0",
- org.eclipse.papyrus.uml.tools.utils;bundle-version="1.2.0",
- org.eclipse.papyrus.codegen.extensionpoints;bundle-version="1.2.0",
- org.eclipse.xtend.lib,
- com.google.guava;bundle-version="11.0.0",
- org.eclipse.xtext.xbase.lib,
- org.eclipse.uml2.uml.profile.standard;bundle-version="1.0.0",
- org.eclipse.papyrus.codegen.base;bundle-version="1.2.0"
-Export-Package: org.eclipse.papyrus.cpp.codegen;uses:="org.eclipse.ui.plugin,
- org.osgi.framework,
- org.eclipse.uml2.uml",
- org.eclipse.papyrus.cpp.codegen.preferences;uses:="org.eclipse.jface.preference,
- org.eclipse.core.runtime.preferences",
- org.eclipse.papyrus.cpp.codegen.transformation; uses:="org.eclipse.core.runtime,
- org.eclipse.papyrus.acceleo,
- org.eclipse.core.resources,
- org.eclipse.uml2.uml",
- org.eclipse.papyrus.cpp.codegen.utils;uses:="org.eclipse.emf.ecore,
- org.eclipse.emf.common.util,
- org.eclipse.uml2.uml",
- org.eclipse.papyrus.cpp.codegen.xtend
-Bundle-Vendor: %providerName
-Eclipse-LazyStart: true
-Bundle-ActivationPolicy: lazy
-Bundle-Version: 1.2.0.qualifier
-Bundle-Localization: plugin
-Bundle-Name: %pluginName
-Bundle-Activator: org.eclipse.papyrus.cpp.codegen.Activator
-Bundle-ManifestVersion: 2
-Bundle-SymbolicName: org.eclipse.papyrus.cpp.codegen;singleton:=true
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/about.html b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/about.html deleted file mode 100644 index 209103075a7..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/about.html +++ /dev/null @@ -1,28 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
-<title>About</title>
-</head>
-<body lang="EN-US">
-<h2>About This Content</h2>
-
-<p>November 14, 2008</p>
-<h3>License</h3>
-
-<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
-indicated below, the Content is provided to you under the terms and conditions of the
-Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
-at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
-For purposes of the EPL, "Program" will mean the Content.</p>
-
-<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
-being redistributed by another party ("Redistributor") and different terms and conditions may
-apply to your use of any object code in the Content. Check the Redistributor's license that was
-provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
-indicated below, the terms and conditions of the EPL still apply to any source code in the Content
-and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
-
-</body>
-</html>
\ No newline at end of file diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/build.acceleo b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/build.acceleo deleted file mode 100644 index 26abe5ae4c9..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/build.acceleo +++ /dev/null @@ -1,26 +0,0 @@ -<!-- ===================================================================== --> -<!-- Custom targets. --> -<!-- Set customBuildCallbacks = build.acceleo in your build.properties. --> -<!-- ===================================================================== --> -<project name="Build Acceleo Module" default="noDefault"> - <!-- ================================================================= --> - <!-- Default target --> - <!-- ================================================================= --> - <target name="noDefault"> - <echo message="This file must be called with explicit targets" /> - </target> - - <!-- ================================================================= --> - <!-- This will be called automatically after the compilation of each --> - <!-- Bundle... in dependency order. --> - <!-- ================================================================= --> - <target name="post.compile.@dot"> - <acceleoCompiler - sourceFolder="${target.folder}" - outputFolder="${target.folder}" - dependencies="${target.folder}/../../org.eclipse.papyrus.cpp.profile;${target.folder}/../../org.eclipse.papyrus.acceleo;${target.folder}/../../org.eclipse.papyrus.uml.tools.utils;${target.folder}/../../org.eclipse.papyrus.codegen.extensionpoints;" - binaryResource="false" - packagesToRegister=""> - </acceleoCompiler> - </target> -</project> diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/build.properties b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/build.properties deleted file mode 100644 index 143d4e25c7d..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/build.properties +++ /dev/null @@ -1,13 +0,0 @@ -# -#Tue Mar 26 23:29:07 CET 2013 -bin.includes = META-INF/,\ - .,\ - plugin.xml,\ - plugin.properties,\ - about.html,\ - build.acceleo,\ - src/org/eclipse/papyrus/cpp/codegen/utils/messages.properties -output..=bin/ -src.includes=about.html -source..=src/,xtend-gen/ -customBuildCallbacks=build.acceleo diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/plugin.properties b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/plugin.properties deleted file mode 100644 index c14d7642918..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/plugin.properties +++ /dev/null @@ -1,12 +0,0 @@ -###############################################################################
-# Copyright (c) 2013 CEA LIST.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# CEA LIST - initial API and implementation
-###############################################################################
-pluginName=Papyrus C++ code generation (Incubation)
-providerName=Eclipse Modeling Project
diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/plugin.xml b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/plugin.xml deleted file mode 100644 index 5cdc98728ed..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/plugin.xml +++ /dev/null @@ -1,18 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.2"?>
-<plugin>
- <extension
- point="org.eclipse.core.runtime.preferences">
- <initializer
- class="org.eclipse.papyrus.cpp.codegen.preferences.CppCodeGenPreferenceInitializer">
- </initializer>
- </extension>
- <extension
- point="org.eclipse.papyrus.codegen.extensionpoints.languageCodegen">
- <generator
- id="Standard C++"
- language="C++"
- class="org.eclipse.papyrus.cpp.codegen.CppLangCodegen">
- </generator>
- </extension>
-</plugin>
diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/pom.xml b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/pom.xml deleted file mode 100644 index 475b2100504..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/pom.xml +++ /dev/null @@ -1,56 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project> - <modelVersion>4.0.0</modelVersion> - <parent> - <artifactId>org.eclipse.papyrus.extra.releng</artifactId> - <groupId>org.eclipse.papyrus</groupId> - <version>1.2.0-SNAPSHOT</version> - <relativePath>../../../releng/extra</relativePath> - </parent> - <artifactId>org.eclipse.papyrus.cpp.codegen</artifactId> - <groupId>org.eclipse.papyrus</groupId> - <version>1.2.0-SNAPSHOT</version> - <packaging>eclipse-plugin</packaging> - - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-clean-plugin</artifactId> - <configuration> - <filesets> - <fileset> - <directory>xtend-gen</directory> - <includes> - <include>**/*</include> - </includes> - <excludes> - <exclude>.gitignore</exclude> - </excludes> - </fileset> - </filesets> - </configuration> - </plugin> - <plugin> - <groupId>org.eclipse.xtend</groupId> - <artifactId>xtend-maven-plugin</artifactId> - <executions> - <execution> - <phase>generate-sources</phase> - <goals> - <goal>compile</goal> - </goals> - </execution> - </executions> - <configuration> - <outputDirectory>xtend-gen</outputDirectory> - <testOutputDirectory>${project.build.directory}/xtend-gen/test</testOutputDirectory> - </configuration> - </plugin> - </plugins> - </build> -</project>
\ No newline at end of file diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/Activator.java b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/Activator.java deleted file mode 100644 index f61e97bca9c..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/Activator.java +++ /dev/null @@ -1,68 +0,0 @@ -/*******************************************************************************
- * Copyright (c) 2006 - 2012 CEA LIST.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - initial API and implementation
- *******************************************************************************/
-package org.eclipse.papyrus.cpp.codegen;
-
-import org.eclipse.papyrus.infra.core.log.LogHelper;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class Activator extends AbstractUIPlugin {
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.eclipse.papyrus.cpp.codegen"; //$NON-NLS-1$
-
- // The shared instance
- private static Activator plugin;
-
- public static LogHelper log;
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static Activator getDefault() {
- return plugin;
- }
-
- /**
- * The constructor
- */
- public Activator() {
- plugin = this;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- log = new LogHelper();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- @Override
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-}
diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/Constants.java b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/Constants.java deleted file mode 100644 index e1f5d37c6ec..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/Constants.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 - 2015 CEA LIST. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * CEA LIST - initial API and implementation - *******************************************************************************/ - -package org.eclipse.papyrus.cpp.codegen; - -import java.util.regex.Pattern; - -/** - * String constants for the code generation - * - * @author ansgar - * - */ -public class Constants { - - public static final String includeHFile = "// include associated header file"; //$NON-NLS-1$ - - public static final String cppIncPreBodyStart = "// Include from CppInclude stereotype (pre-body)"; //$NON-NLS-1$ - - public static final String cppIncPreBodyEnd = "// End of CppInclude stereotype (pre-body)"; //$NON-NLS-1$ - - public static final String cppIncBodyStart = "// Include from CppInclude declaration (body)"; //$NON-NLS-1$ - - public static final String cppIncBodyEnd = "// End of CppInclude stereotype (body)";//$NON-NLS-1$ - - public static final String derivedIncludes = "// Derived includes directives";//$NON-NLS-1$ - - public static final String forwardDecl = "// forward declarations"; //$NON-NLS-1$ - - public static final String staticAttributes = "// static attributes (if any)"; //$NON-NLS-1$ - - public static final String undefinedType = "undefined"; //$NON-NLS-1$ - - // support the languages "C++", "C/C++" as well as "cpp". The '+' needs to be escaped in a regular epression - public static final Pattern supportedLanguages = Pattern.compile("C\\+\\+|C/C\\+\\+|cpp"); //$NON-NLS-1$ - - public static final String DOT = "."; //$NON-NLS-1$ -} diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/CppLangCodegen.java b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/CppLangCodegen.java deleted file mode 100644 index 3dc87c06e27..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/CppLangCodegen.java +++ /dev/null @@ -1,138 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 - 2015 CEA LIST. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * CEA LIST - ansgar.radermacher@cea.fr initial API and implementation - *******************************************************************************/ - -package org.eclipse.papyrus.cpp.codegen; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.emf.common.util.EList; -import org.eclipse.papyrus.C_Cpp.C_CppPackage; -import org.eclipse.papyrus.codegen.base.ModelElementsCreator; -import org.eclipse.papyrus.codegen.extensionpoints.ILangCodegen2; -import org.eclipse.papyrus.codegen.extensionpoints.MethodInfo; -import org.eclipse.papyrus.codegen.extensionpoints.SyncInformation; -import org.eclipse.papyrus.cpp.codegen.preferences.CppCodeGenUtils; -import org.eclipse.papyrus.cpp.codegen.transformation.CppModelElementsCreator; -import org.eclipse.papyrus.cpp.codegen.utils.LocateCppProject; -import org.eclipse.papyrus.cpp.codegen.xtend.CppParameter; -import org.eclipse.uml2.uml.Behavior; -import org.eclipse.uml2.uml.Classifier; -import org.eclipse.uml2.uml.Element; -import org.eclipse.uml2.uml.NamedElement; -import org.eclipse.uml2.uml.Operation; -import org.eclipse.uml2.uml.Package; -import org.eclipse.uml2.uml.PackageableElement; -import org.eclipse.uml2.uml.Parameter; -import org.eclipse.uml2.uml.ParameterDirectionKind; -import org.eclipse.uml2.uml.Profile; - -/** - * C++ language support - * - */ -public class CppLangCodegen implements ILangCodegen2 { - - protected ModelElementsCreator creator = null; - - protected IProject lastProject = null; - - @Override - public String getDescription() { - return Messages.C_CppLangCodegen_GeneratorDesc; - } - - /** - * Check whether the code generator is able to produce code for the passed element: - * it must be a classifier and the C++ profile must be applied. - */ - @Override - public boolean isEligible(Element modelElement) { - if (modelElement instanceof Classifier) { - Package nearestPackage = modelElement.getNearestPackage(); - if (nearestPackage != null) { - // check whether the C++ profile is applied - for (Profile profile : nearestPackage.getAllAppliedProfiles()) { - if (C_CppPackage.eINSTANCE.getName().equals(profile.getName())) { - return true; - } - } - } - } - return false; - } - - @Override - public String getSuffix(FILE_KIND fileKind) { - if (fileKind == FILE_KIND.BODY) { - return CppCodeGenUtils.getBodySuffix(); - } else { - return CppCodeGenUtils.getHeaderSuffix(); - } - } - - @Override - public void generateCode(IProject project, PackageableElement element, IProgressMonitor monitor) { - manageCreator(project, element); - creator.createPackageableElement(element, monitor); - } - - @Override - public void cleanCode(IProject project, PackageableElement element, IProgressMonitor monitor) { - manageCreator(project, element); - creator.removePackageableElement(element, monitor); - } - - @Override - public String getFileName(IProject project, NamedElement element) { - manageCreator(project, element); - return creator.getFileName(element); - } - - @Override - public IProject getTargetProject(PackageableElement pe, boolean createIfMissing) { - return LocateCppProject.getTargetProject(pe, createIfMissing); - } - - protected void manageCreator(IProject project, Element element) { - if ((project == null) && (element instanceof PackageableElement)) { - project = getTargetProject((PackageableElement) element, false); - } - if ((creator == null) || (project != lastProject)) { - lastProject = project; - creator = new CppModelElementsCreator(project); - } - } - - @Override - public SyncInformation getSyncInformation(String methodName, String body) { - return null; - } - - @Override - public MethodInfo getMethodInfo(NamedElement operationOrBehavior) { - MethodInfo mi = new MethodInfo(operationOrBehavior.getName()); - EList<Parameter> parameters = null; - if (operationOrBehavior instanceof Operation) { - parameters = ((Operation) operationOrBehavior).getOwnedParameters(); - } else if (operationOrBehavior instanceof Behavior) { - parameters = ((Behavior) operationOrBehavior).getOwnedParameters(); - } - - if (parameters != null) { - for (Parameter parameter : parameters) { - if (parameter.getDirection() != ParameterDirectionKind.RETURN_LITERAL) { - mi.addParameterType(CppParameter.CppParameterForCDT(parameter).toString()); - } - } - } - return mi; - } -} diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/Messages.java b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/Messages.java deleted file mode 100644 index ff7d9277d4c..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/Messages.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 - 2015 CEA LIST. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * CEA LIST - initial API and implementation - *******************************************************************************/ - -package org.eclipse.papyrus.cpp.codegen; - -import org.eclipse.osgi.util.NLS; - -public class Messages extends NLS { - private static final String BUNDLE_NAME = "org.eclipse.papyrus.cpp.codegen.messages"; //$NON-NLS-1$ - public static String C_CppLangCodegen_GeneratorDesc; - public static String CppModelElementsCreator_CannotFormatContent; - static { - // initialize resource bundle - NLS.initializeMessages(BUNDLE_NAME, Messages.class); - } - - private Messages() { - } -} diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/messages.properties b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/messages.properties deleted file mode 100644 index 611b7081e7e..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/messages.properties +++ /dev/null @@ -1,2 +0,0 @@ -C_CppLangCodegen_GeneratorDesc=General purpose C++ code generator for object-oriented models. Uses the CEA C/C++ profile -CppModelElementsCreator_CannotFormatContent=Cannot format content diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/preferences/CppCodeGenConstants.java b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/preferences/CppCodeGenConstants.java deleted file mode 100644 index 9993ad5e07d..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/preferences/CppCodeGenConstants.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 - 2012 CEA LIST. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * CEA LIST - initial API and implementation - *******************************************************************************/ - -package org.eclipse.papyrus.cpp.codegen.preferences; - -public class CppCodeGenConstants { - - /** - * Suffix for generated header files - */ - public static final String P_HEADER_SUFFIX = "headSuffix"; //$NON-NLS-1$ - - /** - * Suffix for generated body/implementation files - */ - public static final String P_IMPLEM_SUFFIX = "implSuffix"; //$NON-NLS-1$ - - /** - * Suffix for generated body/implementation files - */ - public static final String P_OUT_INOUT_OP = "outInoutOp"; //$NON-NLS-1$ - - /** - * User defined comment header in generated files - */ - public static final String P_COMMENT_HEADER = "commentHeader"; //$NON-NLS-1$ - - /** - * Suffix for generated header files - */ - public static final String P_PROJECT_PREFIX = "projectPrefix"; //$NON-NLS-1$ - -} diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/preferences/CppCodeGenPreferenceInitializer.java b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/preferences/CppCodeGenPreferenceInitializer.java deleted file mode 100644 index 7dd59fbe605..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/preferences/CppCodeGenPreferenceInitializer.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 - 2012 CEA LIST. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * CEA LIST - initial API and implementation - *******************************************************************************/ - -package org.eclipse.papyrus.cpp.codegen.preferences; - -import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.papyrus.cpp.codegen.Activator; - - -public class CppCodeGenPreferenceInitializer extends AbstractPreferenceInitializer { - - /* - * (non-Javadoc) - * - * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences() - */ - @Override - public void initializeDefaultPreferences() { - IPreferenceStore store = Activator.getDefault().getPreferenceStore(); - store.setDefault(CppCodeGenConstants.P_HEADER_SUFFIX, "h"); //$NON-NLS-1$ - store.setDefault(CppCodeGenConstants.P_IMPLEM_SUFFIX, "cpp"); //$NON-NLS-1$ - store.setDefault(CppCodeGenConstants.P_OUT_INOUT_OP, "*"); //$NON-NLS-1$ - store.setDefault(CppCodeGenConstants.P_PROJECT_PREFIX, "org.eclipse.papyrus.cppgen."); //$NON-NLS-1$ - - // Default value for P_COMMENT_HEADER - String NL = System.getProperties().getProperty("line.separator"); //$NON-NLS-1$ - String defaultValue = - "// --------------------------------------------------------" + NL + //$NON-NLS-1$ - "// Code generated by Papyrus C++" + NL + //$NON-NLS-1$ - "// --------------------------------------------------------" + NL + NL; //$NON-NLS-1$ - store.setDefault(CppCodeGenConstants.P_COMMENT_HEADER, defaultValue); - } -} diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/preferences/CppCodeGenUtils.java b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/preferences/CppCodeGenUtils.java deleted file mode 100644 index 69a18f191c0..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/preferences/CppCodeGenUtils.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 - 2012 CEA LIST. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * CEA LIST - initial API and implementation - *******************************************************************************/ - -package org.eclipse.papyrus.cpp.codegen.preferences; - -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.papyrus.cpp.codegen.Activator; - -/** - * Utility class that returns the preference values - * - * @author ansgar - * - */ -public class CppCodeGenUtils { - - protected static IPreferenceStore preferenceStore = null; - - public static String getHeaderSuffix() { - initPreferenceStore(); - return preferenceStore.getString(CppCodeGenConstants.P_HEADER_SUFFIX); - } - - public static String getBodySuffix() { - initPreferenceStore(); - return preferenceStore.getString(CppCodeGenConstants.P_IMPLEM_SUFFIX); - } - - public static String getOutInoutOp() { - initPreferenceStore(); - return preferenceStore.getString(CppCodeGenConstants.P_OUT_INOUT_OP); - } - - public static String getCommentHeader() { - initPreferenceStore(); - return preferenceStore.getString(CppCodeGenConstants.P_COMMENT_HEADER); - } - - public static void initPreferenceStore() { - if (preferenceStore == null) { - preferenceStore = Activator.getDefault().getPreferenceStore(); - } - } - -} diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/transformation/CppLocationStrategy.java b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/transformation/CppLocationStrategy.java deleted file mode 100644 index ccddad6f9cc..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/transformation/CppLocationStrategy.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.eclipse.papyrus.cpp.codegen.transformation; - -import org.eclipse.papyrus.codegen.base.HierarchyLocationStrategy; -import org.eclipse.uml2.uml.NamedElement; -import org.eclipse.uml2.uml.Package; - - -public class CppLocationStrategy extends HierarchyLocationStrategy { - - public static final String PKG_PREFIX = "Pkg_"; //$NON-NLS-1$ - - /** - * Return the filename for a given named element. - * - * @param element - * a named element - * @return filename for this element - */ - public String getFileName(NamedElement element) { - if (element instanceof Package) { - // specific prefix for packages - String folder = super.getFileName(element); - if (folder.length() > 0) { - folder += HierarchyLocationStrategy.SEP_CHAR; - } - return folder + PKG_PREFIX + element.getName(); - } - else return super.getFileName(element); - } -} diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/transformation/CppModelElementsCreator.java b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/transformation/CppModelElementsCreator.java deleted file mode 100644 index ff974a517e5..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/transformation/CppModelElementsCreator.java +++ /dev/null @@ -1,243 +0,0 @@ -/*******************************************************************************
- * Copyright (c) 2006 - 2012 CEA LIST.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.papyrus.cpp.codegen.transformation;
-
-import org.eclipse.cdt.core.CCorePlugin;
-import org.eclipse.cdt.core.ToolFactory;
-import org.eclipse.cdt.core.formatter.CodeFormatter;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.Document;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.papyrus.C_Cpp.ExternLibrary;
-import org.eclipse.papyrus.C_Cpp.External;
-import org.eclipse.papyrus.C_Cpp.Include;
-import org.eclipse.papyrus.C_Cpp.ManualGeneration;
-import org.eclipse.papyrus.C_Cpp.NoCodeGen;
-import org.eclipse.papyrus.C_Cpp.Template;
-import org.eclipse.papyrus.codegen.base.GenUtils;
-import org.eclipse.papyrus.codegen.base.IPFileSystemAccess;
-import org.eclipse.papyrus.codegen.base.ModelElementsCreator;
-import org.eclipse.papyrus.codegen.base.ProjectBasedFileAccess;
-import org.eclipse.papyrus.cpp.codegen.Activator;
-import org.eclipse.papyrus.cpp.codegen.Constants;
-import org.eclipse.papyrus.cpp.codegen.Messages;
-import org.eclipse.papyrus.cpp.codegen.preferences.CppCodeGenUtils;
-import org.eclipse.papyrus.cpp.codegen.xtend.CppClassifierGenerator;
-import org.eclipse.papyrus.cpp.codegen.xtend.CppPackageHeaderGenerator;
-import org.eclipse.text.edits.MalformedTreeException;
-import org.eclipse.text.edits.TextEdit;
-import org.eclipse.uml2.uml.Association;
-import org.eclipse.uml2.uml.Class;
-import org.eclipse.uml2.uml.Classifier;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.Enumeration;
-import org.eclipse.uml2.uml.Package;
-import org.eclipse.uml2.uml.PackageableElement;
-import org.eclipse.uml2.uml.PrimitiveType;
-import org.eclipse.uml2.uml.Relationship;
-import org.eclipse.uml2.uml.Signal;
-import org.eclipse.uml2.uml.SignalEvent;
-import org.eclipse.uml2.uml.Usage;
-import org.eclipse.uml2.uml.util.UMLUtil;
-
-
-
-/**
- * Main class of C++ code generator
- *
- * @author Ansgar Radermacher (ansgar.radermacher@cea.fr)
- * @author Önder GÜRCAN (onder.gurcan@cea.fr)
- */
-public class CppModelElementsCreator extends ModelElementsCreator {
-
- /**
- * Constructor.
- *
- * @param project
- * the project in which the generated code should be placed
- */
- public CppModelElementsCreator(IProject project) {
- this(new ProjectBasedFileAccess(project), null);
- }
-
- /**
- * Constructor, allows for non-standard commentHeader
- *
- * @param project
- * the project in which the generated code should be placed
- * @param commentHeader
- * Custom prefix for each generated file
- */
- public CppModelElementsCreator(IProject project, String commentHeader) {
- this(new ProjectBasedFileAccess(project), commentHeader);
- }
-
- /**
- * Constructor. Pass caller defined file system access and commentHeader
- *
- * @param project
- * the project in which the generated code should be placed
- * @param commentHeader
- * commentHeader. If null, take from preferences
- */
- public CppModelElementsCreator(IPFileSystemAccess fileSystemAccess, String commentHeader) {
- super(fileSystemAccess, new CppLocationStrategy());
- this.commentHeader = (commentHeader != null) ?
- commentHeader :
- CppCodeGenUtils.getCommentHeader();
- hppExt = CppCodeGenUtils.getHeaderSuffix();
- cppExt = CppCodeGenUtils.getBodySuffix();
- }
-
- protected String hppExt;
-
- protected String cppExt;
-
- protected String commentHeader;
-
- /**
- * Creates the files corresponding to the class. For a "simple" class
- * generates 2 headers (one for the privates concrete operations and one for
- * the attributes, public operations and virtual / abstract operations and
- * one body file.
- *
- * @param folder
- * @param classifier
- * @throws CoreException
- */
- @Override
- protected void createPackageableElementFile(PackageableElement element, IProgressMonitor monitor) {
- if (element instanceof Package) {
- generatePkg((Package) element);
- }
-
- else if ((element instanceof PrimitiveType) || (element instanceof Enumeration) || (element instanceof Usage)) {
- // do nothing, included in package
- }
- else if (element instanceof Classifier) {
- generateClassifier((Classifier) element);
- }
- else if (element instanceof Relationship) {
- // no code generation for relationships
- }
- else if (element instanceof Signal) {
- // TODO: not supported, but do nothing
- }
- else if (element instanceof SignalEvent) {
- // TODO: not supported, but do nothing
- }
- else {
- Activator.log.debug("C++ code generator: unsupported model element " + element); //$NON-NLS-1$
- }
- }
-
- protected void generateClassifier(Classifier classifier) {
-
- // treat case of manual code generation
- if (GenUtils.hasStereotype(classifier, ManualGeneration.class)) {
- final ManualGeneration mg = UMLUtil.getStereotypeApplication(classifier, ManualGeneration.class);
- final Include cppInclude = UMLUtil.getStereotypeApplication(classifier, Include.class);
- final String fileContentH = commentHeader + cppInclude.getHeader();
-
- // generate header code
- final String fileNameH = locStrategy.getFileName(classifier) + Constants.DOT + hppExt;
-
- generateFile(fileNameH, fileContentH);
-
- // generate body code
- String fileContentB = commentHeader +
- cppInclude.getPreBody() + GenUtils.NL +
- cppInclude.getBody() + GenUtils.NL;
- String ext = GenUtils.maskNull(mg.getExtensionBody());
- if (ext.length() == 0) {
- ext = cppExt;
- }
- String fileNameB = locStrategy.getFileName(classifier) + Constants.DOT + ext;
- generateFile(fileNameB, fileContentB);
- }
-
- // Only generate when no CppNoCodeGen stereotype is applied to the class
- else if ((!noCodeGen(classifier)) && (!GenUtils.hasStereotype(classifier, Template.class)) &&
- (!(classifier instanceof Association))) {
-
- // Template Bound Class
- if (GenUtils.isTemplateBoundElement(classifier)) {
- final String bindHeaderFileName = locStrategy.getFileName(classifier) + Constants.DOT + hppExt;
- generateFile(bindHeaderFileName, commentHeader + CppClassifierGenerator.generateBindHeaderCode(classifier));
-
- final String bindBodyFileName = locStrategy.getFileName(classifier) + Constants.DOT + cppExt;
- generateFile(bindBodyFileName, commentHeader + CppClassifierGenerator.generateBindBodyCode(classifier));
- }
- else {
- // Class Header file generation
- final String classHeaderFileName = locStrategy.getFileName(classifier) + Constants.DOT + hppExt;
- generateFile(classHeaderFileName, commentHeader + CppClassifierGenerator.generateClassHeaderCode(classifier));
-
- // Class Body file generation
- if (classifier instanceof Class) {
- final String classBodyFileName = locStrategy.getFileName(classifier) + Constants.DOT + cppExt;
- generateFile(classBodyFileName, commentHeader + CppClassifierGenerator.generateClassBodyCode(classifier));
- }
- }
- }
- }
-
- protected void generatePkg(Package pkg) {
- final String fileName = locStrategy.getFileName(pkg) + Constants.DOT + hppExt;
- generateFile(fileName, CppPackageHeaderGenerator.generateCode(pkg).toString());
- }
-
- protected void generateFile(String fileName, String content) {
- fileSystemAccess.generateFile(fileName, format(content));
- }
-
- /**
- * Apply the user's currently selected formatting options to the input content. Return the
- * input String in case of error.
- */
- private static String format(String content) {
-
- // do nothing if the CDT plugin is not loaded
- if (Platform.getBundle(CCorePlugin.PLUGIN_ID) == null)
- return content;
-
- CodeFormatter codeFormatter = ToolFactory.createCodeFormatter(null);
- IDocument doc = new Document(content);
-
- TextEdit edit = codeFormatter.format(CodeFormatter.K_TRANSLATION_UNIT, doc.get(), 0, doc.get().length(), 0, null);
-
- if (edit == null) {
- Activator.log.debug(Messages.CppModelElementsCreator_CannotFormatContent);
- return content;
- }
-
- try {
- edit.apply(doc);
- return doc.get();
- } catch (MalformedTreeException e) {
- Activator.log.error(e);
- } catch (BadLocationException e) {
- Activator.log.error(e);
- }
- return content;
- }
-
- protected boolean noCodeGen(Element element) {
- return GenUtils.hasStereotype(element, NoCodeGen.class) ||
- GenUtils.hasStereotype(element, External.class) ||
- GenUtils.hasStereotypeTree(element, ExternLibrary.class);
- }
-}
diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/utils/ClassUtils.java b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/utils/ClassUtils.java deleted file mode 100644 index 7653753411f..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/utils/ClassUtils.java +++ /dev/null @@ -1,81 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 - 2012 CEA LIST. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * CEA LIST - initial API and implementation - *******************************************************************************/ - -package org.eclipse.papyrus.cpp.codegen.utils; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.common.util.UniqueEList; -import org.eclipse.papyrus.codegen.base.GenUtils; -import org.eclipse.uml2.uml.Class; -import org.eclipse.uml2.uml.Classifier; -import org.eclipse.uml2.uml.Element; -import org.eclipse.uml2.uml.Interface; -import org.eclipse.uml2.uml.Operation; - -/** - * A set of utility functions related to classes. - * - * @author ansgar (ansgar.radermacher@cea.fr) - * - */ -public class ClassUtils { - - /** - * Calculate the list of classifiers that needs to be included - * - * @param currentClass - * @return - */ - public static EList<Classifier> includedClassifiers(Classifier currentClass) { - // Retrieve package used by current package (dependencies) - // use a unique list to avoid duplicates - EList<Classifier> usedClasses = new UniqueEList<Classifier>(); - - // class attributes dependencies - usedClasses.addAll(GenUtils.getOwnedAttributeTypes(currentClass)); - // operation parameters dependencies - usedClasses.addAll(GenUtils.getTypesViaOperations(currentClass)); - // inner classifier dependencies - usedClasses.addAll(GenUtils.getInnerClassifierTypes(currentClass)); - // realized interface dependencies - if (currentClass instanceof Class) { - Class clazz = (Class) currentClass; - EList<Interface> implementedInterfaces = clazz.getImplementedInterfaces(); - usedClasses.addAll(implementedInterfaces); - } - // dependencies and associations - usedClasses.addAll(GenUtils.getTypesViaRelationshipsNoDeps(currentClass)); - - // template parameters are declared locally (if owned) and do not correspond to a file - // that can be included - usedClasses.removeAll(GenUtils.getTemplateParameteredElements(currentClass)); - return usedClasses; - } - - /** - * Retrieve the list of operations of classes nested in the current class - * without the operations directly owned by the current class - * - * @param currentClass - * @return - */ - public static EList<Operation> nestedOperations(Classifier currentClass) { - EList<Operation> nestedOperations = new UniqueEList<Operation>(); - - for (Element element : currentClass.allOwnedElements()) { - if (element instanceof Operation && !(element.getOwner().equals(currentClass))) { - nestedOperations.add((Operation) element); - } - } - - return nestedOperations; - } -} diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/utils/CppGenUtils.emtl b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/utils/CppGenUtils.emtl deleted file mode 100644 index 967aca987ef..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/utils/CppGenUtils.emtl +++ /dev/null @@ -1,993 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:mtl="http://www.eclipse.org/acceleo/mtl/3.0" xmlns:ocl.ecore="http://www.eclipse.org/ocl/1.1.0/Ecore"> - <mtl:Module name="CppGenUtils" nsURI="org::eclipse::papyrus::cpp::codegen::utils::CppGenUtils" startHeaderPosition="29" endHeaderPosition="89"> - <input> - <takesTypesFrom href="http://www.eclipse.org/uml2/5.0.0/UML#/"/> - </input> - <ownedModuleElement xsi:type="mtl:Query" name="getTemplateParametersWoType" visibility="Public"> - <parameter name="arg0"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Classifier"/> - </parameter> - <expression xsi:type="ocl.ecore:OperationCallExp" referredOperation="/1/OclAny_Class/invoke"> - <eType xsi:type="ocl.ecore:AnyType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/OclAny"/> - <source xsi:type="ocl.ecore:VariableExp" name="self" referredVariable="/5"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Classifier"/> - </source> - <argument xsi:type="ocl.ecore:StringLiteralExp" stringSymbol="org.eclipse.papyrus.cpp.codegen.utils.CppGenUtils"> - <eType xsi:type="ocl.ecore:PrimitiveType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/String"/> - </argument> - <argument xsi:type="ocl.ecore:StringLiteralExp" stringSymbol="getTemplateParametersWoType(org.eclipse.uml2.uml.Classifier)"> - <eType xsi:type="ocl.ecore:PrimitiveType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/String"/> - </argument> - <argument xsi:type="ocl.ecore:CollectionLiteralExp" eType="/4/Sequence(Classifier)" kind="Sequence"> - <part xsi:type="ocl.ecore:CollectionItem"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Classifier"/> - <item xsi:type="ocl.ecore:VariableExp" name="arg0" referredVariable="/0/getTemplateParametersWoType/arg0"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Classifier"/> - </item> - </part> - </argument> - </expression> - <type xsi:type="ocl.ecore:PrimitiveType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/String"/> - </ownedModuleElement> - <ownedModuleElement xsi:type="mtl:Query" name="getStdtypes" visibility="Public"> - <parameter name="arg0"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//PrimitiveType"/> - </parameter> - <expression xsi:type="ocl.ecore:OperationCallExp" referredOperation="/1/OclAny_Class/invoke"> - <eType xsi:type="ocl.ecore:AnyType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/OclAny"/> - <source xsi:type="ocl.ecore:VariableExp" name="self" referredVariable="/8"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//PrimitiveType"/> - </source> - <argument xsi:type="ocl.ecore:StringLiteralExp" stringSymbol="org.eclipse.papyrus.cpp.codegen.utils.CppGenUtils"> - <eType xsi:type="ocl.ecore:PrimitiveType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/String"/> - </argument> - <argument xsi:type="ocl.ecore:StringLiteralExp" stringSymbol="getStdtypes(org.eclipse.uml2.uml.PrimitiveType)"> - <eType xsi:type="ocl.ecore:PrimitiveType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/String"/> - </argument> - <argument xsi:type="ocl.ecore:CollectionLiteralExp" eType="/4/Sequence(PrimitiveType)" kind="Sequence"> - <part xsi:type="ocl.ecore:CollectionItem"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//PrimitiveType"/> - <item xsi:type="ocl.ecore:VariableExp" name="arg0" referredVariable="/0/getStdtypes/arg0"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//PrimitiveType"/> - </item> - </part> - </argument> - </expression> - <type xsi:type="ocl.ecore:PrimitiveType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/String"/> - </ownedModuleElement> - <ownedModuleElement xsi:type="mtl:Query" name="cppQualifiedName" visibility="Public"> - <parameter name="arg0"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//NamedElement"/> - </parameter> - <expression xsi:type="ocl.ecore:OperationCallExp" referredOperation="/1/OclAny_Class/invoke"> - <eType xsi:type="ocl.ecore:AnyType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/OclAny"/> - <source xsi:type="ocl.ecore:VariableExp" name="self" referredVariable="/11"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//NamedElement"/> - </source> - <argument xsi:type="ocl.ecore:StringLiteralExp" stringSymbol="org.eclipse.papyrus.cpp.codegen.utils.CppGenUtils"> - <eType xsi:type="ocl.ecore:PrimitiveType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/String"/> - </argument> - <argument xsi:type="ocl.ecore:StringLiteralExp" stringSymbol="cppQualifiedName(org.eclipse.uml2.uml.NamedElement)"> - <eType xsi:type="ocl.ecore:PrimitiveType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/String"/> - </argument> - <argument xsi:type="ocl.ecore:CollectionLiteralExp" eType="/4/Sequence(NamedElement)" kind="Sequence"> - <part xsi:type="ocl.ecore:CollectionItem"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//NamedElement"/> - <item xsi:type="ocl.ecore:VariableExp" name="arg0" referredVariable="/0/cppQualifiedName/arg0"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//NamedElement"/> - </item> - </part> - </argument> - </expression> - <type xsi:type="ocl.ecore:PrimitiveType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/String"/> - </ownedModuleElement> - <ownedModuleElement xsi:type="mtl:Query" name="getTemplateTypeName" visibility="Public"> - <parameter name="arg0"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//TemplateParameter"/> - </parameter> - <expression xsi:type="ocl.ecore:OperationCallExp" referredOperation="/1/OclAny_Class/invoke"> - <eType xsi:type="ocl.ecore:AnyType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/OclAny"/> - <source xsi:type="ocl.ecore:VariableExp" name="self" referredVariable="/14"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//TemplateParameter"/> - </source> - <argument xsi:type="ocl.ecore:StringLiteralExp" stringSymbol="org.eclipse.papyrus.cpp.codegen.utils.CppGenUtils"> - <eType xsi:type="ocl.ecore:PrimitiveType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/String"/> - </argument> - <argument xsi:type="ocl.ecore:StringLiteralExp" stringSymbol="getTemplateTypeName(org.eclipse.uml2.uml.TemplateParameter)"> - <eType xsi:type="ocl.ecore:PrimitiveType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/String"/> - </argument> - <argument xsi:type="ocl.ecore:CollectionLiteralExp" eType="/4/Sequence(TemplateParameter)" kind="Sequence"> - <part xsi:type="ocl.ecore:CollectionItem"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//TemplateParameter"/> - <item xsi:type="ocl.ecore:VariableExp" name="arg0" referredVariable="/0/getTemplateTypeName/arg0"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//TemplateParameter"/> - </item> - </part> - </argument> - </expression> - <type xsi:type="ocl.ecore:PrimitiveType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/String"/> - </ownedModuleElement> - <ownedModuleElement xsi:type="mtl:Query" name="getNamespace" visibility="Public"> - <parameter name="arg0"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//NamedElement"/> - </parameter> - <expression xsi:type="ocl.ecore:OperationCallExp" referredOperation="/1/OclAny_Class/invoke"> - <eType xsi:type="ocl.ecore:AnyType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/OclAny"/> - <source xsi:type="ocl.ecore:VariableExp" name="self" referredVariable="/17"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//NamedElement"/> - </source> - <argument xsi:type="ocl.ecore:StringLiteralExp" stringSymbol="org.eclipse.papyrus.cpp.codegen.utils.CppGenUtils"> - <eType xsi:type="ocl.ecore:PrimitiveType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/String"/> - </argument> - <argument xsi:type="ocl.ecore:StringLiteralExp" stringSymbol="getNamespace(org.eclipse.uml2.uml.NamedElement)"> - <eType xsi:type="ocl.ecore:PrimitiveType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/String"/> - </argument> - <argument xsi:type="ocl.ecore:CollectionLiteralExp" eType="/4/Sequence(NamedElement)" kind="Sequence"> - <part xsi:type="ocl.ecore:CollectionItem"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//NamedElement"/> - <item xsi:type="ocl.ecore:VariableExp" name="arg0" referredVariable="/0/getNamespace/arg0"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//NamedElement"/> - </item> - </part> - </argument> - </expression> - <type xsi:type="ocl.ecore:PrimitiveType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/String"/> - </ownedModuleElement> - <ownedModuleElement xsi:type="mtl:Query" name="openNS" visibility="Public"> - <parameter name="arg0"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//NamedElement"/> - </parameter> - <expression xsi:type="ocl.ecore:OperationCallExp" referredOperation="/1/OclAny_Class/invoke"> - <eType xsi:type="ocl.ecore:AnyType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/OclAny"/> - <source xsi:type="ocl.ecore:VariableExp" name="self" referredVariable="/20"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//NamedElement"/> - </source> - <argument xsi:type="ocl.ecore:StringLiteralExp" stringSymbol="org.eclipse.papyrus.cpp.codegen.utils.CppGenUtils"> - <eType xsi:type="ocl.ecore:PrimitiveType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/String"/> - </argument> - <argument xsi:type="ocl.ecore:StringLiteralExp" stringSymbol="openNS(org.eclipse.uml2.uml.NamedElement)"> - <eType xsi:type="ocl.ecore:PrimitiveType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/String"/> - </argument> - <argument xsi:type="ocl.ecore:CollectionLiteralExp" eType="/4/Sequence(NamedElement)" kind="Sequence"> - <part xsi:type="ocl.ecore:CollectionItem"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//NamedElement"/> - <item xsi:type="ocl.ecore:VariableExp" name="arg0" referredVariable="/0/openNS/arg0"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//NamedElement"/> - </item> - </part> - </argument> - </expression> - <type xsi:type="ocl.ecore:PrimitiveType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/String"/> - </ownedModuleElement> - <ownedModuleElement xsi:type="mtl:Query" name="closeNS" visibility="Public"> - <parameter name="arg0"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//NamedElement"/> - </parameter> - <expression xsi:type="ocl.ecore:OperationCallExp" referredOperation="/1/OclAny_Class/invoke"> - <eType xsi:type="ocl.ecore:AnyType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/OclAny"/> - <source xsi:type="ocl.ecore:VariableExp" name="self" referredVariable="/23"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//NamedElement"/> - </source> - <argument xsi:type="ocl.ecore:StringLiteralExp" stringSymbol="org.eclipse.papyrus.cpp.codegen.utils.CppGenUtils"> - <eType xsi:type="ocl.ecore:PrimitiveType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/String"/> - </argument> - <argument xsi:type="ocl.ecore:StringLiteralExp" stringSymbol="closeNS(org.eclipse.uml2.uml.NamedElement)"> - <eType xsi:type="ocl.ecore:PrimitiveType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/String"/> - </argument> - <argument xsi:type="ocl.ecore:CollectionLiteralExp" eType="/4/Sequence(NamedElement)" kind="Sequence"> - <part xsi:type="ocl.ecore:CollectionItem"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//NamedElement"/> - <item xsi:type="ocl.ecore:VariableExp" name="arg0" referredVariable="/0/closeNS/arg0"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//NamedElement"/> - </item> - </part> - </argument> - </expression> - <type xsi:type="ocl.ecore:PrimitiveType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/String"/> - </ownedModuleElement> - <ownedModuleElement xsi:type="mtl:Query" name="getGeneralizationVisibility" visibility="Public"> - <parameter name="arg0"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Element"/> - </parameter> - <expression xsi:type="ocl.ecore:OperationCallExp" referredOperation="/1/OclAny_Class/invoke"> - <eType xsi:type="ocl.ecore:AnyType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/OclAny"/> - <source xsi:type="ocl.ecore:VariableExp" name="self" referredVariable="/26"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Element"/> - </source> - <argument xsi:type="ocl.ecore:StringLiteralExp" stringSymbol="org.eclipse.papyrus.cpp.codegen.utils.CppGenUtils"> - <eType xsi:type="ocl.ecore:PrimitiveType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/String"/> - </argument> - <argument xsi:type="ocl.ecore:StringLiteralExp" stringSymbol="getGeneralizationVisibility(org.eclipse.uml2.uml.Element)"> - <eType xsi:type="ocl.ecore:PrimitiveType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/String"/> - </argument> - <argument xsi:type="ocl.ecore:CollectionLiteralExp" eType="/4/Sequence(Element)" kind="Sequence"> - <part xsi:type="ocl.ecore:CollectionItem"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Element"/> - <item xsi:type="ocl.ecore:VariableExp" name="arg0" referredVariable="/0/getGeneralizationVisibility/arg0"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Element"/> - </item> - </part> - </argument> - </expression> - <type xsi:type="ocl.ecore:PrimitiveType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/String"/> - </ownedModuleElement> - <ownedModuleElement xsi:type="mtl:Query" name="resetVisibility" visibility="Public"> - <parameter name="arg0"> - <eType xsi:type="ecore:EEnum" href="http://www.eclipse.org/uml2/5.0.0/UML#//VisibilityKind"/> - </parameter> - <expression xsi:type="ocl.ecore:OperationCallExp" referredOperation="/1/OclAny_Class/invoke"> - <eType xsi:type="ocl.ecore:AnyType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/OclAny"/> - <source xsi:type="ocl.ecore:VariableExp" name="self" referredVariable="/29"> - <eType xsi:type="ecore:EEnum" href="http://www.eclipse.org/uml2/5.0.0/UML#//VisibilityKind"/> - </source> - <argument xsi:type="ocl.ecore:StringLiteralExp" stringSymbol="org.eclipse.papyrus.cpp.codegen.utils.CppGenUtils"> - <eType xsi:type="ocl.ecore:PrimitiveType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/String"/> - </argument> - <argument xsi:type="ocl.ecore:StringLiteralExp" stringSymbol="resetVisibility(org.eclipse.uml2.uml.VisibilityKind)"> - <eType xsi:type="ocl.ecore:PrimitiveType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/String"/> - </argument> - <argument xsi:type="ocl.ecore:CollectionLiteralExp" eType="/4/Sequence(VisibilityKind)" kind="Sequence"> - <part xsi:type="ocl.ecore:CollectionItem"> - <eType xsi:type="ecore:EEnum" href="http://www.eclipse.org/uml2/5.0.0/UML#//VisibilityKind"/> - <item xsi:type="ocl.ecore:VariableExp" name="arg0" referredVariable="/0/resetVisibility/arg0"> - <eType xsi:type="ecore:EEnum" href="http://www.eclipse.org/uml2/5.0.0/UML#//VisibilityKind"/> - </item> - </part> - </argument> - </expression> - <type xsi:type="ocl.ecore:PrimitiveType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/String"/> - </ownedModuleElement> - <ownedModuleElement xsi:type="mtl:Query" name="getSection" visibility="Public"> - <parameter name="arg0"> - <eType xsi:type="ecore:EEnum" href="http://www.eclipse.org/uml2/5.0.0/UML#//VisibilityKind"/> - </parameter> - <parameter name="arg1"> - <eType xsi:type="ocl.ecore:PrimitiveType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/String"/> - </parameter> - <expression xsi:type="ocl.ecore:OperationCallExp" referredOperation="/1/OclAny_Class/invoke"> - <eType xsi:type="ocl.ecore:AnyType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/OclAny"/> - <source xsi:type="ocl.ecore:VariableExp" name="self" referredVariable="/32"> - <eType xsi:type="ecore:EEnum" href="http://www.eclipse.org/uml2/5.0.0/UML#//VisibilityKind"/> - </source> - <argument xsi:type="ocl.ecore:StringLiteralExp" stringSymbol="org.eclipse.papyrus.cpp.codegen.utils.CppGenUtils"> - <eType xsi:type="ocl.ecore:PrimitiveType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/String"/> - </argument> - <argument xsi:type="ocl.ecore:StringLiteralExp" stringSymbol="getSection(org.eclipse.uml2.uml.VisibilityKind, java.lang.String)"> - <eType xsi:type="ocl.ecore:PrimitiveType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/String"/> - </argument> - <argument xsi:type="ocl.ecore:CollectionLiteralExp" eType="/4/Sequence(OclAny)" kind="Sequence"> - <part xsi:type="ocl.ecore:CollectionItem"> - <eType xsi:type="ecore:EEnum" href="http://www.eclipse.org/uml2/5.0.0/UML#//VisibilityKind"/> - <item xsi:type="ocl.ecore:VariableExp" name="arg0" referredVariable="/0/getSection/arg0"> - <eType xsi:type="ecore:EEnum" href="http://www.eclipse.org/uml2/5.0.0/UML#//VisibilityKind"/> - </item> - </part> - <part xsi:type="ocl.ecore:CollectionItem"> - <eType xsi:type="ocl.ecore:PrimitiveType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/String"/> - <item xsi:type="ocl.ecore:VariableExp" name="arg1" referredVariable="/0/getSection/arg1"> - <eType xsi:type="ocl.ecore:PrimitiveType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/String"/> - </item> - </part> - </argument> - </expression> - <type xsi:type="ocl.ecore:PrimitiveType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/String"/> - </ownedModuleElement> - </mtl:Module> - <ecore:EPackage name="additions"> - <eClassifiers xsi:type="ecore:EClass" name="String_Class"> - <eAnnotations source="http://www.eclipse.org/ocl/1.1.0/OCL"> - <references href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/String"/> - </eAnnotations> - </eClassifiers> - <eClassifiers xsi:type="ecore:EClass" name="Integer_Class"> - <eAnnotations source="http://www.eclipse.org/ocl/1.1.0/OCL"> - <references href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/Integer"/> - </eAnnotations> - </eClassifiers> - <eClassifiers xsi:type="ecore:EClass" name="Real_Class"> - <eAnnotations source="http://www.eclipse.org/ocl/1.1.0/OCL"> - <references href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/Real"/> - </eAnnotations> - </eClassifiers> - <eClassifiers xsi:type="ecore:EClass" name="EObject_Class"> - <eAnnotations source="http://www.eclipse.org/ocl/1.1.0/OCL"> - <references href="http://www.eclipse.org/emf/2002/Ecore#//EObject"/> - </eAnnotations> - <eOperations name="getTemplateParametersWoType"> - <eAnnotations source="http://www.eclipse.org/ocl/1.1.0/OCL"> - <contents xsi:type="ocl.ecore:Constraint"/> - </eAnnotations> - <eAnnotations source="MTL" references="/0/getTemplateParametersWoType"/> - <eType xsi:type="ocl.ecore:PrimitiveType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/String"/> - <eParameters name="arg0"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Classifier"/> - </eParameters> - </eOperations> - <eOperations name="getStdtypes"> - <eAnnotations source="http://www.eclipse.org/ocl/1.1.0/OCL"> - <contents xsi:type="ocl.ecore:Constraint"/> - </eAnnotations> - <eAnnotations source="MTL" references="/0/getStdtypes"/> - <eType xsi:type="ocl.ecore:PrimitiveType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/String"/> - <eParameters name="arg0"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//PrimitiveType"/> - </eParameters> - </eOperations> - <eOperations name="cppQualifiedName"> - <eAnnotations source="http://www.eclipse.org/ocl/1.1.0/OCL"> - <contents xsi:type="ocl.ecore:Constraint"/> - </eAnnotations> - <eAnnotations source="MTL" references="/0/cppQualifiedName"/> - <eType xsi:type="ocl.ecore:PrimitiveType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/String"/> - <eParameters name="arg0"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//NamedElement"/> - </eParameters> - </eOperations> - <eOperations name="getTemplateTypeName"> - <eAnnotations source="http://www.eclipse.org/ocl/1.1.0/OCL"> - <contents xsi:type="ocl.ecore:Constraint"/> - </eAnnotations> - <eAnnotations source="MTL" references="/0/getTemplateTypeName"/> - <eType xsi:type="ocl.ecore:PrimitiveType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/String"/> - <eParameters name="arg0"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//TemplateParameter"/> - </eParameters> - </eOperations> - <eOperations name="getNamespace"> - <eAnnotations source="http://www.eclipse.org/ocl/1.1.0/OCL"> - <contents xsi:type="ocl.ecore:Constraint"/> - </eAnnotations> - <eAnnotations source="MTL" references="/0/getNamespace"/> - <eType xsi:type="ocl.ecore:PrimitiveType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/String"/> - <eParameters name="arg0"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//NamedElement"/> - </eParameters> - </eOperations> - <eOperations name="openNS"> - <eAnnotations source="http://www.eclipse.org/ocl/1.1.0/OCL"> - <contents xsi:type="ocl.ecore:Constraint"/> - </eAnnotations> - <eAnnotations source="MTL" references="/0/openNS"/> - <eType xsi:type="ocl.ecore:PrimitiveType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/String"/> - <eParameters name="arg0"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//NamedElement"/> - </eParameters> - </eOperations> - <eOperations name="closeNS"> - <eAnnotations source="http://www.eclipse.org/ocl/1.1.0/OCL"> - <contents xsi:type="ocl.ecore:Constraint"/> - </eAnnotations> - <eAnnotations source="MTL" references="/0/closeNS"/> - <eType xsi:type="ocl.ecore:PrimitiveType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/String"/> - <eParameters name="arg0"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//NamedElement"/> - </eParameters> - </eOperations> - <eOperations name="getGeneralizationVisibility"> - <eAnnotations source="http://www.eclipse.org/ocl/1.1.0/OCL"> - <contents xsi:type="ocl.ecore:Constraint"/> - </eAnnotations> - <eAnnotations source="MTL" references="/0/getGeneralizationVisibility"/> - <eType xsi:type="ocl.ecore:PrimitiveType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/String"/> - <eParameters name="arg0"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Element"/> - </eParameters> - </eOperations> - <eOperations name="resetVisibility"> - <eAnnotations source="http://www.eclipse.org/ocl/1.1.0/OCL"> - <contents xsi:type="ocl.ecore:Constraint"/> - </eAnnotations> - <eAnnotations source="MTL" references="/0/resetVisibility"/> - <eType xsi:type="ocl.ecore:PrimitiveType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/String"/> - <eParameters name="arg0"> - <eType xsi:type="ecore:EEnum" href="http://www.eclipse.org/uml2/5.0.0/UML#//VisibilityKind"/> - </eParameters> - </eOperations> - <eOperations name="getSection"> - <eAnnotations source="http://www.eclipse.org/ocl/1.1.0/OCL"> - <contents xsi:type="ocl.ecore:Constraint"/> - </eAnnotations> - <eAnnotations source="MTL" references="/0/getSection"/> - <eType xsi:type="ocl.ecore:PrimitiveType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/String"/> - <eParameters name="arg0"> - <eType xsi:type="ecore:EEnum" href="http://www.eclipse.org/uml2/5.0.0/UML#//VisibilityKind"/> - </eParameters> - <eParameters name="arg1"> - <eType xsi:type="ocl.ecore:PrimitiveType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/String"/> - </eParameters> - </eOperations> - </eClassifiers> - <eClassifiers xsi:type="ecore:EClass" name="OclAny_Class"> - <eAnnotations source="http://www.eclipse.org/ocl/1.1.0/OCL"> - <references href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/OclAny"/> - </eAnnotations> - <eOperations name="invoke"> - <eAnnotations source="MTL non-standard"/> - <eType xsi:type="ocl.ecore:AnyType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/OclAny"/> - <eParameters name="class"> - <eType xsi:type="ocl.ecore:PrimitiveType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/String"/> - </eParameters> - <eParameters name="method"> - <eType xsi:type="ocl.ecore:PrimitiveType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/String"/> - </eParameters> - <eParameters name="arguments"> - <eType xsi:type="ocl.ecore:SequenceType" href="http://www.eclipse.org/acceleo/mtl/3.0/mtlnonstdlib.ecore#//Sequence(OclAny)"/> - </eParameters> - </eOperations> - </eClassifiers> - <eClassifiers xsi:type="ecore:EClass" name="Collection(T)_Class"> - <eAnnotations source="http://www.eclipse.org/ocl/1.1.0/OCL"> - <references href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/Collection(T)"/> - </eAnnotations> - </eClassifiers> - <eClassifiers xsi:type="ecore:EClass" name="Sequence(T)_Class"> - <eAnnotations source="http://www.eclipse.org/ocl/1.1.0/OCL"> - <references href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/Sequence(T)"/> - </eAnnotations> - </eClassifiers> - <eClassifiers xsi:type="ecore:EClass" name="OrderedSet(T)_Class"> - <eAnnotations source="http://www.eclipse.org/ocl/1.1.0/OCL"> - <references href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/OrderedSet(T)"/> - </eAnnotations> - </eClassifiers> - <eClassifiers xsi:type="ecore:EClass" name="Classifier_Class"> - <eAnnotations source="http://www.eclipse.org/ocl/1.1.0/OCL"> - <references href="http://www.eclipse.org/uml2/5.0.0/UML#//Classifier"/> - </eAnnotations> - </eClassifiers> - <eClassifiers xsi:type="ecore:EClass" name="PrimitiveType_Class"> - <eAnnotations source="http://www.eclipse.org/ocl/1.1.0/OCL"> - <references href="http://www.eclipse.org/uml2/5.0.0/UML#//PrimitiveType"/> - </eAnnotations> - </eClassifiers> - <eClassifiers xsi:type="ecore:EClass" name="NamedElement_Class"> - <eAnnotations source="http://www.eclipse.org/ocl/1.1.0/OCL"> - <references href="http://www.eclipse.org/uml2/5.0.0/UML#//NamedElement"/> - </eAnnotations> - </eClassifiers> - <eClassifiers xsi:type="ecore:EClass" name="TemplateParameter_Class"> - <eAnnotations source="http://www.eclipse.org/ocl/1.1.0/OCL"> - <references href="http://www.eclipse.org/uml2/5.0.0/UML#//TemplateParameter"/> - </eAnnotations> - </eClassifiers> - <eClassifiers xsi:type="ecore:EClass" name="Element_Class"> - <eAnnotations source="http://www.eclipse.org/ocl/1.1.0/OCL"> - <references href="http://www.eclipse.org/uml2/5.0.0/UML#//Element"/> - </eAnnotations> - </eClassifiers> - <eClassifiers xsi:type="ecore:EClass" name="VisibilityKind_Class"> - <eAnnotations source="http://www.eclipse.org/ocl/1.1.0/OCL"> - <references href="http://www.eclipse.org/uml2/5.0.0/UML#//VisibilityKind"/> - </eAnnotations> - </eClassifiers> - </ecore:EPackage> - <ocl.ecore:Variable name="self"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/emf/2002/Ecore#//EObject"/> - </ocl.ecore:Variable> - <ocl.ecore:Variable name="self"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Classifier"/> - </ocl.ecore:Variable> - <ecore:EPackage name="collections"> - <eClassifiers xsi:type="ocl.ecore:SequenceType" name="Sequence(Classifier)" instanceClassName="java.util.List"> - <elementType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Classifier"/> - </eClassifiers> - <eClassifiers xsi:type="ocl.ecore:SequenceType" name="Sequence(OclAny)" instanceClassName="java.util.List"> - <elementType xsi:type="ocl.ecore:AnyType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/OclAny"/> - </eClassifiers> - <eClassifiers xsi:type="ocl.ecore:SequenceType" name="Sequence(PrimitiveType)" instanceClassName="java.util.List"> - <elementType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//PrimitiveType"/> - </eClassifiers> - <eClassifiers xsi:type="ocl.ecore:SequenceType" name="Sequence(NamedElement)" instanceClassName="java.util.List"> - <elementType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//NamedElement"/> - </eClassifiers> - <eClassifiers xsi:type="ocl.ecore:SequenceType" name="Sequence(TemplateParameter)" instanceClassName="java.util.List"> - <elementType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//TemplateParameter"/> - </eClassifiers> - <eClassifiers xsi:type="ocl.ecore:SequenceType" name="Sequence(Element)" instanceClassName="java.util.List"> - <elementType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Element"/> - </eClassifiers> - <eClassifiers xsi:type="ocl.ecore:SequenceType" name="Sequence(VisibilityKind)" instanceClassName="java.util.List"> - <elementType xsi:type="ecore:EEnum" href="http://www.eclipse.org/uml2/5.0.0/UML#//VisibilityKind"/> - </eClassifiers> - </ecore:EPackage> - <ocl.ecore:Variable name="self"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Classifier"/> - </ocl.ecore:Variable> - <ocl.ecore:Variable name="self"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/emf/2002/Ecore#//EObject"/> - </ocl.ecore:Variable> - <ocl.ecore:Variable name="self"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//PrimitiveType"/> - </ocl.ecore:Variable> - <ocl.ecore:Variable name="self"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//PrimitiveType"/> - </ocl.ecore:Variable> - <ocl.ecore:Variable name="self"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/emf/2002/Ecore#//EObject"/> - </ocl.ecore:Variable> - <ocl.ecore:Variable name="self"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//NamedElement"/> - </ocl.ecore:Variable> - <ocl.ecore:Variable name="self"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//NamedElement"/> - </ocl.ecore:Variable> - <ocl.ecore:Variable name="self"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/emf/2002/Ecore#//EObject"/> - </ocl.ecore:Variable> - <ocl.ecore:Variable name="self"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//TemplateParameter"/> - </ocl.ecore:Variable> - <ocl.ecore:Variable name="self"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//TemplateParameter"/> - </ocl.ecore:Variable> - <ocl.ecore:Variable name="self"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/emf/2002/Ecore#//EObject"/> - </ocl.ecore:Variable> - <ocl.ecore:Variable name="self"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//NamedElement"/> - </ocl.ecore:Variable> - <ocl.ecore:Variable name="self"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//NamedElement"/> - </ocl.ecore:Variable> - <ocl.ecore:Variable name="self"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/emf/2002/Ecore#//EObject"/> - </ocl.ecore:Variable> - <ocl.ecore:Variable name="self"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//NamedElement"/> - </ocl.ecore:Variable> - <ocl.ecore:Variable name="self"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//NamedElement"/> - </ocl.ecore:Variable> - <ocl.ecore:Variable name="self"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/emf/2002/Ecore#//EObject"/> - </ocl.ecore:Variable> - <ocl.ecore:Variable name="self"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//NamedElement"/> - </ocl.ecore:Variable> - <ocl.ecore:Variable name="self"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//NamedElement"/> - </ocl.ecore:Variable> - <ocl.ecore:Variable name="self"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/emf/2002/Ecore#//EObject"/> - </ocl.ecore:Variable> - <ocl.ecore:Variable name="self"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Element"/> - </ocl.ecore:Variable> - <ocl.ecore:Variable name="self"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Element"/> - </ocl.ecore:Variable> - <ocl.ecore:Variable name="self"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/emf/2002/Ecore#//EObject"/> - </ocl.ecore:Variable> - <ocl.ecore:Variable name="self"> - <eType xsi:type="ecore:EEnum" href="http://www.eclipse.org/uml2/5.0.0/UML#//VisibilityKind"/> - </ocl.ecore:Variable> - <ocl.ecore:Variable name="self"> - <eType xsi:type="ecore:EEnum" href="http://www.eclipse.org/uml2/5.0.0/UML#//VisibilityKind"/> - </ocl.ecore:Variable> - <ocl.ecore:Variable name="self"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/emf/2002/Ecore#//EObject"/> - </ocl.ecore:Variable> - <ocl.ecore:Variable name="self"> - <eType xsi:type="ecore:EEnum" href="http://www.eclipse.org/uml2/5.0.0/UML#//VisibilityKind"/> - </ocl.ecore:Variable> - <ocl.ecore:Variable name="self"> - <eType xsi:type="ecore:EEnum" href="http://www.eclipse.org/uml2/5.0.0/UML#//VisibilityKind"/> - </ocl.ecore:Variable> - <ocl.ecore:Variable name="self"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/emf/2002/Ecore#//EObject"/> - </ocl.ecore:Variable> - <ecore:EAnnotation source="positions"> - <eAnnotations source="positions.0" references="/0/getTemplateParametersWoType"> - <details key="start" value="93"/> - <details key="end" value="308"/> - <details key="line" value="4"/> - </eAnnotations> - <eAnnotations source="positions.1" references="/0/getTemplateParametersWoType/arg0"> - <details key="start" value="135"/> - <details key="end" value="152"/> - <details key="line" value="4"/> - </eAnnotations> - <eAnnotations source="positions.2" references="/0/getTemplateParametersWoType/%"> - <details key="start" value="166"/> - <details key="end" value="305"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.3" references="/0/getTemplateParametersWoType/%/self"> - <details key="start" value="-1"/> - <details key="end" value="-1"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.4" references="/0/getTemplateParametersWoType/%/%"> - <details key="start" value="173"/> - <details key="end" value="224"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.5" references="/0/getTemplateParametersWoType/%/%.1"> - <details key="start" value="226"/> - <details key="end" value="288"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.6" references="/0/getTemplateParametersWoType/%/%.2"> - <details key="start" value="290"/> - <details key="end" value="304"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.7" references="/0/getTemplateParametersWoType/%/%.2/%/arg0"> - <details key="start" value="299"/> - <details key="end" value="303"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.8" references="/0/getStdtypes"> - <details key="start" value="310"/> - <details key="end" value="499"/> - <details key="line" value="8"/> - </eAnnotations> - <eAnnotations source="positions.9" references="/0/getStdtypes/arg0"> - <details key="start" value="336"/> - <details key="end" value="356"/> - <details key="line" value="8"/> - </eAnnotations> - <eAnnotations source="positions.10" references="/0/getStdtypes/%"> - <details key="start" value="370"/> - <details key="end" value="496"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.11" references="/0/getStdtypes/%/self"> - <details key="start" value="-1"/> - <details key="end" value="-1"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.12" references="/0/getStdtypes/%/%"> - <details key="start" value="377"/> - <details key="end" value="428"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.13" references="/0/getStdtypes/%/%.1"> - <details key="start" value="430"/> - <details key="end" value="479"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.14" references="/0/getStdtypes/%/%.2"> - <details key="start" value="481"/> - <details key="end" value="495"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.15" references="/0/getStdtypes/%/%.2/%/arg0"> - <details key="start" value="490"/> - <details key="end" value="494"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.16" references="/0/cppQualifiedName"> - <details key="start" value="501"/> - <details key="end" value="698"/> - <details key="line" value="12"/> - </eAnnotations> - <eAnnotations source="positions.17" references="/0/cppQualifiedName/arg0"> - <details key="start" value="532"/> - <details key="end" value="551"/> - <details key="line" value="12"/> - </eAnnotations> - <eAnnotations source="positions.18" references="/0/cppQualifiedName/%"> - <details key="start" value="565"/> - <details key="end" value="695"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.19" references="/0/cppQualifiedName/%/self"> - <details key="start" value="-1"/> - <details key="end" value="-1"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.20" references="/0/cppQualifiedName/%/%"> - <details key="start" value="572"/> - <details key="end" value="623"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.21" references="/0/cppQualifiedName/%/%.1"> - <details key="start" value="625"/> - <details key="end" value="678"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.22" references="/0/cppQualifiedName/%/%.2"> - <details key="start" value="680"/> - <details key="end" value="694"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.23" references="/0/cppQualifiedName/%/%.2/%/arg0"> - <details key="start" value="689"/> - <details key="end" value="693"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.24" references="/0/getTemplateTypeName"> - <details key="start" value="700"/> - <details key="end" value="913"/> - <details key="line" value="16"/> - </eAnnotations> - <eAnnotations source="positions.25" references="/0/getTemplateTypeName/arg0"> - <details key="start" value="734"/> - <details key="end" value="758"/> - <details key="line" value="16"/> - </eAnnotations> - <eAnnotations source="positions.26" references="/0/getTemplateTypeName/%"> - <details key="start" value="772"/> - <details key="end" value="910"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.27" references="/0/getTemplateTypeName/%/self"> - <details key="start" value="-1"/> - <details key="end" value="-1"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.28" references="/0/getTemplateTypeName/%/%"> - <details key="start" value="779"/> - <details key="end" value="830"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.29" references="/0/getTemplateTypeName/%/%.1"> - <details key="start" value="832"/> - <details key="end" value="893"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.30" references="/0/getTemplateTypeName/%/%.2"> - <details key="start" value="895"/> - <details key="end" value="909"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.31" references="/0/getTemplateTypeName/%/%.2/%/arg0"> - <details key="start" value="904"/> - <details key="end" value="908"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.32" references="/0/getNamespace"> - <details key="start" value="915"/> - <details key="end" value="1104"/> - <details key="line" value="20"/> - </eAnnotations> - <eAnnotations source="positions.33" references="/0/getNamespace/arg0"> - <details key="start" value="942"/> - <details key="end" value="961"/> - <details key="line" value="20"/> - </eAnnotations> - <eAnnotations source="positions.34" references="/0/getNamespace/%"> - <details key="start" value="975"/> - <details key="end" value="1101"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.35" references="/0/getNamespace/%/self"> - <details key="start" value="-1"/> - <details key="end" value="-1"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.36" references="/0/getNamespace/%/%"> - <details key="start" value="982"/> - <details key="end" value="1033"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.37" references="/0/getNamespace/%/%.1"> - <details key="start" value="1035"/> - <details key="end" value="1084"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.38" references="/0/getNamespace/%/%.2"> - <details key="start" value="1086"/> - <details key="end" value="1100"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.39" references="/0/getNamespace/%/%.2/%/arg0"> - <details key="start" value="1095"/> - <details key="end" value="1099"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.40" references="/0/openNS"> - <details key="start" value="1106"/> - <details key="end" value="1283"/> - <details key="line" value="24"/> - </eAnnotations> - <eAnnotations source="positions.41" references="/0/openNS/arg0"> - <details key="start" value="1127"/> - <details key="end" value="1146"/> - <details key="line" value="24"/> - </eAnnotations> - <eAnnotations source="positions.42" references="/0/openNS/%"> - <details key="start" value="1160"/> - <details key="end" value="1280"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.43" references="/0/openNS/%/self"> - <details key="start" value="-1"/> - <details key="end" value="-1"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.44" references="/0/openNS/%/%"> - <details key="start" value="1167"/> - <details key="end" value="1218"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.45" references="/0/openNS/%/%.1"> - <details key="start" value="1220"/> - <details key="end" value="1263"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.46" references="/0/openNS/%/%.2"> - <details key="start" value="1265"/> - <details key="end" value="1279"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.47" references="/0/openNS/%/%.2/%/arg0"> - <details key="start" value="1274"/> - <details key="end" value="1278"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.48" references="/0/closeNS"> - <details key="start" value="1285"/> - <details key="end" value="1464"/> - <details key="line" value="28"/> - </eAnnotations> - <eAnnotations source="positions.49" references="/0/closeNS/arg0"> - <details key="start" value="1307"/> - <details key="end" value="1326"/> - <details key="line" value="28"/> - </eAnnotations> - <eAnnotations source="positions.50" references="/0/closeNS/%"> - <details key="start" value="1340"/> - <details key="end" value="1461"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.51" references="/0/closeNS/%/self"> - <details key="start" value="-1"/> - <details key="end" value="-1"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.52" references="/0/closeNS/%/%"> - <details key="start" value="1347"/> - <details key="end" value="1398"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.53" references="/0/closeNS/%/%.1"> - <details key="start" value="1400"/> - <details key="end" value="1444"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.54" references="/0/closeNS/%/%.2"> - <details key="start" value="1446"/> - <details key="end" value="1460"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.55" references="/0/closeNS/%/%.2/%/arg0"> - <details key="start" value="1455"/> - <details key="end" value="1459"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.56" references="/0/getGeneralizationVisibility"> - <details key="start" value="1466"/> - <details key="end" value="1675"/> - <details key="line" value="32"/> - </eAnnotations> - <eAnnotations source="positions.57" references="/0/getGeneralizationVisibility/arg0"> - <details key="start" value="1508"/> - <details key="end" value="1522"/> - <details key="line" value="32"/> - </eAnnotations> - <eAnnotations source="positions.58" references="/0/getGeneralizationVisibility/%"> - <details key="start" value="1536"/> - <details key="end" value="1672"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.59" references="/0/getGeneralizationVisibility/%/self"> - <details key="start" value="-1"/> - <details key="end" value="-1"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.60" references="/0/getGeneralizationVisibility/%/%"> - <details key="start" value="1543"/> - <details key="end" value="1594"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.61" references="/0/getGeneralizationVisibility/%/%.1"> - <details key="start" value="1596"/> - <details key="end" value="1655"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.62" references="/0/getGeneralizationVisibility/%/%.2"> - <details key="start" value="1657"/> - <details key="end" value="1671"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.63" references="/0/getGeneralizationVisibility/%/%.2/%/arg0"> - <details key="start" value="1666"/> - <details key="end" value="1670"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.64" references="/0/resetVisibility"> - <details key="start" value="1677"/> - <details key="end" value="1879"/> - <details key="line" value="36"/> - </eAnnotations> - <eAnnotations source="positions.65" references="/0/resetVisibility/arg0"> - <details key="start" value="1707"/> - <details key="end" value="1728"/> - <details key="line" value="36"/> - </eAnnotations> - <eAnnotations source="positions.66" references="/0/resetVisibility/%"> - <details key="start" value="1745"/> - <details key="end" value="1876"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.67" references="/0/resetVisibility/%/self"> - <details key="start" value="-1"/> - <details key="end" value="-1"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.68" references="/0/resetVisibility/%/%"> - <details key="start" value="1752"/> - <details key="end" value="1803"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.69" references="/0/resetVisibility/%/%.1"> - <details key="start" value="1805"/> - <details key="end" value="1859"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.70" references="/0/resetVisibility/%/%.2"> - <details key="start" value="1861"/> - <details key="end" value="1875"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.71" references="/0/resetVisibility/%/%.2/%/arg0"> - <details key="start" value="1870"/> - <details key="end" value="1874"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.72" references="/0/getSection"> - <details key="start" value="1881"/> - <details key="end" value="2112"/> - <details key="line" value="40"/> - </eAnnotations> - <eAnnotations source="positions.73" references="/0/getSection/arg0"> - <details key="start" value="1906"/> - <details key="end" value="1927"/> - <details key="line" value="40"/> - </eAnnotations> - <eAnnotations source="positions.74" references="/0/getSection/arg1"> - <details key="start" value="1929"/> - <details key="end" value="1942"/> - <details key="line" value="40"/> - </eAnnotations> - <eAnnotations source="positions.75" references="/0/getSection/%"> - <details key="start" value="1959"/> - <details key="end" value="2109"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.76" references="/0/getSection/%/self"> - <details key="start" value="-1"/> - <details key="end" value="-1"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.77" references="/0/getSection/%/%"> - <details key="start" value="1966"/> - <details key="end" value="2017"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.78" references="/0/getSection/%/%.1"> - <details key="start" value="2019"/> - <details key="end" value="2086"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.79" references="/0/getSection/%/%.2"> - <details key="start" value="2088"/> - <details key="end" value="2108"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.80" references="/0/getSection/%/%.2/%/arg0"> - <details key="start" value="2097"/> - <details key="end" value="2101"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.81" references="/0/getSection/%/%.2/%.1/arg1"> - <details key="start" value="2103"/> - <details key="end" value="2107"/> - <details key="line" value="0"/> - </eAnnotations> - </ecore:EAnnotation> -</xmi:XMI> diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/utils/CppGenUtils.java b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/utils/CppGenUtils.java deleted file mode 100644 index 36043a363ad..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/utils/CppGenUtils.java +++ /dev/null @@ -1,351 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 - 2013 CEA LIST. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * CEA LIST - initial API and implementation - *******************************************************************************/ - -package org.eclipse.papyrus.cpp.codegen.utils; - -import java.util.Iterator; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import org.eclipse.papyrus.C_Cpp.ExternLibrary; -import org.eclipse.papyrus.C_Cpp.External; -import org.eclipse.papyrus.C_Cpp.NoCodeGen; -import org.eclipse.papyrus.C_Cpp.Typedef; -import org.eclipse.papyrus.C_Cpp.Visibility; -import org.eclipse.papyrus.codegen.base.GenUtils; -import org.eclipse.uml2.uml.Classifier; -import org.eclipse.uml2.uml.ClassifierTemplateParameter; -import org.eclipse.uml2.uml.ConnectableElementTemplateParameter; -import org.eclipse.uml2.uml.Element; -import org.eclipse.uml2.uml.LiteralBoolean; -import org.eclipse.uml2.uml.LiteralInteger; -import org.eclipse.uml2.uml.LiteralString; -import org.eclipse.uml2.uml.LiteralUnlimitedNatural; -import org.eclipse.uml2.uml.NamedElement; -import org.eclipse.uml2.uml.Namespace; -import org.eclipse.uml2.uml.OperationTemplateParameter; -import org.eclipse.uml2.uml.Package; -import org.eclipse.uml2.uml.ParameterableElement; -import org.eclipse.uml2.uml.PrimitiveType; -import org.eclipse.uml2.uml.TemplateParameter; -import org.eclipse.uml2.uml.VisibilityKind; -import org.eclipse.uml2.uml.util.UMLUtil; - - - -/** - * Some utilities specific to C++ code generation: a set of static methods that is intended - * for use from Acceleo templates. - * - * @author wassim, ansgar - * - */ -public class CppGenUtils { - - public static final String ANSI_C_LIB = "AnsiCLibrary"; //$NON-NLS-1$ - - /** - * Return a list of template parameters without type - * - * @param classifier - * @return - */ - public static String getTemplateParametersWoType(Classifier classifier) { - String tparamWoType = ""; //$NON-NLS-1$ - - Iterator<TemplateParameter> it = GenUtils.getTemplateParameters(classifier).iterator(); - - while (it.hasNext()) { - TemplateParameter currentTParam = it.next(); - tparamWoType = tparamWoType + GenUtils.getTemplateName(currentTParam); - - if (it.hasNext()) { - tparamWoType = tparamWoType + ", "; //$NON-NLS-1$ - } - } - return tparamWoType; - } - - /** - * The standard UML and MARTE libraries do not apply the stereotype "Typedef". Yet, we want to treat these - * types in an identical way, i.e. we use a typedef to the associated primitive C++ type - * - * @param type - * @return - */ - public static String getStdtypes(PrimitiveType type) { - Object owner = type.getOwner(); - String owningPkgName = ""; //$NON-NLS-1$ - if (owner instanceof Package) { - owningPkgName = ((Package) owner).getName(); - } - if (owningPkgName.equals("PrimitiveTypes") || // used in UML >= 2.4 //$NON-NLS-1$ - owningPkgName.equals("UMLPrimitiveTypes") || // used in UML < 2.4 //$NON-NLS-1$ - owningPkgName.equals("MARTE_PrimitivesTypes")) { //$NON-NLS-1$ - String td = null; - String name = type.getName(); - - if (name.equals("Boolean")) { //$NON-NLS-1$ - td = "bool"; //$NON-NLS-1$ - } - else if (name.equals("Integer")) { //$NON-NLS-1$ - td = "int"; //$NON-NLS-1$ - } - else if (name.equals("Unlimited Natural")) { //$NON-NLS-1$ - td = "unsigned long"; //$NON-NLS-1$ - } - else if (name.equals("Real")) { //$NON-NLS-1$ - td = "float"; //$NON-NLS-1$ - } - else if (name.equals("String")) { //$NON-NLS-1$ - td = "const char *"; //$NON-NLS-1$ - } - else if (name.equals("Unlimited Natural")) { //$NON-NLS-1$ - td = "unsigned long"; //$NON-NLS-1$ - } - if (td != null) { - return "typedef " + td + " " + name + ";"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - } - // else unknown within UMLPrimitiveTypes, treat in standard way - } - - return ""; //$NON-NLS-1$ - } - - /** - * Return a kind of qualifiedName, except if - * - The named element has the stereotype External or NoCodeGen - * - The named element is part of the ANSI C library - * - The named element is a primitive type that has no further definition via a stereotype (TODO: why is this required/useful?) - * - * @param ne - * @return - */ - public static String cppQualifiedName(NamedElement ne) { - if (ne == null) { - return "undefined"; //$NON-NLS-1$ - } - Object owner = ne.getOwner(); - String owningPkgName = ""; //$NON-NLS-1$ - if (owner instanceof Package) { - owningPkgName = ((Package) owner).getName(); - } - if (GenUtils.hasStereotype(ne, External.class) || - GenUtils.hasStereotypeTree(ne, NoCodeGen.class) || - GenUtils.hasStereotypeTree(ne, ExternLibrary.class)) { - return ne.getName(); - } - else if (owningPkgName.equals(ANSI_C_LIB)) { - // always use the short name for types within the ANSI C library - return ne.getName(); - } - else if (owner instanceof ClassifierTemplateParameter) { - // return short name for template in Type - return ne.getName(); - } - - String qName = ne.getName(); - if (currentNS == ne.getNamespace()) { - // return simple name, if in current namespace - return qName; - } - if (ne instanceof PrimitiveType) { - if (!GenUtils.hasStereotype(ne, Typedef.class) && (getStdtypes((PrimitiveType) ne).length() == 0)) { - // is a primitive type without further definition and not a standard primitive type - // => assume that it is a external type without namespace - return qName; - } - } - - for (Namespace ns : ne.allNamespaces()) { - // don't add qualified name for specific top-level namespace "root". - // TODO: specific workaround for the way Qompass creates its target model. Needs to be removed. - if (!((ns.getOwner() == null) && ns.getName().equals("root"))) { //$NON-NLS-1$ - qName = ns.getName() + "::" + qName; //$NON-NLS-1$ - } - } - if (qName.contains("::")) { //$NON-NLS-1$ - // is a qualified name => make path absolute - return "::" + qName; //$NON-NLS-1$ - } else { - return qName; - } - } - - - /** - * Returns the string that is used within a C++ template declaration, e.g. the "Class XY" in template<class XY>. - * - * @return the template type formated as string - */ - public static String getTemplateTypeName(TemplateParameter templateParam) { - String prefix = ""; //$NON-NLS-1$ - String name = ""; //$NON-NLS-1$ - - // Retrieve name of the ParameteredElement (when possible = it is a NamedElement - ParameterableElement pElt = templateParam.getParameteredElement(); - if ((pElt != null) && (pElt instanceof NamedElement)) { - name = ((NamedElement) pElt).getName(); - if (templateParam instanceof ClassifierTemplateParameter) { - // prefix name with "class" to indicate that the following type is a classifier - prefix = "class "; //$NON-NLS-1$ - } else if (templateParam instanceof OperationTemplateParameter) { - // no prefix - } else if (templateParam instanceof ConnectableElementTemplateParameter) { - // no prefix - } else {// uml2TemplateParameter instanceof TemplateParameter - // TODO: literal integer is a value specification, but we use the fact that is also a named element - // e.g. would produce an <int N> parameter and ignore the value behind (which is ok for the - // declaration of the template, but not for its use. - if (pElt instanceof LiteralInteger) { - prefix = "int "; //$NON-NLS-1$ - } else if (pElt instanceof LiteralString) { - prefix = "String "; //$NON-NLS-1$ - } else if (pElt instanceof LiteralBoolean) { - prefix = "Boolean "; //$NON-NLS-1$ - } else if (pElt instanceof LiteralUnlimitedNatural) { - prefix = "UnlimitedNatural "; //$NON-NLS-1$ - } else { - prefix = pElt.eClass().getName() + " "; //$NON-NLS-1$ - } - } - } else { - name = "undefined"; //$NON-NLS-1$ - } - - return (prefix + name); - } - - - /** - * Return a C++ namespace definition for a named element - * - * @param ne - * a named element - * @return a C++ namespace definition for a named element - */ - public static String getNamespace(NamedElement ne) { - String namespace = ""; //$NON-NLS-1$ - for (Namespace ns : ne.allNamespaces()) { - if (ns.getOwner() != null) { - String nsName = ns.getName(); - if (!namespace.equals("")) { //$NON-NLS-1$ - nsName += "::"; //$NON-NLS-1$ - } - namespace = nsName + namespace; - } - } - if (!namespace.equals("")) { //$NON-NLS-1$ - namespace = "\n" + "using namespace " + namespace + ";\n"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - } - return namespace; - } - - /** - * Return a C++ open-namespace definition for a named element - * - * @param ne - * a named element - * @return a C++ open-namespace definition for a named element - */ - public static String openNS(NamedElement ne) { - String openNS = ""; //$NON-NLS-1$ - currentNS = ne.getNamespace(); - if (ne instanceof Package) { - openNS = "namespace " + ne.getName() + " {\n"; //$NON-NLS-1$ //$NON-NLS-2$ - } - for (Namespace ns : ne.allNamespaces()) { - if (ns.getOwner() != null) { // skip top-level package (useful?) - openNS = "namespace " + ns.getName() + " {\n" + openNS; //$NON-NLS-1$ //$NON-NLS-2$ - } - } - return openNS; - } - - - /** - * Return a C++ close-namespace definition for a named element - * - * @param ne - * a named element - * @return a C++ close-namespace definition for a named element - */ - public static String closeNS(NamedElement ne) { - String closeNS = ""; //$NON-NLS-1$ - if (ne instanceof Package) { - closeNS = "} // of namespace " + ne.getName() + "\n"; //$NON-NLS-1$ //$NON-NLS-2$ - } - for (Namespace ns : ne.allNamespaces()) { - if (ns.getOwner() != null) { - closeNS += "} // of namespace " + ns.getName() + "\n"; //$NON-NLS-1$ //$NON-NLS-2$ - } - } - return closeNS; - } - - - /** - * Return the C++ visibility (on generalizations) in text form. Return public, if no stereotype - * visibility exists - * - * @param element - * @return - */ - public static String getGeneralizationVisibility(Element element) { - // get visibility and target name - Visibility cppVisibility = UMLUtil.getStereotypeApplication(element, Visibility.class); - if (cppVisibility != null) { - return cppVisibility.getValue(); - } else { - return "public"; //$NON-NLS-1$ - } - } - - private static Namespace currentNS; - - private static VisibilityKind currVisibility = null; - private static final Pattern EmptySectionRegex = Pattern.compile("^\\s*$"); //$NON-NLS-1$ - - /** - * Update the current visibility to the specified value without writing this value to - * the output. This is to be used when setting the default visibility of a class/struct. - */ - public static void resetVisibility(VisibilityKind v) { - currVisibility = v; - } - - /** - * Create a section of code with the appropriate visibility. Merges the content with - * the previously declared visibility (if appropriate). Ignore empty content. - */ - public static String getSection(VisibilityKind visibility, String content) { - // Bug 425208: Don't update the visibility until we know for sure that it - // will be written to the output. - VisibilityKind newVisibility = null; - if (!visibility.equals(currVisibility)) { - newVisibility = visibility; - } - - // Filter out empty sections. - Matcher m = EmptySectionRegex.matcher(content); - if (content.isEmpty() || m.matches()) { - return ""; //$NON-NLS-1$ - } - - // Don't write duplicate visibility modifiers. - if (newVisibility == null) { - return content; - } - - currVisibility = newVisibility; - return currVisibility.toString() + ":\n" + content; //$NON-NLS-1$ - } -} diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/utils/CppGenUtils.mtl b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/utils/CppGenUtils.mtl deleted file mode 100644 index 973b888613e..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/utils/CppGenUtils.mtl +++ /dev/null @@ -1,42 +0,0 @@ -[comment encoding = UTF-8 /] -[module CppGenUtils('http://www.eclipse.org/uml2/5.0.0/UML')/] - -[query public getTemplateParametersWoType(arg0 : Classifier) : String - = invoke('org.eclipse.papyrus.cpp.codegen.utils.CppGenUtils', 'getTemplateParametersWoType(org.eclipse.uml2.uml.Classifier)', Sequence{arg0}) -/] - -[query public getStdtypes(arg0 : PrimitiveType) : String - = invoke('org.eclipse.papyrus.cpp.codegen.utils.CppGenUtils', 'getStdtypes(org.eclipse.uml2.uml.PrimitiveType)', Sequence{arg0}) -/] - -[query public cppQualifiedName(arg0 : NamedElement) : String - = invoke('org.eclipse.papyrus.cpp.codegen.utils.CppGenUtils', 'cppQualifiedName(org.eclipse.uml2.uml.NamedElement)', Sequence{arg0}) -/] - -[query public getTemplateTypeName(arg0 : TemplateParameter) : String - = invoke('org.eclipse.papyrus.cpp.codegen.utils.CppGenUtils', 'getTemplateTypeName(org.eclipse.uml2.uml.TemplateParameter)', Sequence{arg0}) -/] - -[query public getNamespace(arg0 : NamedElement) : String - = invoke('org.eclipse.papyrus.cpp.codegen.utils.CppGenUtils', 'getNamespace(org.eclipse.uml2.uml.NamedElement)', Sequence{arg0}) -/] - -[query public openNS(arg0 : NamedElement) : String - = invoke('org.eclipse.papyrus.cpp.codegen.utils.CppGenUtils', 'openNS(org.eclipse.uml2.uml.NamedElement)', Sequence{arg0}) -/] - -[query public closeNS(arg0 : NamedElement) : String - = invoke('org.eclipse.papyrus.cpp.codegen.utils.CppGenUtils', 'closeNS(org.eclipse.uml2.uml.NamedElement)', Sequence{arg0}) -/] - -[query public getGeneralizationVisibility(arg0 : Element) : String - = invoke('org.eclipse.papyrus.cpp.codegen.utils.CppGenUtils', 'getGeneralizationVisibility(org.eclipse.uml2.uml.Element)', Sequence{arg0}) -/] - -[query public resetVisibility(arg0 : VisibilityKind) : String - = invoke('org.eclipse.papyrus.cpp.codegen.utils.CppGenUtils', 'resetVisibility(org.eclipse.uml2.uml.VisibilityKind)', Sequence{arg0}) -/] - -[query public getSection(arg0 : VisibilityKind, arg1 : String) : String - = invoke('org.eclipse.papyrus.cpp.codegen.utils.CppGenUtils', 'getSection(org.eclipse.uml2.uml.VisibilityKind, java.lang.String)', Sequence{arg0, arg1}) -/] diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/utils/ILocateCppProject.java b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/utils/ILocateCppProject.java deleted file mode 100644 index 2cdb5d6d945..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/utils/ILocateCppProject.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 - 2013 CEA LIST. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * CEA LIST - initial API and implementation - *******************************************************************************/ - -package org.eclipse.papyrus.cpp.codegen.utils; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.uml2.uml.PackageableElement; - -public interface ILocateCppProject { - - /** - * Locate and return the target project for the given packageable element. Return null if - * no target project can be found. - * - * Ensures that the target project is correctly setup to contain generated C/C++ code. Does - * not create a new project, but may modify existing ones. - * - * @param pe - * a packageable element within a model - * @param createIfMissing - * if true, ask the user to apply the C++ nature if required. - * @return the associated project, if the C++ nature is applied. - */ - public IProject getTargetProject(PackageableElement pe, boolean createIfMissing); - - public IFile getTargetFile(); -} diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/utils/LocateCppProject.java b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/utils/LocateCppProject.java deleted file mode 100644 index 85f041de711..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/utils/LocateCppProject.java +++ /dev/null @@ -1,140 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 - 2013 CEA LIST. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * CEA LIST - initial API and implementation - *******************************************************************************/ - -package org.eclipse.papyrus.cpp.codegen.utils; - -import org.eclipse.cdt.core.CCProjectNature; -import org.eclipse.cdt.core.CProjectNature; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IWorkspaceRoot; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.papyrus.codegen.extensionpoints.ILangProjectSupport; -import org.eclipse.papyrus.codegen.extensionpoints.LanguageProjectSupport; -import org.eclipse.papyrus.cpp.codegen.Activator; -import org.eclipse.papyrus.cpp.codegen.preferences.CppCodeGenConstants; -import org.eclipse.papyrus.uml.tools.utils.PackageUtil; -import org.eclipse.swt.widgets.Display; -import org.eclipse.uml2.uml.Package; -import org.eclipse.uml2.uml.PackageableElement; - -public class LocateCppProject { - public static final String LANGUAGE_NAME = "C++"; //$NON-NLS-1$ - - private static final boolean Headless = Boolean.getBoolean("papyrus.run-headless"); //$NON-NLS-1$ - - /** - * Locate and return the target project for the given packageable element. Return null if - * no target project can be found. - * - * Ensures that the target project is correctly setup to contain generated C/C++ code. Does - * not create a new project, but may modify existing ones. - * - * @param pe - * a packageable element within a model - * @param createIfMissing - * if true, ask the user to apply the C++ nature if required. - * @return the associated project, if the C++ nature is applied. - */ - public static IProject getTargetProject(PackageableElement pe, boolean createIfMissing) { - // URI uri = pe.eResource().getURI(); - Package rootPkg = PackageUtil.getRootPackage(pe); - - IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); - /* - * if(uri.segmentCount() < 2) { - * return null; - * } - */ - - IPreferenceStore store = Activator.getDefault().getPreferenceStore(); - String prefix = store != null ? store.getString(CppCodeGenConstants.P_PROJECT_PREFIX) : "bad preferences."; //$NON-NLS-1$ - String projectName = prefix + rootPkg.getName(); - IProject modelProject = root.getProject(projectName); - if (!modelProject.exists()) { - if (Headless) - { - try - { - modelProject.create(null); - } catch (CoreException e) - { - return null; - } - } - else - { - boolean create = createIfMissing && openQuestion( - Messages.LocateCppProject_CreateTargetProjectTitle, - String.format(Messages.LocateCppProject_CreateTargetProjectDesc, projectName)); - if (create) { - ILangProjectSupport langSupport = LanguageProjectSupport.getProjectSupport(LANGUAGE_NAME); - if (langSupport != null) { - modelProject = langSupport.createProject(projectName); - langSupport.setSettings(modelProject, langSupport.initialConfigurationData()); - if (modelProject == null) { - return null; - } - } - else { - return null; - } - } - else { - return null; - } - } - } - - // Make sure the target project is open. If it was just created then it is likely open, - // however if it is an old project then it could have been closed. - if (!modelProject.isOpen()) { - try - { - modelProject.open(null); - } catch (CoreException e) - { - return null; - } - } - - // Make sure the target project has the C and C++ build natures. - try { - if (!modelProject.hasNature(CCProjectNature.CC_NATURE_ID)) { - boolean apply = createIfMissing && (Headless || openQuestion( - Messages.LocateCppProject_ApplyCNatureTitle, - Messages.LocateCppProject_ApplyCNatureDesc)); - if (!apply) { - return null; - } - CProjectNature.addCNature(modelProject, null); - CCProjectNature.addCCNature(modelProject, null); - } - } catch (CoreException e) { - Activator.log.error(e); - } - return modelProject; - } - - private static boolean openQuestion(final String title, final String message) - { - final boolean[] ret = new boolean[] { false }; - Display.getDefault().syncExec(new Runnable() { - @Override - public void run() { - ret[0] = MessageDialog.openQuestion(Display.getCurrent().getActiveShell(), title, message); - } - }); - return ret[0]; - } -} diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/utils/Messages.java b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/utils/Messages.java deleted file mode 100644 index aa1c639f0c9..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/utils/Messages.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.eclipse.papyrus.cpp.codegen.utils; - -import org.eclipse.osgi.util.NLS; - -public class Messages extends NLS { - private static final String BUNDLE_NAME = "org.eclipse.papyrus.cpp.codegen.utils.messages"; //$NON-NLS-1$ - public static String LocateCppProject_ApplyCNatureTitle; - public static String LocateCppProject_ApplyCNatureDesc; - public static String LocateCppProject_CreateTargetProjectTitle; - public static String LocateCppProject_CreateTargetProjectDesc; - static { - // initialize resource bundle - NLS.initializeMessages(BUNDLE_NAME, Messages.class); - } - - private Messages() { - } -} diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/utils/Modifier.emtl b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/utils/Modifier.emtl deleted file mode 100644 index 144d24288d2..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/utils/Modifier.emtl +++ /dev/null @@ -1,421 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:mtl="http://www.eclipse.org/acceleo/mtl/3.0" xmlns:ocl.ecore="http://www.eclipse.org/ocl/1.1.0/Ecore"> - <mtl:Module name="Modifier" nsURI="org::eclipse::papyrus::cpp::codegen::utils::Modifier" startHeaderPosition="29" endHeaderPosition="86"> - <input> - <takesTypesFrom href="http://www.eclipse.org/uml2/5.0.0/UML#/"/> - </input> - <ownedModuleElement xsi:type="mtl:Query" name="modPtr" visibility="Public"> - <parameter name="propertyOrParameter"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Element"/> - </parameter> - <expression xsi:type="ocl.ecore:OperationCallExp" referredOperation="/1/OclAny_Class/invoke"> - <eType xsi:type="ocl.ecore:AnyType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/OclAny"/> - <source xsi:type="ocl.ecore:VariableExp" name="self" referredVariable="/5"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Element"/> - </source> - <argument xsi:type="ocl.ecore:StringLiteralExp" stringSymbol="org.eclipse.papyrus.cpp.codegen.utils.Modifier"> - <eType xsi:type="ocl.ecore:PrimitiveType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/String"/> - </argument> - <argument xsi:type="ocl.ecore:StringLiteralExp" stringSymbol="modPtr(org.eclipse.uml2.uml.Element)"> - <eType xsi:type="ocl.ecore:PrimitiveType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/String"/> - </argument> - <argument xsi:type="ocl.ecore:CollectionLiteralExp" eType="/4/Sequence(Element)" kind="Sequence"> - <part xsi:type="ocl.ecore:CollectionItem"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Element"/> - <item xsi:type="ocl.ecore:VariableExp" name="propertyOrParameter" referredVariable="/0/modPtr/propertyOrParameter"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Element"/> - </item> - </part> - </argument> - </expression> - <type xsi:type="ocl.ecore:PrimitiveType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/String"/> - </ownedModuleElement> - <ownedModuleElement xsi:type="mtl:Query" name="modRef" visibility="Public"> - <parameter name="propertyOrParameter"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Element"/> - </parameter> - <expression xsi:type="ocl.ecore:OperationCallExp" referredOperation="/1/OclAny_Class/invoke"> - <eType xsi:type="ocl.ecore:AnyType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/OclAny"/> - <source xsi:type="ocl.ecore:VariableExp" name="self" referredVariable="/8"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Element"/> - </source> - <argument xsi:type="ocl.ecore:StringLiteralExp" stringSymbol="org.eclipse.papyrus.cpp.codegen.utils.Modifier"> - <eType xsi:type="ocl.ecore:PrimitiveType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/String"/> - </argument> - <argument xsi:type="ocl.ecore:StringLiteralExp" stringSymbol="modRef(org.eclipse.uml2.uml.Element)"> - <eType xsi:type="ocl.ecore:PrimitiveType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/String"/> - </argument> - <argument xsi:type="ocl.ecore:CollectionLiteralExp" eType="/4/Sequence(Element)" kind="Sequence"> - <part xsi:type="ocl.ecore:CollectionItem"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Element"/> - <item xsi:type="ocl.ecore:VariableExp" name="propertyOrParameter" referredVariable="/0/modRef/propertyOrParameter"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Element"/> - </item> - </part> - </argument> - </expression> - <type xsi:type="ocl.ecore:PrimitiveType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/String"/> - </ownedModuleElement> - <ownedModuleElement xsi:type="mtl:Query" name="modArray" visibility="Public"> - <parameter name="propertyOrParameter"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Element"/> - </parameter> - <expression xsi:type="ocl.ecore:OperationCallExp" referredOperation="/1/OclAny_Class/invoke"> - <eType xsi:type="ocl.ecore:AnyType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/OclAny"/> - <source xsi:type="ocl.ecore:VariableExp" name="self" referredVariable="/11"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Element"/> - </source> - <argument xsi:type="ocl.ecore:StringLiteralExp" stringSymbol="org.eclipse.papyrus.cpp.codegen.utils.Modifier"> - <eType xsi:type="ocl.ecore:PrimitiveType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/String"/> - </argument> - <argument xsi:type="ocl.ecore:StringLiteralExp" stringSymbol="modArray(org.eclipse.uml2.uml.Element)"> - <eType xsi:type="ocl.ecore:PrimitiveType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/String"/> - </argument> - <argument xsi:type="ocl.ecore:CollectionLiteralExp" eType="/4/Sequence(Element)" kind="Sequence"> - <part xsi:type="ocl.ecore:CollectionItem"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Element"/> - <item xsi:type="ocl.ecore:VariableExp" name="propertyOrParameter" referredVariable="/0/modArray/propertyOrParameter"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Element"/> - </item> - </part> - </argument> - </expression> - <type xsi:type="ocl.ecore:PrimitiveType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/String"/> - </ownedModuleElement> - <ownedModuleElement xsi:type="mtl:Query" name="modCVQualifier" visibility="Public"> - <parameter name="propertyOrParameter"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Element"/> - </parameter> - <expression xsi:type="ocl.ecore:OperationCallExp" referredOperation="/1/OclAny_Class/invoke"> - <eType xsi:type="ocl.ecore:AnyType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/OclAny"/> - <source xsi:type="ocl.ecore:VariableExp" name="self" referredVariable="/14"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Element"/> - </source> - <argument xsi:type="ocl.ecore:StringLiteralExp" stringSymbol="org.eclipse.papyrus.cpp.codegen.utils.Modifier"> - <eType xsi:type="ocl.ecore:PrimitiveType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/String"/> - </argument> - <argument xsi:type="ocl.ecore:StringLiteralExp" stringSymbol="modCVQualifier(org.eclipse.uml2.uml.Element)"> - <eType xsi:type="ocl.ecore:PrimitiveType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/String"/> - </argument> - <argument xsi:type="ocl.ecore:CollectionLiteralExp" eType="/4/Sequence(Element)" kind="Sequence"> - <part xsi:type="ocl.ecore:CollectionItem"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Element"/> - <item xsi:type="ocl.ecore:VariableExp" name="propertyOrParameter" referredVariable="/0/modCVQualifier/propertyOrParameter"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Element"/> - </item> - </part> - </argument> - </expression> - <type xsi:type="ocl.ecore:PrimitiveType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/String"/> - </ownedModuleElement> - </mtl:Module> - <ecore:EPackage name="additions"> - <eClassifiers xsi:type="ecore:EClass" name="String_Class"> - <eAnnotations source="http://www.eclipse.org/ocl/1.1.0/OCL"> - <references href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/String"/> - </eAnnotations> - </eClassifiers> - <eClassifiers xsi:type="ecore:EClass" name="Integer_Class"> - <eAnnotations source="http://www.eclipse.org/ocl/1.1.0/OCL"> - <references href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/Integer"/> - </eAnnotations> - </eClassifiers> - <eClassifiers xsi:type="ecore:EClass" name="Real_Class"> - <eAnnotations source="http://www.eclipse.org/ocl/1.1.0/OCL"> - <references href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/Real"/> - </eAnnotations> - </eClassifiers> - <eClassifiers xsi:type="ecore:EClass" name="EObject_Class"> - <eAnnotations source="http://www.eclipse.org/ocl/1.1.0/OCL"> - <references href="http://www.eclipse.org/emf/2002/Ecore#//EObject"/> - </eAnnotations> - <eOperations name="modPtr"> - <eAnnotations source="http://www.eclipse.org/ocl/1.1.0/OCL"> - <contents xsi:type="ocl.ecore:Constraint"/> - </eAnnotations> - <eAnnotations source="MTL" references="/0/modPtr"/> - <eType xsi:type="ocl.ecore:PrimitiveType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/String"/> - <eParameters name="propertyOrParameter"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Element"/> - </eParameters> - </eOperations> - <eOperations name="modRef"> - <eAnnotations source="http://www.eclipse.org/ocl/1.1.0/OCL"> - <contents xsi:type="ocl.ecore:Constraint"/> - </eAnnotations> - <eAnnotations source="MTL" references="/0/modRef"/> - <eType xsi:type="ocl.ecore:PrimitiveType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/String"/> - <eParameters name="propertyOrParameter"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Element"/> - </eParameters> - </eOperations> - <eOperations name="modArray"> - <eAnnotations source="http://www.eclipse.org/ocl/1.1.0/OCL"> - <contents xsi:type="ocl.ecore:Constraint"/> - </eAnnotations> - <eAnnotations source="MTL" references="/0/modArray"/> - <eType xsi:type="ocl.ecore:PrimitiveType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/String"/> - <eParameters name="propertyOrParameter"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Element"/> - </eParameters> - </eOperations> - <eOperations name="modCVQualifier"> - <eAnnotations source="http://www.eclipse.org/ocl/1.1.0/OCL"> - <contents xsi:type="ocl.ecore:Constraint"/> - </eAnnotations> - <eAnnotations source="MTL" references="/0/modCVQualifier"/> - <eType xsi:type="ocl.ecore:PrimitiveType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/String"/> - <eParameters name="propertyOrParameter"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Element"/> - </eParameters> - </eOperations> - </eClassifiers> - <eClassifiers xsi:type="ecore:EClass" name="OclAny_Class"> - <eAnnotations source="http://www.eclipse.org/ocl/1.1.0/OCL"> - <references href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/OclAny"/> - </eAnnotations> - <eOperations name="invoke"> - <eAnnotations source="MTL non-standard"/> - <eType xsi:type="ocl.ecore:AnyType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/OclAny"/> - <eParameters name="class"> - <eType xsi:type="ocl.ecore:PrimitiveType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/String"/> - </eParameters> - <eParameters name="method"> - <eType xsi:type="ocl.ecore:PrimitiveType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/String"/> - </eParameters> - <eParameters name="arguments"> - <eType xsi:type="ocl.ecore:SequenceType" href="http://www.eclipse.org/acceleo/mtl/3.0/mtlnonstdlib.ecore#//Sequence(OclAny)"/> - </eParameters> - </eOperations> - </eClassifiers> - <eClassifiers xsi:type="ecore:EClass" name="Collection(T)_Class"> - <eAnnotations source="http://www.eclipse.org/ocl/1.1.0/OCL"> - <references href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/Collection(T)"/> - </eAnnotations> - </eClassifiers> - <eClassifiers xsi:type="ecore:EClass" name="Sequence(T)_Class"> - <eAnnotations source="http://www.eclipse.org/ocl/1.1.0/OCL"> - <references href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/Sequence(T)"/> - </eAnnotations> - </eClassifiers> - <eClassifiers xsi:type="ecore:EClass" name="OrderedSet(T)_Class"> - <eAnnotations source="http://www.eclipse.org/ocl/1.1.0/OCL"> - <references href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/OrderedSet(T)"/> - </eAnnotations> - </eClassifiers> - <eClassifiers xsi:type="ecore:EClass" name="Element_Class"> - <eAnnotations source="http://www.eclipse.org/ocl/1.1.0/OCL"> - <references href="http://www.eclipse.org/uml2/5.0.0/UML#//Element"/> - </eAnnotations> - </eClassifiers> - </ecore:EPackage> - <ocl.ecore:Variable name="self"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/emf/2002/Ecore#//EObject"/> - </ocl.ecore:Variable> - <ocl.ecore:Variable name="self"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Element"/> - </ocl.ecore:Variable> - <ecore:EPackage name="collections"> - <eClassifiers xsi:type="ocl.ecore:SequenceType" name="Sequence(Element)" instanceClassName="java.util.List"> - <elementType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Element"/> - </eClassifiers> - <eClassifiers xsi:type="ocl.ecore:SequenceType" instanceClassName="java.util.List"> - <elementType xsi:type="ocl.ecore:AnyType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/OclAny"/> - </eClassifiers> - </ecore:EPackage> - <ocl.ecore:Variable name="self"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Element"/> - </ocl.ecore:Variable> - <ocl.ecore:Variable name="self"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/emf/2002/Ecore#//EObject"/> - </ocl.ecore:Variable> - <ocl.ecore:Variable name="self"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Element"/> - </ocl.ecore:Variable> - <ocl.ecore:Variable name="self"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Element"/> - </ocl.ecore:Variable> - <ocl.ecore:Variable name="self"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/emf/2002/Ecore#//EObject"/> - </ocl.ecore:Variable> - <ocl.ecore:Variable name="self"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Element"/> - </ocl.ecore:Variable> - <ocl.ecore:Variable name="self"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Element"/> - </ocl.ecore:Variable> - <ocl.ecore:Variable name="self"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/emf/2002/Ecore#//EObject"/> - </ocl.ecore:Variable> - <ocl.ecore:Variable name="self"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Element"/> - </ocl.ecore:Variable> - <ocl.ecore:Variable name="self"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Element"/> - </ocl.ecore:Variable> - <ocl.ecore:Variable name="self"> - <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/emf/2002/Ecore#//EObject"/> - </ocl.ecore:Variable> - <ecore:EAnnotation source="positions"> - <eAnnotations source="positions.0" references="/0/modPtr"> - <details key="start" value="90"/> - <details key="end" value="284"/> - <details key="line" value="4"/> - </eAnnotations> - <eAnnotations source="positions.1" references="/0/modPtr/propertyOrParameter"> - <details key="start" value="111"/> - <details key="end" value="140"/> - <details key="line" value="4"/> - </eAnnotations> - <eAnnotations source="positions.2" references="/0/modPtr/%"> - <details key="start" value="154"/> - <details key="end" value="281"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.3" references="/0/modPtr/%/self"> - <details key="start" value="-1"/> - <details key="end" value="-1"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.4" references="/0/modPtr/%/%"> - <details key="start" value="161"/> - <details key="end" value="209"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.5" references="/0/modPtr/%/%.1"> - <details key="start" value="211"/> - <details key="end" value="249"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.6" references="/0/modPtr/%/%.2"> - <details key="start" value="251"/> - <details key="end" value="280"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.7" references="/0/modPtr/%/%.2/%/propertyOrParameter"> - <details key="start" value="260"/> - <details key="end" value="279"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.8" references="/0/modRef"> - <details key="start" value="286"/> - <details key="end" value="480"/> - <details key="line" value="7"/> - </eAnnotations> - <eAnnotations source="positions.9" references="/0/modRef/propertyOrParameter"> - <details key="start" value="307"/> - <details key="end" value="336"/> - <details key="line" value="7"/> - </eAnnotations> - <eAnnotations source="positions.10" references="/0/modRef/%"> - <details key="start" value="350"/> - <details key="end" value="477"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.11" references="/0/modRef/%/self"> - <details key="start" value="-1"/> - <details key="end" value="-1"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.12" references="/0/modRef/%/%"> - <details key="start" value="357"/> - <details key="end" value="405"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.13" references="/0/modRef/%/%.1"> - <details key="start" value="407"/> - <details key="end" value="445"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.14" references="/0/modRef/%/%.2"> - <details key="start" value="447"/> - <details key="end" value="476"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.15" references="/0/modRef/%/%.2/%/propertyOrParameter"> - <details key="start" value="456"/> - <details key="end" value="475"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.16" references="/0/modArray"> - <details key="start" value="482"/> - <details key="end" value="680"/> - <details key="line" value="10"/> - </eAnnotations> - <eAnnotations source="positions.17" references="/0/modArray/propertyOrParameter"> - <details key="start" value="505"/> - <details key="end" value="534"/> - <details key="line" value="10"/> - </eAnnotations> - <eAnnotations source="positions.18" references="/0/modArray/%"> - <details key="start" value="548"/> - <details key="end" value="677"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.19" references="/0/modArray/%/self"> - <details key="start" value="-1"/> - <details key="end" value="-1"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.20" references="/0/modArray/%/%"> - <details key="start" value="555"/> - <details key="end" value="603"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.21" references="/0/modArray/%/%.1"> - <details key="start" value="605"/> - <details key="end" value="645"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.22" references="/0/modArray/%/%.2"> - <details key="start" value="647"/> - <details key="end" value="676"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.23" references="/0/modArray/%/%.2/%/propertyOrParameter"> - <details key="start" value="656"/> - <details key="end" value="675"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.24" references="/0/modCVQualifier"> - <details key="start" value="682"/> - <details key="end" value="892"/> - <details key="line" value="13"/> - </eAnnotations> - <eAnnotations source="positions.25" references="/0/modCVQualifier/propertyOrParameter"> - <details key="start" value="711"/> - <details key="end" value="740"/> - <details key="line" value="13"/> - </eAnnotations> - <eAnnotations source="positions.26" references="/0/modCVQualifier/%"> - <details key="start" value="754"/> - <details key="end" value="889"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.27" references="/0/modCVQualifier/%/self"> - <details key="start" value="-1"/> - <details key="end" value="-1"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.28" references="/0/modCVQualifier/%/%"> - <details key="start" value="761"/> - <details key="end" value="809"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.29" references="/0/modCVQualifier/%/%.1"> - <details key="start" value="811"/> - <details key="end" value="857"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.30" references="/0/modCVQualifier/%/%.2"> - <details key="start" value="859"/> - <details key="end" value="888"/> - <details key="line" value="0"/> - </eAnnotations> - <eAnnotations source="positions.31" references="/0/modCVQualifier/%/%.2/%/propertyOrParameter"> - <details key="start" value="868"/> - <details key="end" value="887"/> - <details key="line" value="0"/> - </eAnnotations> - </ecore:EAnnotation> -</xmi:XMI> diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/utils/Modifier.java b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/utils/Modifier.java deleted file mode 100644 index a55f4f6c0a0..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/utils/Modifier.java +++ /dev/null @@ -1,189 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 - 2012 CEA LIST. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * CEA LIST - initial API and implementation - *******************************************************************************/ - -package org.eclipse.papyrus.cpp.codegen.utils; - -import org.eclipse.papyrus.C_Cpp.Array; -import org.eclipse.papyrus.C_Cpp.Const; -import org.eclipse.papyrus.C_Cpp.Mutable; -import org.eclipse.papyrus.C_Cpp.Ptr; -import org.eclipse.papyrus.C_Cpp.Ref; -import org.eclipse.papyrus.C_Cpp.StorageClass; -import org.eclipse.papyrus.C_Cpp.Volatile; -import org.eclipse.papyrus.codegen.base.GenUtils; -import org.eclipse.papyrus.cpp.codegen.preferences.CppCodeGenUtils; -import org.eclipse.uml2.uml.AggregationKind; -import org.eclipse.uml2.uml.Element; -import org.eclipse.uml2.uml.MultiplicityElement; -import org.eclipse.uml2.uml.Operation; -import org.eclipse.uml2.uml.Parameter; -import org.eclipse.uml2.uml.ParameterDirectionKind; -import org.eclipse.uml2.uml.Property; -import org.eclipse.uml2.uml.util.UMLUtil; - -/** - * Utility functions managing the "modifier" of an element, i.e. additional - * information whether a passed parameter or an attribute is a pointer, a - * reference, an array or constant. - * - * @author ansgar - * - */ -public class Modifier { - - public static String modPtr(Element propertyOrParameter) { - // Pointer - String ptr = ""; //$NON-NLS-1$ - Ptr cppPtr = UMLUtil.getStereotypeApplication(propertyOrParameter, Ptr.class); - if (cppPtr != null) { - ptr = (cppPtr.getDeclaration() != null) ? cppPtr.getDeclaration() : "*"; //$NON-NLS-1$ - } else { - ptr = ""; //$NON-NLS-1$ - } - if (propertyOrParameter instanceof Property) { - if (((Property) propertyOrParameter).getAggregation() == AggregationKind.SHARED_LITERAL) { - ptr += "*"; //$NON-NLS-1$ - } - } - boolean ptrOrRef = GenUtils.hasStereotype(propertyOrParameter, Ref.class) - || GenUtils.hasStereotype(propertyOrParameter, Ptr.class); - - // out and inout parameter are realized by means of a pointer - if (propertyOrParameter instanceof Parameter) { - ParameterDirectionKind directionKind = ((Parameter) propertyOrParameter).getDirection(); - if (directionKind == ParameterDirectionKind.OUT_LITERAL || directionKind == ParameterDirectionKind.INOUT_LITERAL) { - // parameter is an out or inout parameter. If the user already either a pointer or reference, use this. - if (!ptrOrRef) { - // .. otherwise add the oeprator from the preferences - ptr += CppCodeGenUtils.getOutInoutOp(); - } - } - } - return ptr; - } - - public static String modRef(Element propertyOrParameter) { - // Ref - return GenUtils.hasStereotype(propertyOrParameter, Ref.class) ? "&" : ""; //$NON-NLS-1$ //$NON-NLS-2$ - } - - public static String modArray(Element propertyOrParameter) { - // Array - Array cppArray = UMLUtil.getStereotypeApplication(propertyOrParameter, Array.class); - String array = ""; //$NON-NLS-1$ - if (cppArray != null) { - // explicit array definition - array = (cppArray.getDefinition() != null) ? cppArray.getDefinition() : "[]"; //$NON-NLS-1$ - } else { - // calculate array from multiplicity definition - int multiplicity = 1; - if (propertyOrParameter instanceof MultiplicityElement) { - multiplicity = ((MultiplicityElement) propertyOrParameter).getUpper(); - } - array = ""; //$NON-NLS-1$ - if (multiplicity == -1) { - array = "[]"; //$NON-NLS-1$ - } else if (multiplicity > 1) { - array = "[" + multiplicity + "]"; //$NON-NLS-1$ //$NON-NLS-2$ - } - } - return array; - } - - /** - * return modifier for const and volatile - * @param propertyOrParameter - * @return - */ - public static String modCVQualifier(Element propertyOrParameter) { - String cvQualifier = ""; //$NON-NLS-1$ - // CVQualifiers cannot be used with static functions - if (propertyOrParameter instanceof Operation && ((Operation) propertyOrParameter).isStatic()) { - // do nothing - } - // Const - else if (GenUtils.hasStereotype(propertyOrParameter, Const.class)) { - // Volatile with const - if (GenUtils.hasStereotype(propertyOrParameter, Volatile.class)) { - cvQualifier = (propertyOrParameter instanceof Operation) ? " const volatile" //$NON-NLS-1$ - : // added at the end of operation, prefix with " " - "const volatile "; // before operation or //$NON-NLS-1$ - // parameter, postfix with " " - } - // Const without Volatile - else { - cvQualifier = (propertyOrParameter instanceof Operation) ? " const" //$NON-NLS-1$ - : // added at the end of operation, prefix with " " - "const "; // before operation or //$NON-NLS-1$ - // parameter, postfix with " " - } - } - // Volatile without const - else if (GenUtils.hasStereotype(propertyOrParameter, Volatile.class)) { - cvQualifier = (propertyOrParameter instanceof Operation) ? " volatile" //$NON-NLS-1$ - : // added at the end of operation, prefix with " " - "volatile "; // before operation or parameter, //$NON-NLS-1$ - // postfix with " " - } - - // Mutable (non-static attribute only) - if (GenUtils.hasStereotype(propertyOrParameter, Mutable.class)) { - if (propertyOrParameter instanceof Property && !((Property) propertyOrParameter).isStatic()) { - cvQualifier = "mutable " + cvQualifier; - } - } - - return cvQualifier; - } - - /** - * return modifier for storage class - * @param propertyOrParameter - * @return - */ - public static String modSCQualifier(Element propertyOrParameter) { - StorageClass sc = UMLUtil.getStereotypeApplication(propertyOrParameter, StorageClass.class); - if (sc != null) { - return sc.getStorageClass().getLiteral() + " "; //$NON-NLS-1$ - } - return ""; //$NON-NLS-1$ - } - - /** - * Return inform about the direction of a parameter in form of a comment - * - * @param propertyOperationOrParameter - * @return - */ - public static String dirInfo(Element propertyOperationOrParameter) { - if (propertyOperationOrParameter instanceof Parameter) { - ParameterDirectionKind directionKind = ((Parameter) propertyOperationOrParameter).getDirection(); - if (directionKind == ParameterDirectionKind.IN_LITERAL) { - return " /*in*/"; //$NON-NLS-1$ - } else if (directionKind == ParameterDirectionKind.OUT_LITERAL) { - return " /*out*/"; //$NON-NLS-1$ - } else if (directionKind == ParameterDirectionKind.INOUT_LITERAL) { - return " /*inout*/"; //$NON-NLS-1$ - } - } - return ""; //$NON-NLS-1$ - } - - /** - * initialize the ptr/ref/array/isConst attributes. - * - * @param propertyOperationOrParameter - */ - public static void update(Element propertyOperationOrParameter) { - - - } -} diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/utils/Modifier.mtl b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/utils/Modifier.mtl deleted file mode 100644 index 08166221277..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/utils/Modifier.mtl +++ /dev/null @@ -1,15 +0,0 @@ -[comment encoding = UTF-8 /] -[module Modifier('http://www.eclipse.org/uml2/5.0.0/UML')/] - -[query public modPtr(propertyOrParameter : Element) : String - = invoke('org.eclipse.papyrus.cpp.codegen.utils.Modifier', 'modPtr(org.eclipse.uml2.uml.Element)', Sequence{propertyOrParameter}) /] - -[query public modRef(propertyOrParameter : Element) : String - = invoke('org.eclipse.papyrus.cpp.codegen.utils.Modifier', 'modRef(org.eclipse.uml2.uml.Element)', Sequence{propertyOrParameter}) /] - -[query public modArray(propertyOrParameter : Element) : String - = invoke('org.eclipse.papyrus.cpp.codegen.utils.Modifier', 'modArray(org.eclipse.uml2.uml.Element)', Sequence{propertyOrParameter}) /] - -[query public modCVQualifier(propertyOrParameter : Element) : String - = invoke('org.eclipse.papyrus.cpp.codegen.utils.Modifier', 'modCVQualifier(org.eclipse.uml2.uml.Element)', Sequence{propertyOrParameter}) /] - diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/utils/messages.properties b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/utils/messages.properties deleted file mode 100644 index 617270b5e1e..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/utils/messages.properties +++ /dev/null @@ -1,4 +0,0 @@ -LocateCppProject_ApplyCNatureTitle=Need to apply C++ nature -LocateCppProject_ApplyCNatureDesc=Code generation requires that the underlying project has a C++ nature. Do you want to apply this nature? -LocateCppProject_CreateTargetProjectDesc=Code generation needs to create a CDT project called "%s". Do you want to do this? -LocateCppProject_CreateTargetProjectTitle=Target project does not exist diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppAttribute.xtend b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppAttribute.xtend deleted file mode 100644 index 9324fe993b2..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppAttribute.xtend +++ /dev/null @@ -1,92 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 CEA LIST. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * CEA LIST - initial API and implementation - *******************************************************************************/ - - package org.eclipse.papyrus.cpp.codegen.xtend - -import org.eclipse.uml2.uml.Classifier -import org.eclipse.uml2.uml.Class -import org.eclipse.uml2.uml.DataType -import org.eclipse.uml2.uml.Interface -import org.eclipse.uml2.uml.Signal -import org.eclipse.uml2.uml.Property -import org.eclipse.papyrus.codegen.base.GenUtils -import org.eclipse.papyrus.C_Cpp.Const -import org.eclipse.papyrus.cpp.codegen.utils.Modifier -import org.eclipse.papyrus.cpp.codegen.utils.CppGenUtils -import org.eclipse.papyrus.C_Cpp.Mutable - -/** - * @author Önder GÜRCAN (onder.gurcan@cea.fr) - */ -class CppAttribute { - - // Loop over attributes. Check that the attribute is not a static const. - // Constant static attributes are declared within the class declaration - static def CppStaticAttributes(Classifier classifier) { - var code = ''' - // static attributes (if any) - «FOR ownedAttribute : getOwnedAttributes(classifier)» - «IF (ownedAttribute.isStatic)» - «CppStaticAttributeImplementation(ownedAttribute)» - «ENDIF» - «ENDFOR» - ''' - return code - } - - // return a list of owned attributes, empty set, if null - static def getOwnedAttributes(Classifier cl) { - val attributes = getOwnedAttributesWNull(cl) - if (attributes == null) { - emptySet - } - else { - attributes - } - } - - // return a list of owned attributes, since this is not supported directly on a classifier - static def getOwnedAttributesWNull(Classifier cl) { - if (cl instanceof Class) { - (cl as Class).ownedAttributes - } else if (cl instanceof DataType) { - (cl as DataType).ownedAttributes - } else if (cl instanceof Interface) { - (cl as Interface).ownedAttributes - } else if (cl instanceof Signal) { - (cl as Signal).ownedAttributes - } else { - //Sequence{} - } - } - - static def CppStaticAttributeImplementation(Property attribute) ''' - «CppDocumentation.CppElementDoc(attribute)» - «Modifier.modCVQualifier(attribute)» «CppGenUtils.cppQualifiedName(attribute.type)»«Modifier.modPtr(attribute)»«Modifier.modRef(attribute)» «attribute.class_.name»::«attribute.name»«Modifier.modArray(attribute)»«defaultValue(attribute)»; - ''' - - static def defaultValue(Property attribute) { - if ((attribute.defaultValue != null) && attribute.isStatic) { - "=" + attribute.defaultValue.stringValue() - } - } - - static def CppAttributeDeclaration(Property attribute) ''' - «CppDocumentation.CppElementDoc(attribute)» - «staticValue(attribute)» «Modifier.modCVQualifier(attribute)»«CppGenUtils.cppQualifiedName(attribute.type)»«Modifier. - modPtr(attribute)»«Modifier.modRef(attribute)» «attribute.name»«Modifier.modArray(attribute)»; - ''' - - static def staticValue(Property attribute) { - if (attribute.isStatic) 'static' - } - -} diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppClassAttributesDeclaration.xtend b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppClassAttributesDeclaration.xtend deleted file mode 100644 index 06990f4229b..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppClassAttributesDeclaration.xtend +++ /dev/null @@ -1,26 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 CEA LIST. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * CEA LIST - initial API and implementation - *******************************************************************************/ - - package org.eclipse.papyrus.cpp.codegen.xtend - -import org.eclipse.uml2.uml.Classifier -import org.eclipse.uml2.uml.VisibilityKind - -/** - * @author Önder GÜRCAN (onder.gurcan@cea.fr) - */ -class CppClassAttributesDeclaration { - static def CppClassAttributesDeclaration(Classifier clazz, VisibilityKind visibilityFilter) ''' - «FOR oa : CppAttribute.getOwnedAttributes(clazz).filter[it.visibility == visibilityFilter]» - «CppAttribute.CppAttributeDeclaration(oa)» - «ENDFOR» - ''' -}
\ No newline at end of file diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppClassFriendDeclaration.xtend b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppClassFriendDeclaration.xtend deleted file mode 100644 index eafcc2b3cc7..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppClassFriendDeclaration.xtend +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 CEA LIST. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * CEA LIST - initial API and implementation - *******************************************************************************/ - - package org.eclipse.papyrus.cpp.codegen.xtend - -import org.eclipse.uml2.uml.Classifier -import org.eclipse.papyrus.cpp.codegen.utils.CppGenUtils -import org.eclipse.papyrus.C_Cpp.Friend -import org.eclipse.papyrus.C_Cpp.NoCodeGen -import org.eclipse.papyrus.codegen.base.GenUtils - -/** - * @author Önder GÜRCAN (onder.gurcan@cea.fr) - */ -class CppClassFriendDeclaration { - static def CppClassFriendDeclaration(Classifier friend) ''' - friend class «CppGenUtils.cppQualifiedName(friend)» - ''' - - static def CppClassIncludeFriendDeclaration(Classifier clazz) { - for (uc : GenUtils.getUsedClassifiers(clazz)) { - if (GenUtils.hasStereotype(uc, Friend) && (!GenUtils.hasStereotype(uc, NoCodeGen))) { - CppClassFriendDeclaration(uc) - } - } - } -}
\ No newline at end of file diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppClassIncludeClassDeclaration.xtend b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppClassIncludeClassDeclaration.xtend deleted file mode 100644 index ab952f290cb..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppClassIncludeClassDeclaration.xtend +++ /dev/null @@ -1,69 +0,0 @@ -package org.eclipse.papyrus.cpp.codegen.xtend - -/******************************************************************************* - * Copyright (c) 2014 CEA LIST. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * CEA LIST - initial API and implementation - *******************************************************************************/ - - import org.eclipse.papyrus.C_Cpp.CppRoot -import org.eclipse.uml2.uml.Package -import org.eclipse.uml2.uml.Classifier -import org.eclipse.emf.common.util.EList -import org.eclipse.papyrus.C_Cpp.NoCodeGen -import org.eclipse.papyrus.C_Cpp.External -import org.eclipse.uml2.uml.Enumeration -import org.eclipse.uml2.uml.PrimitiveType -import java.util.List -import java.util.ArrayList -import org.eclipse.papyrus.cpp.codegen.utils.ClassUtils -import org.eclipse.papyrus.codegen.base.GenUtils - -/** - * @author Önder GÜRCAN (onder.gurcan@cea.fr) - */ -class CppClassIncludeClassDeclaration { - - static def cppOwnerPackageIncludePath(Package pkg) { - if ((pkg != null) && (!GenUtils.hasStereotype(pkg, CppRoot))) { - return GenUtils.getFullPath(pkg) + '/Pkg_' + pkg.name + '.h' - } else { - return null - } - } - - static def CppClassAllIncludesDeclarationBody(Classifier classifier) { - cppClassAllIncludes(classifier, GenUtils.getTypesViaDependencies(classifier)) - } - - static def cppClassAllIncludes(Classifier classifier, EList<Classifier> list) { - var List<String> newList = new ArrayList<String>() - for (cl : list) { - //var String str = null - if ((cl != classifier) && (!GenUtils.hasStereotype(cl, NoCodeGen)) || (GenUtils.hasStereotype(cl, External))) { - if ((cl instanceof Enumeration) || (cl instanceof PrimitiveType)) { - if ((cl.owner != null) && (cl.owner instanceof Package)) { - var includePath = (cl.owner as Package).cppOwnerPackageIncludePath - if (!newList.contains(includePath)) newList.add(includePath) - } else { - //str = null - } - } else { - newList.addAll(CppClassIncludeDeclaration.cppClassIncludes(cl)) - } - } else { - //str = null - } - } - return newList.filter[str | str != null] - } - - static def CppClassAllIncludes(Classifier clazz) { - cppClassAllIncludes(clazz, ClassUtils.includedClassifiers(clazz)) - } -}
\ No newline at end of file diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppClassIncludeDeclaration.xtend b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppClassIncludeDeclaration.xtend deleted file mode 100644 index a07a939e125..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppClassIncludeDeclaration.xtend +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 CEA LIST. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * CEA LIST - initial API and implementation - *******************************************************************************/ - - package org.eclipse.papyrus.cpp.codegen.xtend - -import java.util.ArrayList -import java.util.List -import org.eclipse.papyrus.C_Cpp.ExternLibrary -import org.eclipse.papyrus.C_Cpp.External -import org.eclipse.papyrus.C_Cpp.Template -import org.eclipse.papyrus.cpp.codegen.preferences.CppCodeGenUtils -import org.eclipse.uml2.uml.NamedElement -import org.eclipse.uml2.uml.util.UMLUtil -import org.eclipse.papyrus.codegen.base.GenUtils - -/** - * @author Önder GÜRCAN (onder.gurcan@cea.fr) - */ -class CppClassIncludeDeclaration { - - static def cppClassIncludes(NamedElement ne) { - var List<String> result = new ArrayList<String>() - if (GenUtils.hasStereotypeTree(ne, ExternLibrary)) { - result = GenUtils.getApplicationTree(ne, ExternLibrary).includes - } else { - result.add(includeName(ne)) - } - return result - } - - static def includeName(NamedElement ne) { - if (GenUtils.hasStereotypeTree(ne, Template)) { - return UMLUtil.getStereotypeApplication(ne, Template).declaration - } else { - if (GenUtils.hasStereotypeTree(ne, External)) { - return UMLUtil.getStereotypeApplication(ne, External).name - } else { - // standard case (no stereotypes are applied) - return GenUtils.getFullPath(ne.nearestPackage) + '/' + ne.name + '.' + CppCodeGenUtils.getHeaderSuffix() - } - } - } -}
\ No newline at end of file diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppClassInheritedDeclarations.xtend b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppClassInheritedDeclarations.xtend deleted file mode 100644 index b6b81c0c5a9..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppClassInheritedDeclarations.xtend +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 CEA LIST. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * CEA LIST - initial API and implementation - *******************************************************************************/ - - package org.eclipse.papyrus.cpp.codegen.xtend - -import org.eclipse.papyrus.C_Cpp.NoCodeGen -import org.eclipse.papyrus.C_Cpp.Visibility -import org.eclipse.uml2.uml.Classifier -import org.eclipse.uml2.uml.Generalization -import org.eclipse.uml2.uml.InterfaceRealization -import org.eclipse.uml2.uml.Relationship -import org.eclipse.uml2.uml.util.UMLUtil -import org.eclipse.papyrus.cpp.codegen.utils.CppGenUtils -import org.eclipse.papyrus.codegen.base.GenUtils - -/** - * @author Önder GÜRCAN (onder.gurcan@cea.fr) - */ -class CppClassInheritedDeclarations { - - static def CppClassInheritedDeclarations(Classifier clazz) ''' - «IF (filteredRelationships(clazz).length > 0)» : «ENDIF» - «FOR fr: filteredRelationships(clazz) SEPARATOR ', \n'» - «getCppVisibility(fr)» «CppGenUtils.cppQualifiedName(fr.targets.get(0) as Classifier)»«ENDFOR» - ''' - - //Return a list of relationships that are either Generalizations or InterfaceRealiazations - //and the target does not point to a classifier that has the no-code-gen Stereotype - //TODO: not sure if it makes sense NOT to declare an inheritance, since we do not generate code. - static def filteredRelationships(Classifier clazz) { - clazz.sourceDirectedRelationships.filter[((it instanceof Generalization) || (it instanceof InterfaceRealization)) && - (it.targets.size > 0) && (!GenUtils.hasStereotype(it.targets.get(0), NoCodeGen)) - ] - } - - static def getCppVisibility(Relationship relationship) { - if (GenUtils.hasStereotype(relationship, Visibility)) { - (UMLUtil.getStereotypeApplication(relationship, Visibility) as Visibility).value - } else { - 'public' - } - } -}
\ No newline at end of file diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppClassOperationsDeclaration.xtend b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppClassOperationsDeclaration.xtend deleted file mode 100644 index e41bb495982..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppClassOperationsDeclaration.xtend +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 CEA LIST. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * CEA LIST - initial API and implementation - *******************************************************************************/ - - package org.eclipse.papyrus.cpp.codegen.xtend - -import org.eclipse.uml2.uml.Classifier -import org.eclipse.uml2.uml.OpaqueBehavior -import org.eclipse.uml2.uml.VisibilityKind - -/** - * @author Önder GÜRCAN (onder.gurcan@cea.fr) - */ -class CppClassOperationsDeclaration { - - static def CppClassOperationsDeclaration(Classifier clazz, VisibilityKind visibilityFilter) ''' - «FOR op : CppOperations.getOwnedOperations(clazz).filter[it.visibility == visibilityFilter]» - - «CppOperations.CppOperationDeclaration(op)» - «ENDFOR» - «FOR b : clazz.eAllContents.toList.filter(OpaqueBehavior).filter[it.visibility == visibilityFilter]» - «IF b.specification == null» - - // opaque behavior without specification (typically from state machine) - «CppOperations.CppBehaviorDeclaration(b)» - «ENDIF» - «ENDFOR» - ''' -}
\ No newline at end of file diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppClassOperationsImplementation.xtend b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppClassOperationsImplementation.xtend deleted file mode 100644 index 091d40b4f93..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppClassOperationsImplementation.xtend +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 CEA LIST. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * CEA LIST - initial API and implementation - *******************************************************************************/ - - package org.eclipse.papyrus.cpp.codegen.xtend - -import org.eclipse.uml2.uml.Classifier -import org.eclipse.papyrus.C_Cpp.NoCodeGen -import org.eclipse.uml2.uml.OpaqueBehavior -import org.eclipse.papyrus.C_Cpp.Inline -import org.eclipse.papyrus.codegen.base.GenUtils - -/** - * @author Önder GÜRCAN (onder.gurcan@cea.fr) - */ -class CppClassOperationsImplementation { - - // implementations of a classifier, parameter controls whether only inline (or only not inline) operations - //are produced - static def CppClassOperationsImplementation(Classifier clazz, boolean inline) ''' - «FOR ownedOperation : CppOperations.getOwnedOperations(clazz).filter[(!(GenUtils.hasStereotype(it, NoCodeGen) || it.isAbstract)) && (GenUtils.hasStereotype(it, org.eclipse.papyrus.C_Cpp.Inline) == inline)] SEPARATOR "\n"» - «CppOperations.CppOperationImplementation(ownedOperation)» - «ENDFOR» - - «FOR nestedOperation : CppOperations.getNestedOperations(clazz).filter[(!(GenUtils.hasStereotype(it, NoCodeGen) || it.isAbstract)) && (GenUtils.hasStereotype(it, org.eclipse.papyrus.C_Cpp.Inline) == inline)] SEPARATOR "\n"» - «CppOperations.CppOperationImplementation(nestedOperation)» - «ENDFOR» - - «FOR b : clazz.eAllContents.toIterable.filter[(it instanceof OpaqueBehavior) && GenUtils.hasStereotype((it as OpaqueBehavior), Inline)==inline]» - «IF (b as OpaqueBehavior).specification == null» - // opaque behavior without specification (typically from state machine) - «CppOperations.CppBehaviorImplementation(b as OpaqueBehavior)» - «ENDIF» - «ENDFOR» - ''' - -}
\ No newline at end of file diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppClassTypeAndEnum.xtend b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppClassTypeAndEnum.xtend deleted file mode 100644 index 65b23596901..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppClassTypeAndEnum.xtend +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 CEA LIST. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * CEA LIST - initial API and implementation - *******************************************************************************/ - - package org.eclipse.papyrus.cpp.codegen.xtend - -import org.eclipse.papyrus.C_Cpp.NoCodeGen -import org.eclipse.papyrus.cpp.codegen.utils.CppGenUtils -import org.eclipse.uml2.uml.Classifier -import org.eclipse.uml2.uml.Element -import org.eclipse.uml2.uml.Enumeration -import org.eclipse.uml2.uml.Namespace -import org.eclipse.uml2.uml.Package -import org.eclipse.uml2.uml.PrimitiveType -import org.eclipse.uml2.uml.VisibilityKind -import org.eclipse.papyrus.codegen.base.GenUtils -import org.eclipse.uml2.uml.DataType -import org.eclipse.uml2.uml.UMLFactory - -/** - * @author Önder GÜRCAN (onder.gurcan@cea.fr) - */ -class CppClassTypeAndEnum { - - static def CppClassTypeAndEnum(Classifier clazz) ''' - «var publicStr = TypesAndEnumsForVisibility(clazz, VisibilityKind.PUBLIC_LITERAL).toString» - «CppGenUtils.getSection(VisibilityKind.PUBLIC_LITERAL, publicStr)» - «var protectedStr = TypesAndEnumsForVisibility(clazz, VisibilityKind.PROTECTED_LITERAL).toString» - «CppGenUtils.getSection(VisibilityKind.PROTECTED_LITERAL, protectedStr)» - «var privateStr = TypesAndEnumsForVisibility(clazz, VisibilityKind.PRIVATE_LITERAL).toString» - «CppGenUtils.getSection(VisibilityKind.PRIVATE_LITERAL, privateStr)» - ''' - - static def CppClassTypeAndEnumPackage(Package pkg) { - TypesAndEnumsForVisibility(pkg, VisibilityKind.get(VisibilityKind.PACKAGE)) - TypesAndEnumsForVisibility(pkg, VisibilityKind.get(VisibilityKind.PUBLIC)) - } - - static def TypesAndEnumsForVisibility(Namespace ne, VisibilityKind visibilityFilter) ''' - «FOR ownedElement : ne.ownedElements» - «TypeAndEnumForVisibility(ownedElement, visibilityFilter)» - «ENDFOR» - ''' - - static def TypeAndEnumForVisibility(Element element, VisibilityKind visibilityFilter) { - if ((!GenUtils.hasStereotype(element, NoCodeGen)) && (element instanceof Classifier)) { - var elementVisibility = (element as Classifier).visibility - var value = elementVisibility.value - if ((value == visibilityFilter.value)) { - if (element instanceof Enumeration) { - return CppEnumerations.CppEnumerationDefinition(element as Enumeration) - } else if (element instanceof PrimitiveType) { - return CppPrimitiveTypes.CppPrimitiveTypeDefinition(element as PrimitiveType) - } else if ((element instanceof DataType || element.eClass.equals(UMLFactory.eINSTANCE.getUMLPackage().getClass_())) && !(element.owner instanceof Package)) { - if (GenUtils.isTemplateBoundElement(element as Classifier)) { - return CppInnerClassifiers.CppInnerBindDefinition(element as Classifier) - } else { - return CppInnerClassifiers.CppInnerClassDefinition(element as Classifier) - } - - } - } - } - } -} diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppClassifierGenerator.xtend b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppClassifierGenerator.xtend deleted file mode 100644 index 41af9c68a4b..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppClassifierGenerator.xtend +++ /dev/null @@ -1,253 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 CEA LIST. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * CEA LIST - initial API and implementation - *******************************************************************************/ - - package org.eclipse.papyrus.cpp.codegen.xtend - -import org.eclipse.papyrus.C_Cpp.Union -import org.eclipse.papyrus.codegen.base.GenUtils -import org.eclipse.papyrus.cpp.codegen.preferences.CppCodeGenUtils -import org.eclipse.papyrus.cpp.codegen.utils.CppGenUtils -import org.eclipse.uml2.uml.Classifier -import org.eclipse.uml2.uml.DataType -import org.eclipse.uml2.uml.NamedElement -import org.eclipse.uml2.uml.VisibilityKind -import org.eclipse.uml2.uml.profile.standard.Create - -/** - * @author Ansgar Radermacher (ansgar.radermacher@cea.fr) - */ -class CppClassifierGenerator { - - static def generateBindHeaderCode(Classifier classifier) ''' - #ifndef «GenUtils.getFullNameUC(classifier)»_H - #define «GenUtils.getFullNameUC(classifier)»_H - - /************************************************************ - «classifier.name» template binding header - ************************************************************/ - - «CppIncludeUtil.includeDirective(CppClassIncludeClassDeclaration.cppOwnerPackageIncludePath(classifier.package))» - - «FOR path : getSortedIncludePathList(classifier)» - «CppIncludeUtil.includeDirective(path)» - «ENDFOR» - - «CppIncludeUtil.CppIncludeHeader(classifier)» - - «var tb = GenUtils.getTemplateBinding(classifier)» - «var templateElement = tb.targets.get(0)» - «CppIncludeUtil.includeDirective( - GenUtils.getFullPath(classifier.package) + '/' + (templateElement.owner as NamedElement).name + '.' + - CppCodeGenUtils.getHeaderSuffix())» - - «CppGenUtils.openNS(classifier)» - /************************************************************/ - typedef «(templateElement.owner as NamedElement).name»<«FOR ps : tb.parameterSubstitutions SEPARATOR ', '»« - CppTemplates.CppTemplateBindingParameter(ps)»«ENDFOR»> «classifier.name»; - - «CppGenUtils.closeNS(classifier)» - - /************************************************************ - End of «classifier.name» template binding header - ************************************************************/ - - #endif - ''' - - static def getSortedIncludePathList(Classifier classifier) { - var includePathList = CppClassIncludeClassDeclaration.CppClassAllIncludes(classifier).sort; - return includePathList - } - - static def generateBindBodyCode(Classifier classifier) ''' - #define «GenUtils.getFullNameUC(classifier)»_BODY - - /************************************************************ - «classifier.name» template binding body - ************************************************************/ - - «CppIncludeUtil.CppIncludePreBody(classifier)» - - // include associated header file - «CppIncludeUtil.includeDirective( - GenUtils.getFullPath(classifier.package) + '/' + classifier.name + '.' + CppCodeGenUtils.getHeaderSuffix())» - - «CppIncludeUtil.CppIncludeBody(classifier)» - - «CppGenUtils.openNS(classifier)» - - // Derived includes directives - «FOR path : CppClassIncludeClassDeclaration.CppClassAllIncludes(classifier).sort» - «CppIncludeUtil.includeDirective(path)» - «ENDFOR» - - /************************************************************/ - «var tb = GenUtils.getTemplateBinding(classifier)» - «var templateElement = tb.targets.get(0)» - template class «(templateElement.owner as NamedElement).name»<«FOR ps : tb.parameterSubstitutions SEPARATOR ', '»« - CppTemplates.CppTemplateBindingParameter(ps)»«ENDFOR»>; - - «CppGenUtils.closeNS(classifier)» - - /************************************************************ - End of «classifier.name» template binding body - ************************************************************/ - ''' - - static def generateClassHeaderCode(Classifier classifier) ''' - #ifndef «GenUtils.getFullNameUC(classifier)»_H - #define «GenUtils.getFullNameUC(classifier)»_H - - /************************************************************ - «classifier.name» class header - ************************************************************/ - - «CppIncludeUtil.includeDirective(CppClassIncludeClassDeclaration.cppOwnerPackageIncludePath(classifier.package))» - - «FOR path : getSortedIncludePathList(classifier)» - «CppIncludeUtil.includeDirective(path)» - «ENDFOR» - - «CppIncludeUtil.CppIncludeHeader(classifier)» - - «CppGenUtils.openNS(classifier)» - - /************************************************************/ - «CppDocumentation.CppElementDoc(classifier)» - «CppTemplates.templateSignature(classifier)»«classUnionOrStruct(classifier)» «classifier.name»«CppClassInheritedDeclarations. - CppClassInheritedDeclarations(classifier)» { - «CppClassFriendDeclaration.CppClassIncludeFriendDeclaration(classifier)»«CppClassTypeAndEnum.CppClassTypeAndEnum(classifier)» - «var publicVisibility = VisibilityKind.PUBLIC_LITERAL» - «CppGenUtils.getSection(publicVisibility, defaultInitializer(classifier))» - «CppGenUtils.getSection(publicVisibility, - CppClassAttributesDeclaration.CppClassAttributesDeclaration(classifier, publicVisibility).toString)» - «CppGenUtils.getSection(publicVisibility, - CppClassOperationsDeclaration.CppClassOperationsDeclaration(classifier, publicVisibility).toString)» - - «var protectedVisibility = VisibilityKind.PROTECTED_LITERAL» - «CppGenUtils.getSection(protectedVisibility, - CppClassAttributesDeclaration.CppClassAttributesDeclaration(classifier, protectedVisibility).toString)» - «CppGenUtils.getSection(protectedVisibility, - CppClassOperationsDeclaration.CppClassOperationsDeclaration(classifier, protectedVisibility).toString)» - - «var privateVisibility = VisibilityKind.PRIVATE_LITERAL» - «CppGenUtils.getSection(privateVisibility, - CppClassAttributesDeclaration.CppClassAttributesDeclaration(classifier, privateVisibility).toString)» - «CppGenUtils.getSection(privateVisibility, - CppClassOperationsDeclaration.CppClassOperationsDeclaration(classifier, privateVisibility).toString)» - }; - /************************************************************/ - /* External declarations (package visibility) */ - «var packageVisibility = VisibilityKind.PACKAGE_LITERAL» - «CppClassAttributesDeclaration.CppClassAttributesDeclaration(classifier, packageVisibility)» - «CppClassOperationsDeclaration.CppClassOperationsDeclaration(classifier, packageVisibility)» - /************************************************************/ - - «IF CppTemplates.isTemplate(classifier)» - /************************************************************/ - /* Template functions */ - «CppClassOperationsImplementation.CppClassOperationsImplementation(classifier, false)» - «ENDIF» - - /* Inline functions */ - «CppClassOperationsImplementation.CppClassOperationsImplementation(classifier, true)» - «CppGenUtils.closeNS(classifier)» - - /************************************************************ - End of «classifier.name» class header - ************************************************************/ - - #endif - ''' - - static def classUnionOrStruct(Classifier classifier) { - if (GenUtils.hasStereotype(classifier, Union)) { - return 'union' - } else { - if (classifier instanceof DataType) { - CppGenUtils.resetVisibility(VisibilityKind.PUBLIC_LITERAL) - return 'struct' - } else { - CppGenUtils.resetVisibility(VisibilityKind.PRIVATE_LITERAL) - return 'class' - } - } - } - - /** - * default initializer for non-static attributes with a default value TODO: should be disabled by default, since non-static members can be initialized directly in C++ 011 - */ - static def defaultInitializer(Classifier classifier) { - - /* Bug 422373: The default initializer should not be generated if there are any user-defined - constructors. In plain C++ code, the existence of a constructor with parameters - means that the compiler will not synthesize a default one. - - E.g., this would be invalid in plain C++ code: - class T1 { }; - class T2 { public: T(int); }; - T1 * t1 = new T1; // OK, sythesized default constructor used - T2 * t2a = new T2(5); // OK, user-defined constructor used - T2 * t2b = new T2; // ERROR, default constructor was not synthesized - - Also, if the user has provided a default constructor in the code, we don't need - to generate a second copy here. A default constructor should only be generated - here if the compiler would have synthesized one anyhow. Otherwise the default - property values should be set in the constructors that are generated by - CppClassOperationsDeclaration. - */ - var code = ''' - «IF CppOperations.getOwnedOperations(classifier).filter[GenUtils.hasStereotype(it, Create)].empty» - «var attributeList = classifier.attributes.filter[ - (it.isStatic == false) && (it.defaultValue != null) && (it.defaultValue.stringValue != null)]» - «IF !attributeList.empty» - «classifier.name»() : «FOR a : attributeList SEPARATOR ', '»«a.name»(«a.defaultValue.stringValue»)«ENDFOR» {} - «ENDIF» - «ENDIF»''' - return code.trim - } - - static def generateClassBodyCode(Classifier classifier) ''' - #define «GenUtils.getFullName(classifier)»_BODY - - /************************************************************ - «classifier.name» class body - ************************************************************/ - - «CppIncludeUtil.CppIncludePreBody(classifier)» - - // include associated header file - «CppIncludeUtil.includeDirective( - GenUtils.getFullPath(classifier.nearestPackage) + '/' + classifier.name + '.' + - CppCodeGenUtils.getHeaderSuffix())» - - // Derived includes directives - «FOR path : CppClassIncludeClassDeclaration.CppClassAllIncludesDeclarationBody(classifier).sort» - «CppIncludeUtil.includeDirective(path)» - «ENDFOR» - - «CppIncludeUtil.CppIncludeBody(classifier)» - - «CppGenUtils.openNS(classifier)» - - «CppAttribute.CppStaticAttributes(classifier)» - - «IF !classifier.isTemplate» - «CppClassOperationsImplementation.CppClassOperationsImplementation(classifier, false)» - «ENDIF» - - «CppGenUtils.closeNS(classifier)» - - /************************************************************ - End of «classifier.name» class body - ************************************************************/ - ''' -} diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppDocumentation.xtend b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppDocumentation.xtend deleted file mode 100644 index de7dcd05ec5..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppDocumentation.xtend +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 CEA LIST. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * CEA LIST - initial API and implementation - *******************************************************************************/ - - package org.eclipse.papyrus.cpp.codegen.xtend - -import org.eclipse.uml2.uml.Element -import org.eclipse.uml2.uml.Operation -import org.eclipse.uml2.uml.Parameter -import org.eclipse.uml2.uml.Behavior -import org.eclipse.uml2.uml.ParameterDirectionKind -import org.eclipse.papyrus.codegen.base.GenUtils - -/** - * @author Önder GÜRCAN (onder.gurcan@cea.fr) - */ -class CppDocumentation { - static def CppElementDoc(Element argument) ''' - /** - * «GenUtils.getComments(argument).replaceAll('\n', '\n * ')» - */ - ''' - - static def CppOperationDoc(Operation operation) ''' - /** - * «GenUtils.getComments(operation).replaceAll('\n', '\n * ')» - «FOR op: operation.ownedParameters»«CppParamDoc(op)»«ENDFOR» - */ - ''' - - static def CppParamDoc(Parameter parameter) ''' - * «IF (parameter.direction == ParameterDirectionKind.RETURN_LITERAL) - »@return«ELSE»@param«ENDIF» «parameter.name» «GenUtils.getComments(parameter).replaceAll('\n', '\n * ')» - ''' - - static def CppBehaviorDoc(Behavior behavior) ''' - /** - * «GenUtils.getComments(behavior).replaceAll('\n', '\n * ')» - * «FOR op : behavior.ownedParameters»«CppParamDoc(op)»«ENDFOR» - */ - ''' -} diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppEnumerations.xtend b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppEnumerations.xtend deleted file mode 100644 index 7ab2661f252..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppEnumerations.xtend +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 CEA LIST. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * CEA LIST - initial API and implementation - *******************************************************************************/ - - package org.eclipse.papyrus.cpp.codegen.xtend - -import org.eclipse.uml2.uml.Enumeration -import org.eclipse.papyrus.C_Cpp.CppInit -import org.eclipse.uml2.uml.util.UMLUtil -import org.eclipse.papyrus.codegen.base.GenUtils - -/** - * @author Önder GÜRCAN (onder.gurcan@cea.fr) - */ -class CppEnumerations { - static def CppEnumerationDefinition(Enumeration enumeration) ''' - «CppDocumentation.CppElementDoc(enumeration)» - enum «enumeration.name» { - «FOR ownedLiteral : enumeration.ownedLiterals» - «CppDocumentation.CppElementDoc(ownedLiteral)» - «ownedLiteral.name»«IF GenUtils.hasStereotype(ownedLiteral, CppInit)»«UMLUtil. - getStereotypeApplication(ownedLiteral, CppInit).value»«ENDIF», - «ENDFOR» - }; - ''' -} diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppIncludeUtil.xtend b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppIncludeUtil.xtend deleted file mode 100644 index c8623883fe1..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppIncludeUtil.xtend +++ /dev/null @@ -1,86 +0,0 @@ -package org.eclipse.papyrus.cpp.codegen.xtend - -/******************************************************************************* - * Copyright (c) 2014 CEA LIST. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * CEA LIST - initial API and implementation - *******************************************************************************/ - - import org.eclipse.uml2.uml.NamedElement -import org.eclipse.papyrus.C_Cpp.Include -import org.eclipse.uml2.uml.util.UMLUtil -import org.eclipse.papyrus.codegen.base.GenUtils - -/** - * @author Önder GÜRCAN (onder.gurcan@cea.fr) - */ -class CppIncludeUtil { - static def includeDirective(String path) { - if ((path != null) && (path.length > 0)) - return '''#include ''' + '"' + path + '"' - } - - static def CppIncludeHeader(NamedElement ne) { - if (GenUtils.hasStereotype(ne, Include)) { - UMLUtil.getStereotypeApplication(ne, Include) - var header = UMLUtil.getStereotypeApplication(ne, Include).header - if ((header != null) && (header.length > 0)) { - var includeHeader = constIncludeHeaderStart + GenUtils.cleanCR(header) + '\n' + - constIncludeHeaderEnd - return includeHeader - } - } - } - - static def constIncludeHeaderStart() ''' - // Include from Include stereotype (header) - ''' - - static def constIncludeHeaderEnd() ''' - // End of Include stereotype (header) - ''' - - static def CppIncludePreBody(NamedElement ne) { - if (GenUtils.hasStereotype(ne, Include)) { - var String preBody = UMLUtil.getStereotypeApplication(ne, Include).preBody - if ((preBody != null) && (preBody.length > 0)) { - var includePreBody = constIncludePreBodyStart + GenUtils.cleanCR(preBody) + '\n' + - constIncludePreBodyEnd - return includePreBody - } - } - } - - static def constIncludePreBodyStart() ''' - // Include from Include stereotype (pre-body) - ''' - - static def constIncludePreBodyEnd() ''' - // End of Include stereotype (pre-body) - ''' - - static def CppIncludeBody(NamedElement ne) { - if (GenUtils.hasStereotype(ne, Include)) { - var String body = UMLUtil.getStereotypeApplication(ne, Include).body - if ((body != null) && (body.length > 0)) { - var includeBody = constIncludeBodyStart + GenUtils.cleanCR(body) + '\n' + - constIncludeBodyEnd - return includeBody - } - } - } - - static def constIncludeBodyStart() ''' - // Include from Include declaration (body) - ''' - - static def constIncludeBodyEnd() ''' - // End of Include declaration (body) - ''' - -} diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppInnerClassifiers.xtend b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppInnerClassifiers.xtend deleted file mode 100644 index 78938c09623..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppInnerClassifiers.xtend +++ /dev/null @@ -1,58 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 CEA LIST. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * CEA LIST - initial API and implementation - *******************************************************************************/ - -package org.eclipse.papyrus.cpp.codegen.xtend - -import org.eclipse.uml2.uml.Classifier -import org.eclipse.papyrus.cpp.codegen.utils.CppGenUtils -import org.eclipse.uml2.uml.VisibilityKind -import org.eclipse.papyrus.codegen.base.GenUtils -import org.eclipse.uml2.uml.NamedElement - -/** - * @author Shuai Li (CEA) <shuai.li@cea.fr> - */ - -class CppInnerClassifiers { - static def CppInnerClassDefinition(Classifier classifier) ''' - «CppDocumentation.CppElementDoc(classifier)» - «CppTemplates.templateSignature(classifier)»«CppClassifierGenerator.classUnionOrStruct(classifier)» «classifier.name»«CppClassInheritedDeclarations. - CppClassInheritedDeclarations(classifier)» { - «CppClassFriendDeclaration.CppClassIncludeFriendDeclaration(classifier)»«CppClassTypeAndEnum.CppClassTypeAndEnum(classifier)» - «var publicVisibility = VisibilityKind.PUBLIC_LITERAL» - «CppGenUtils.getSection(publicVisibility, CppClassifierGenerator.defaultInitializer(classifier))» - «CppGenUtils.getSection(publicVisibility, - CppClassAttributesDeclaration.CppClassAttributesDeclaration(classifier, publicVisibility).toString)» - «CppGenUtils.getSection(publicVisibility, - CppClassOperationsDeclaration.CppClassOperationsDeclaration(classifier, publicVisibility).toString)» - - «var protectedVisibility = VisibilityKind.PROTECTED_LITERAL» - «CppGenUtils.getSection(protectedVisibility, - CppClassAttributesDeclaration.CppClassAttributesDeclaration(classifier, protectedVisibility).toString)» - «CppGenUtils.getSection(protectedVisibility, - CppClassOperationsDeclaration.CppClassOperationsDeclaration(classifier, protectedVisibility).toString)» - - «var privateVisibility = VisibilityKind.PRIVATE_LITERAL» - «CppGenUtils.getSection(privateVisibility, - CppClassAttributesDeclaration.CppClassAttributesDeclaration(classifier, privateVisibility).toString)» - «CppGenUtils.getSection(privateVisibility, - CppClassOperationsDeclaration.CppClassOperationsDeclaration(classifier, privateVisibility).toString)» - }; - ''' - - static def CppInnerBindDefinition(Classifier classifier) ''' - «var tb = GenUtils.getTemplateBinding(classifier)» - «var templateElement = tb.targets.get(0)» - /************************************************************/ - typedef «(templateElement.owner as NamedElement).name»<«FOR ps : tb.parameterSubstitutions SEPARATOR ', '»« - CppTemplates.CppTemplateBindingParameter(ps)»«ENDFOR»> «classifier.name»; - ''' -}
\ No newline at end of file diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppOperations.xtend b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppOperations.xtend deleted file mode 100644 index 557bd5b1c90..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppOperations.xtend +++ /dev/null @@ -1,204 +0,0 @@ -package org.eclipse.papyrus.cpp.codegen.xtend - -/******************************************************************************* - * Copyright (c) 2014 CEA LIST. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * CEA LIST - initial API and implementation - *******************************************************************************/ - - import org.eclipse.papyrus.C_Cpp.Inline -import org.eclipse.papyrus.C_Cpp.Virtual -import org.eclipse.papyrus.cpp.codegen.utils.CppGenUtils -import org.eclipse.papyrus.cpp.codegen.utils.Modifier -import org.eclipse.uml2.uml.Behavior -import org.eclipse.uml2.uml.Class -import org.eclipse.uml2.uml.Classifier -import org.eclipse.uml2.uml.DataType -import org.eclipse.uml2.uml.Element -import org.eclipse.uml2.uml.Interface -import org.eclipse.uml2.uml.OpaqueBehavior -import org.eclipse.uml2.uml.Operation -import org.eclipse.uml2.uml.profile.standard.Create -import org.eclipse.uml2.uml.profile.standard.Destroy -import org.eclipse.papyrus.C_Cpp.ConstInit -import org.eclipse.uml2.uml.util.UMLUtil -import org.eclipse.papyrus.cpp.codegen.Constants -import org.eclipse.uml2.uml.NamedElement -import org.eclipse.uml2.uml.Region -import org.eclipse.papyrus.cpp.codegen.utils.ClassUtils -import org.eclipse.papyrus.codegen.base.GenUtils -import org.eclipse.papyrus.C_Cpp.Variadic -import org.eclipse.uml2.uml.ParameterDirectionKind - -class CppOperations { - static def CppOperationImplementation(Operation operation) ''' - «CppDocumentation.CppOperationDoc(operation)» - «IF (operation.name == 'main')» - «CppReturnSpec(operation)»«operation.name»(«CppParameter.CppOperationParameters(operation,false)») { - «GenUtils.getBody(operation, Constants.supportedLanguages)» - } - «ELSE» - «CppTemplates.templateSignature(operation)»«InlineTxt(operation)»«CppReturnSpec(operation)»«GenUtils.getNestedOperationFarthestClassifierOwnerNamespace(operation)»«CppTemplates.templateShortSignature(operation)»::«destructor(operation)»«operation.name»(«CppParameter.CppOperationParameters(operation, false)»«variadicParameter(operation)»)«throwss(operation)»«Modifier.modCVQualifier(operation)»«CppConstInit(operation)» { - «GenUtils.getBody(operation, Constants.supportedLanguages)» - } - «ENDIF» - ''' - - static def CppReturnSpec(Operation operation) { - if ((operation.type == null) || isConsOrDestructor(operation)) { - ConsDestructorOrVoid(operation) - } else { - Modifier.modCVQualifier(operation.getReturnResult())+' '+CppGenUtils.cppQualifiedName(operation.type)+Modifier.modPtr(operation.getReturnResult())+Modifier.modRef(operation.getReturnResult())+' ' - } - } - - static def CppReturnSpec(Behavior behavior) ''' - «IF (GenUtils.returnResult(behavior) == null)»void «ELSE»«Modifier.modCVQualifier(GenUtils.returnResult(behavior))» «CppGenUtils.cppQualifiedName(GenUtils.returnResult(behavior).type)»«Modifier.modPtr(GenUtils.returnResult(behavior))»«Modifier.modRef(GenUtils.returnResult(behavior))» «ENDIF» - ''' - - static def throwss(Operation operation) ''' - «IF operation.raisedExceptions.length > 0» - throws «FOR re : operation.raisedExceptions SEPARATOR ','»«re.name»«ENDFOR» - «ENDIF» - ''' - - static def ConsDestructorOrVoid(Operation operation) { - if (isConsOrDestructor(operation)) { - - } else { - 'void ' - } - } - - static def isConsOrDestructor(Operation operation) { - GenUtils.hasStereotype(operation, Create) || GenUtils.hasStereotype(operation, Destroy) - } - - static def CppConstInit(Operation operation) { - if (GenUtils.hasStereotype(operation, ConstInit) && GenUtils.hasStereotype(operation, Create)) { - ": " + UMLUtil.getStereotypeApplication(operation, ConstInit).initialisation - } - } - - // return a list of owned operations, return emptyset, if null - static def getOwnedOperations(Classifier cl) { - val operations = getOwnedOperationsWNull(cl) - if (operations == null) { - emptySet - } - else { - operations - } - } - - // return a list of owned operations, since this is not supported directly on a classifier - static def getOwnedOperationsWNull(Classifier cl) { - if (cl instanceof Class) { - (cl as Class).ownedOperations - } else { - if (cl instanceof DataType) { - (cl as DataType).ownedOperations - } else { - if (cl instanceof Interface) { - (cl as Interface).ownedOperations - } else { - // Sequence{} - } - } - } - } - - static def getNestedOperations(Classifier c1) { - val operations = getNestedOperationsWNull(c1) - if (operations == null) { - emptySet - } - else { - operations - } - } - - static def getNestedOperationsWNull(Classifier cl) { - if (cl instanceof Class || cl instanceof Interface) { - ClassUtils.nestedOperations(cl) - } - } - - static def CppBehaviorImplementation(OpaqueBehavior behavior) ''' - «CppDocumentation.CppBehaviorDoc(behavior)» - «CppReturnSpec(behavior)»«GenUtils.getNestedBehaviorFarthestClassifierOwnerNamespace(behavior)»::«behavior.qualifiedBehaviorName»(«CppParameter.CppBehaviorParameters(behavior, false)»)«Modifier.modCVQualifier(behavior)» { - «GenUtils.getBodyFromOB(behavior, Constants.supportedLanguages)» - } - ''' - - static def CppOperationDeclaration(Operation operation) ''' - «CppDocumentation.CppOperationDoc(operation)» - «InlineTxt(operation)»«virtualTxt(operation)»«staticTxt(operation)»«CppReturnSpec(operation)»«destructor(operation)»«operation.name»(«CppParameter.CppOperationParameters(operation,true)»«variadicParameter(operation)»)«Modifier.modCVQualifier(operation)»«virtualSuffix(operation)»; - ''' - - static def InlineTxt(Element element) { - if (GenUtils.hasStereotype(element, Inline)) 'inline ' - } - - static def virtualTxt(Operation operation) { - if ((operation.interface != null) || (operation.isAbstract) || (GenUtils.hasStereotype(operation, Virtual))) 'virtual ' - } - - static def staticTxt(Operation operation) { - if (operation.isStatic) 'static ' - } - - static def destructor(Operation operation) { - if (GenUtils.hasStereotype(operation, Destroy) && (!operation.name.startsWith('~'))) { - '~' - } else { - '' - } - } - - static def public virtualSuffix(Operation operation) { - if ((operation.interface != null) || (operation.isAbstract)) ' = 0' - } - - static def CppBehaviorDeclaration(Behavior behavior) ''' - «CppDocumentation.CppBehaviorDoc(behavior)» - «InlineTxt(behavior)»«CppReturnSpec(behavior)»«behavior.qualifiedBehaviorName»(«CppParameter.CppBehaviorParameters(behavior, true)»)«Modifier.modCVQualifier(behavior)»; - ''' - - static def qualifiedBehaviorName(Behavior behavior) { - var ne = behavior as NamedElement - var name = behavior.name - while ((ne != null) && !(ne instanceof Classifier) || (ne instanceof Behavior)) { - if (ne.owner instanceof NamedElement) { - ne = ne.owner as NamedElement - } - if (ne.owner instanceof Region) { - name = ne.name + "_" + name - } - } - return name - } - - static def variadicParameter(Operation operation) { - var hasParameters = false; - var i = 0; - if (GenUtils.hasStereotype(operation, Variadic)) { - while (i < operation.ownedParameters.size && !hasParameters) { - if (operation.ownedParameters.get(i).direction != ParameterDirectionKind.RETURN_LITERAL) { - hasParameters = true; - } - } - - if (hasParameters) { - ', ...' - } else { - '...' - } - } - } -}
\ No newline at end of file diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppPackageHeaderGenerator.xtend b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppPackageHeaderGenerator.xtend deleted file mode 100644 index 4698312f2b8..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppPackageHeaderGenerator.xtend +++ /dev/null @@ -1,64 +0,0 @@ -package org.eclipse.papyrus.cpp.codegen.xtend - -/******************************************************************************* - * Copyright (c) 2014 CEA LIST. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * CEA LIST - initial API and implementation - *******************************************************************************/ - -import org.eclipse.papyrus.cpp.codegen.preferences.CppCodeGenUtils -import org.eclipse.papyrus.cpp.codegen.utils.CppGenUtils -import org.eclipse.uml2.uml.Package -import org.eclipse.papyrus.codegen.base.GenUtils - -/** - * @author Önder GÜRCAN (onder.gurcan@cea.fr) - */ -class CppPackageHeaderGenerator { - - static def generateCode(Package pkg) ''' - #ifndef PKG_«GenUtils.getFullNameUC(pkg)» - #define PKG_«GenUtils.getFullNameUC(pkg)» - - /************************************************************ - Pkg_«pkg.name» package header - ************************************************************/ - - «CppIncludeUtil.includeDirective(CppClassIncludeClassDeclaration.cppOwnerPackageIncludePath(pkg.nestingPackage))» - - #ifndef _IN_ - #define _IN_ - #endif - #ifndef _OUT_ - #define _OUT_ - #endif - #ifndef _INOUT_ - #define _INOUT_ - #endif - - - /* Package dependency header include */ - «FOR p: GenUtils.getUsedPackages(pkg)» - «var path = GenUtils.getFullPath(p) + "/Pkg_"+ p.name + "." + CppCodeGenUtils.getHeaderSuffix» - «CppIncludeUtil.includeDirective(path)» - «ENDFOR» - - «CppIncludeUtil.CppIncludeHeader(pkg)» - «CppGenUtils.openNS(pkg)» - - // Types defined within the package - «CppClassTypeAndEnum.CppClassTypeAndEnumPackage(pkg)» - «CppGenUtils.closeNS(pkg)» - - /************************************************************ - End of Pkg_«pkg.name» package header - ************************************************************/ - - #endif - ''' -}
\ No newline at end of file diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppParameter.xtend b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppParameter.xtend deleted file mode 100644 index 160265df9b8..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppParameter.xtend +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 CEA LIST. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * CEA LIST - initial API and implementation - *******************************************************************************/ - - package org.eclipse.papyrus.cpp.codegen.xtend - -import org.eclipse.uml2.uml.Operation -import org.eclipse.uml2.uml.Parameter -import org.eclipse.papyrus.cpp.codegen.utils.Modifier -import org.eclipse.papyrus.cpp.codegen.utils.CppGenUtils -import org.eclipse.uml2.uml.ParameterDirectionKind -import org.eclipse.uml2.uml.Behavior -import org.eclipse.papyrus.C_Cpp.Array -import org.eclipse.uml2.uml.util.UMLUtil - -/** - * @author Önder GÜRCAN (onder.gurcan@cea.fr) - */ -class CppParameter { - - static def CppOperationParameters(Operation operation, boolean showDefault) ''' - «FOR ownedParameter : operation.ownedParameters.filter[it.direction != ParameterDirectionKind.RETURN_LITERAL] SEPARATOR ', '»«CppParameter(ownedParameter, showDefault)»«ENDFOR»''' - - /** - * comment signature for a given behavior (e.g. effect within state machine) - */ - static def CppBehaviorParameters(Behavior behavior, boolean showDefault) ''' - «FOR ownedParameter : behavior.ownedParameters.filter[it.direction != ParameterDirectionKind.RETURN_LITERAL] SEPARATOR ', '»«CppParameter(ownedParameter, showDefault)»«ENDFOR» - ''' - - /** - * C++ parameter. Default values are added, if parameter showDefault is true (implementation signature - */ - static def CppParameter(Parameter parameter, boolean showDefault) { - Modifier.modCVQualifier(parameter) + Modifier.modSCQualifier(parameter) + CppGenUtils.cppQualifiedName(parameter.type) + - Modifier.modPtr(parameter) + Modifier.modRef(parameter) + Modifier.dirInfo(parameter) + " " + parameter.name + - Modifier.modArray(parameter) + {if (showDefault) defaultValue(parameter) else ""} - } - - /** - * CppParameterCalculation for CDT - */ - static def CppParameterForCDT(Parameter parameter) { - var paramStr = Modifier.modCVQualifier(parameter) + Modifier.modSCQualifier(parameter) + CppGenUtils.cppQualifiedName(parameter.type) + - Modifier.modPtr(parameter) + Modifier.modRef(parameter) - if (UMLUtil.getStereotypeApplication(parameter, Array) != null) { - paramStr += "[]" - } - return paramStr - } - - static def defaultValue(Parameter parameter) { - if (parameter.defaultValue != null) " = " + parameter.defaultValue.stringValue() else "" - } -}
\ No newline at end of file diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppPrimitiveTypes.xtend b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppPrimitiveTypes.xtend deleted file mode 100644 index 46fcb612a72..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppPrimitiveTypes.xtend +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 CEA LIST. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * CEA LIST - initial API and implementation - *******************************************************************************/ - - package org.eclipse.papyrus.cpp.codegen.xtend - -import org.eclipse.uml2.uml.PrimitiveType -import org.eclipse.papyrus.C_Cpp.Typedef -import org.eclipse.papyrus.cpp.codegen.utils.CppGenUtils -import org.eclipse.uml2.uml.util.UMLUtil -import org.eclipse.papyrus.codegen.base.GenUtils - -/** - * @author Önder GÜRCAN (onder.gurcan@cea.fr) - */ -class CppPrimitiveTypes { - - /** Support two different kinds of primitive types - * (1) those that are native types of the programming language such as long - * For these, no additional definition has to be done and they should be referenced - * with their name only - * (2) those that correspond to a typedef (e.g. typedef long ErrorType). These require - * a typedef definition within the package and need to be referenced with their - * fully qualified name (e.g. MyPackage::ErrorType) - * (3) Sometimes the name of the type defined by a typedef does not appear at the end, e.g. - * when defining functionPointers such as "typedef int (*HandlerFct) (void*);" - * (a function with a void* argument returning int) - * Support this case via a specific 'typeName' constant that gets replaced by the name of the - * type - */ - static def CppPrimitiveTypeDefinition(PrimitiveType primitiveType) ''' - «CppDocumentation.CppElementDoc(primitiveType)» - «IF GenUtils.hasStereotype(primitiveType, Typedef)» - typedef «UMLUtil.getStereotypeApplication(primitiveType, Typedef).definition.replaceAll('typeName', primitiveType.name)» - «IF !UMLUtil.getStereotypeApplication(primitiveType, Typedef).definition.contains('typeName')»«primitiveType.name»«ENDIF»; - - «ELSE» - «CppGenUtils.getStdtypes(primitiveType)» - - «ENDIF» - ''' -}
\ No newline at end of file diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppTemplates.xtend b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppTemplates.xtend deleted file mode 100644 index 13c207c8708..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppTemplates.xtend +++ /dev/null @@ -1,58 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 CEA LIST. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * CEA LIST - initial API and implementation - *******************************************************************************/ - - package org.eclipse.papyrus.cpp.codegen.xtend - -import org.eclipse.uml2.uml.Operation -import org.eclipse.uml2.uml.Classifier -import org.eclipse.papyrus.cpp.codegen.utils.CppGenUtils -import org.eclipse.uml2.uml.TemplateParameterSubstitution -import org.eclipse.uml2.uml.NamedElement -import org.eclipse.uml2.uml.LiteralInteger -import org.eclipse.papyrus.codegen.base.GenUtils - -/** - * @author Önder GÜRCAN (onder.gurcan@cea.fr) - */ -class CppTemplates { - - static def templateSignature(Operation operation) { - templateSignature(operation.owner as Classifier) - } - - static def templateSignature(Classifier clazz)''' - «IF (isTemplate(clazz))» - template<«FOR templateParam : GenUtils.getTemplateParameters(clazz) SEPARATOR ', '»«CppGenUtils.getTemplateTypeName(templateParam)»«ENDFOR»> - «ENDIF» - ''' - - static def templateShortSignature(Operation operation) { - templateShortSignature(operation.owner as Classifier) - } - - static def templateShortSignature(Classifier clazz)''' - «IF (isTemplate(clazz))» - <«FOR templateParam : GenUtils.getTemplateParameters(clazz) SEPARATOR ', '»«GenUtils.getTemplateName(templateParam)»«ENDFOR»> - «ENDIF» - ''' - - static def isTemplate(Classifier clazz) { - GenUtils.getTemplateParameters(clazz).size() > 0 - } - - static def CppTemplateBindingParameter(TemplateParameterSubstitution tps) { - if (tps.actual instanceof LiteralInteger) { - (tps.actual as LiteralInteger).value - } else { - (tps.actual as NamedElement).name - } - } -}
\ No newline at end of file diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/xtend-gen/.gitignore b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/xtend-gen/.gitignore deleted file mode 100644 index c96a04f008e..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/xtend-gen/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -* -!.gitignore
\ No newline at end of file |