blob: 38e7433df5b619cf332a85792bae6356083ca204 [file] [log] [blame]
/**
********************************************************************************
* Copyright (c) 2020 Robert Bosch GmbH.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Robert Bosch GmbH - initial API and implementation
********************************************************************************
*/
package org.eclipse.app4mc.slg.linux.transformers;
public class LinuxTranslationUnit {
private static final String SRC_FOLDER = "/_src/";
private static final String INC_FOLDER = "/_inc/";
static final String SRC_EXT = ".c";
static final String INC_EXT = ".h";
private String basePath;
private String moduleName;
private String call;
private boolean valid;
public LinuxTranslationUnit(final String _basePath, final String _moduleName, final String _call) {
basePath = _basePath;
moduleName = _moduleName;
call = _call;
valid = true;
}
public LinuxTranslationUnit(final String errorMessage) {
basePath = errorMessage;
moduleName = errorMessage;
call = errorMessage;
valid = false;
}
public String getBasePath() {
return basePath;
}
public String getModuleName() {
return moduleName;
}
public String getCall() {
return call;
}
public boolean isValid() {
return valid;
}
// derived attributes
private String getModulePath() { return basePath + "/" + moduleName; }
public String getIncModulePath() { return getModulePath() + INC_FOLDER + moduleName; }
public String getSrcModulePath() { return getModulePath() + SRC_FOLDER + moduleName; }
public String getSrcFile() { return moduleName + SRC_EXT; }
public String getIncFile() { return moduleName + INC_EXT; }
public String getSrcPath() { return getModulePath() + SRC_FOLDER + getSrcFile(); }
public String getIncPath() { return getModulePath() + INC_FOLDER + getIncFile(); }
}