mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
eliminate class StringUtil
Change-Id: I07cd8c70d2db8abe415f720275b6c25d464ba91c Signed-off-by: Martin Weber <fifteenknots505@gmail.com>
This commit is contained in:
parent
d49362a526
commit
fce6d2f93f
4 changed files with 3 additions and 48 deletions
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
|||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: %pluginName
|
||||
Bundle-SymbolicName: org.eclipse.cdt.cmake.core;singleton:=true
|
||||
Bundle-Version: 1.4.0.qualifier
|
||||
Bundle-Version: 1.4.100.qualifier
|
||||
Bundle-Activator: org.eclipse.cdt.cmake.core.internal.Activator
|
||||
Bundle-Vendor: %providerName
|
||||
Require-Bundle: org.eclipse.core.runtime,
|
||||
|
|
|
@ -30,7 +30,6 @@ import org.eclipse.cdt.cmake.is.core.internal.ParserDetection;
|
|||
import org.eclipse.cdt.cmake.is.core.internal.ParserDetection.DetectorWithMethod;
|
||||
import org.eclipse.cdt.cmake.is.core.internal.ParserDetection.ParserDetectionResult;
|
||||
import org.eclipse.cdt.cmake.is.core.internal.Plugin;
|
||||
import org.eclipse.cdt.cmake.is.core.internal.StringUtil;
|
||||
import org.eclipse.cdt.cmake.is.core.internal.builtins.CompilerBuiltinsDetector;
|
||||
import org.eclipse.cdt.cmake.is.core.participant.DefaultToolDetectionParticipant;
|
||||
import org.eclipse.cdt.cmake.is.core.participant.IRawIndexerInfo;
|
||||
|
@ -225,7 +224,7 @@ public class CompileCommandsJsonParser {
|
|||
// CMake-notation (fileSep are forward slashes)
|
||||
final String cwdStr = sourceFileInfo.getDirectory();
|
||||
IPath cwd = cwdStr != null ? Path.fromOSString(cwdStr) : new Path(""); //$NON-NLS-1$
|
||||
IResult result = parser.processArgs(cwd, StringUtil.trimLeadingWS(pdr.getReducedCommandLine()));
|
||||
IResult result = parser.processArgs(cwd, pdr.getReducedCommandLine().stripLeading());
|
||||
// remember result together with file name
|
||||
rememberFileResult(file, result);
|
||||
|
||||
|
|
|
@ -1,43 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2019 Martin Weber.
|
||||
*
|
||||
* Content is provided to you under the terms and conditions of the Eclipse Public License Version 2.0 "EPL".
|
||||
* A copy of the EPL is available at http://www.eclipse.org/legal/epl-2.0.
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.cmake.is.core.internal;
|
||||
|
||||
/**
|
||||
* String manipulation functions.
|
||||
*
|
||||
* @author Martin Weber
|
||||
*/
|
||||
public class StringUtil {
|
||||
|
||||
/**
|
||||
* Just static methods.
|
||||
*
|
||||
*/
|
||||
private StringUtil() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of the string, with leading whitespace omitted.
|
||||
*
|
||||
* @param string the string to remove whitespace from
|
||||
* @return A copy of the string with leading white space removed, or the string
|
||||
* if it has no leading white space.
|
||||
*/
|
||||
public static String trimLeadingWS(String string) {
|
||||
int len = string.length();
|
||||
int st = 0;
|
||||
|
||||
while ((st < len) && (string.charAt(st) <= ' ')) {
|
||||
st++;
|
||||
}
|
||||
return st > 0 ? string.substring(st, len) : string;
|
||||
}
|
||||
|
||||
}
|
|
@ -14,7 +14,6 @@ import java.util.Optional;
|
|||
|
||||
import org.eclipse.cdt.cmake.is.core.internal.ParseContext;
|
||||
import org.eclipse.cdt.cmake.is.core.internal.Plugin;
|
||||
import org.eclipse.cdt.cmake.is.core.internal.StringUtil;
|
||||
import org.eclipse.cdt.cmake.is.core.participant.builtins.IBuiltinsDetectionBehavior;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
|
@ -124,7 +123,7 @@ public class DefaultToolCommandlineParser implements IToolCommandlineParser {
|
|||
@SuppressWarnings("nls")
|
||||
private IResult parseArguments(IResponseFileArglet responseFileArglet, String args) {
|
||||
// eat buildOutput string argument by argument..
|
||||
while (!(args = StringUtil.trimLeadingWS(args)).isEmpty()) {
|
||||
while (!(args = args.stripLeading()).isEmpty()) {
|
||||
boolean argParsed = false;
|
||||
int consumed;
|
||||
// parse with first parser that can handle the first argument on the
|
||||
|
|
Loading…
Add table
Reference in a new issue