blob: 6aab57cb8cd2525d769fb4b649682bc94331317c [file] [log] [blame]
/**
********************************************************************************
* Copyright (c) 2020-2021 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;
import org.eclipse.app4mc.transformation.transformers.ISubTransformer;
import org.eclipse.app4mc.transformation.util.OutputBuffer;
import com.google.inject.Inject;
public abstract class LinuxBaseTransformer implements ISubTransformer {
static final String SRC_TYPE = "C";
static final String INC_TYPE = "H";
@Inject private OutputBuffer outputBuffer;
public boolean isIncFileEmpty(LinuxTranslationUnit tu) {
return !outputBuffer.bufferExists(INC_TYPE, tu.getIncModulePath());
}
public boolean isSrcFileEmpty(LinuxTranslationUnit tu) {
return !outputBuffer.bufferExists(SRC_TYPE, tu.getSrcModulePath());
}
public boolean incAppend(LinuxTranslationUnit tu, String str) {
return outputBuffer.appendTo(INC_TYPE, tu.getIncModulePath(), str);
}
public boolean srcAppend(LinuxTranslationUnit tu, String str) {
return outputBuffer.appendTo(SRC_TYPE, tu.getSrcModulePath(), str);
}
}