diff options
author | Karsten Heimrich <karsten.heimrich@qt.io> | 2016-11-01 12:13:43 +0100 |
---|---|---|
committer | Karsten Heimrich <karsten.heimrich@qt.io> | 2016-11-02 09:27:13 +0000 |
commit | f4a6d3fdbcffecaf6ce8c21245460b67d834b19c (patch) | |
tree | 7b557c6ccdc34b4af8a593a2caaa235f78527916 | |
parent | 502b50d833a79552da65a900ed59833f9b791935 (diff) |
Style change: Use string.Empty where possible
Change-Id: I4cc855da83e549d7f1c654aa9c96cf1ed8db6409
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
-rw-r--r-- | src/qtprojectlib/CompilerToolWrapper.cs | 4 | ||||
-rw-r--r-- | src/qtprojectlib/CxxStreamReader.cs | 8 | ||||
-rw-r--r-- | src/qtprojectlib/ExportProjectDialog.cs | 4 | ||||
-rw-r--r-- | src/qtprojectlib/HelperClasses.cs | 6 | ||||
-rw-r--r-- | src/qtprojectlib/HelperFunctions.cs | 6 | ||||
-rw-r--r-- | src/qtprojectlib/MocCmdChecker.cs | 2 | ||||
-rw-r--r-- | src/qtprojectlib/ProjectImporter.cs | 2 | ||||
-rw-r--r-- | src/qtprojectlib/QMakeProcess.cs | 4 | ||||
-rw-r--r-- | src/qtprojectlib/QtModules.cs | 8 | ||||
-rw-r--r-- | src/qtprojectlib/QtProject.cs | 32 | ||||
-rw-r--r-- | src/qtvstools/AddQtVersionDialog.cs | 8 | ||||
-rw-r--r-- | src/qtvstools/FormVSQtSettings.cs | 2 | ||||
-rw-r--r-- | src/qtvstools/Translation.cs | 2 | ||||
-rw-r--r-- | src/qtwizard/ConsoleWizard.cs | 2 | ||||
-rw-r--r-- | src/qtwizard/CoreClassWizard.cs | 8 | ||||
-rw-r--r-- | src/qtwizard/DesignerWizard.cs | 2 | ||||
-rw-r--r-- | src/qtwizard/GuiClassWizard.cs | 2 | ||||
-rw-r--r-- | src/qtwizard/GuiWizard.cs | 2 | ||||
-rw-r--r-- | src/qtwizard/LibraryWizard.cs | 2 | ||||
-rw-r--r-- | src/qtwizard/ServerWizard.cs | 2 |
20 files changed, 54 insertions, 54 deletions
diff --git a/src/qtprojectlib/CompilerToolWrapper.cs b/src/qtprojectlib/CompilerToolWrapper.cs index a0e1c006..68c547b3 100644 --- a/src/qtprojectlib/CompilerToolWrapper.cs +++ b/src/qtprojectlib/CompilerToolWrapper.cs @@ -178,7 +178,7 @@ namespace QtProjectLib public void SetAdditionalIncludeDirectories(string value) { // Prevent setting of empty substring, as they break the build - value = value.Replace("\"\",", ""); + value = value.Replace("\"\",", string.Empty); if (compilerTool != null) compilerTool.AdditionalIncludeDirectories = value; else @@ -476,7 +476,7 @@ namespace QtProjectLib obj = null; } if (obj == null) - return ""; + return string.Empty; return (string) obj; } diff --git a/src/qtprojectlib/CxxStreamReader.cs b/src/qtprojectlib/CxxStreamReader.cs index c782f4d4..910dfad5 100644 --- a/src/qtprojectlib/CxxStreamReader.cs +++ b/src/qtprojectlib/CxxStreamReader.cs @@ -101,7 +101,7 @@ namespace QtProjectLib case State.Normal: { string lineCopy = line; - line = ""; + line = string.Empty; for (int i = 0, j = 1; i < lineCopy.Length; ++i, ++j) { if (lineCopy[i] == '/' && j < lineCopy.Length) { if (lineCopy[j] == '*') { @@ -135,7 +135,7 @@ namespace QtProjectLib } else { state = State.Normal; } - line = ""; + line = string.Empty; break; } else { if (!removeStrings) @@ -157,14 +157,14 @@ namespace QtProjectLib line = line.Substring(idx + 2); break; } else { - line = ""; // skip line + line = string.Empty; // skip line } } break; case State.String: { string lineCopy = line; - line = ""; + line = string.Empty; int endIdx = -1; do { endIdx = lineCopy.IndexOf('"', endIdx + 1); diff --git a/src/qtprojectlib/ExportProjectDialog.cs b/src/qtprojectlib/ExportProjectDialog.cs index b76d63b6..b15a03fe 100644 --- a/src/qtprojectlib/ExportProjectDialog.cs +++ b/src/qtprojectlib/ExportProjectDialog.cs @@ -329,7 +329,7 @@ namespace QtProjectLib currentOpt = (ProFileOption) currentPro.Options[optionComboBox.SelectedIndex]; UpdateCurrentListItem(); - optionTextBox.Text = ""; + optionTextBox.Text = string.Empty; // update comment field commentLabel.Text = currentOpt.Comment; @@ -408,7 +408,7 @@ namespace QtProjectLib optionListBox.SelectedIndex = index; if (index < 0) { - optionTextBox.Text = ""; + optionTextBox.Text = string.Empty; UpdateButtons(); } } diff --git a/src/qtprojectlib/HelperClasses.cs b/src/qtprojectlib/HelperClasses.cs index 5ffbd2ed..07568087 100644 --- a/src/qtprojectlib/HelperClasses.cs +++ b/src/qtprojectlib/HelperClasses.cs @@ -70,9 +70,9 @@ namespace QtProjectLib public class FakeFilter { - private string uniqueIdentifier = ""; - private string name = ""; - private string filter = ""; + private string uniqueIdentifier = string.Empty; + private string name = string.Empty; + private string filter = string.Empty; private bool parseFiles = true; private bool sccFiles = true; diff --git a/src/qtprojectlib/HelperFunctions.cs b/src/qtprojectlib/HelperFunctions.cs index e89289d4..b3c34d02 100644 --- a/src/qtprojectlib/HelperFunctions.cs +++ b/src/qtprojectlib/HelperFunctions.cs @@ -138,7 +138,7 @@ namespace QtProjectLib static public void SetDebuggingEnvironment(EnvDTE.Project prj) { - SetDebuggingEnvironment(prj, ""); + SetDebuggingEnvironment(prj, string.Empty); } static public void SetDebuggingEnvironment(EnvDTE.Project prj, string solutionConfig) @@ -148,7 +148,7 @@ namespace QtProjectLib static public void SetDebuggingEnvironment(EnvDTE.Project prj, string envpath, bool overwrite) { - SetDebuggingEnvironment(prj, envpath, overwrite, ""); + SetDebuggingEnvironment(prj, envpath, overwrite, string.Empty); } static public void SetDebuggingEnvironment(EnvDTE.Project prj, string envpath, bool overwrite, string solutionConfig) @@ -290,7 +290,7 @@ namespace QtProjectLib var line = string.Empty; while ((line = ReadProFileLine(sr)) != null) { - line = line.Replace(" ", "").Replace("\t", ""); + line = line.Replace(" ", string.Empty).Replace("\t", string.Empty); if (line.StartsWith("TEMPLATE", StringComparison.Ordinal)) return line.StartsWith("TEMPLATE=subdirs", StringComparison.Ordinal); } diff --git a/src/qtprojectlib/MocCmdChecker.cs b/src/qtprojectlib/MocCmdChecker.cs index a4d7727a..cdd38f89 100644 --- a/src/qtprojectlib/MocCmdChecker.cs +++ b/src/qtprojectlib/MocCmdChecker.cs @@ -41,7 +41,7 @@ namespace QtProjectLib { var s = path.ToLower().Trim(); s = backslashRegEx.Replace(s, "\\"); - s = endRegEx.Replace(s, ""); + s = endRegEx.Replace(s, string.Empty); return s; } diff --git a/src/qtprojectlib/ProjectImporter.cs b/src/qtprojectlib/ProjectImporter.cs index c71776ee..7032fc15 100644 --- a/src/qtprojectlib/ProjectImporter.cs +++ b/src/qtprojectlib/ProjectImporter.cs @@ -255,7 +255,7 @@ namespace QtProjectLib } if (!string.IsNullOrEmpty(rccQtDir)) return rccQtDir; - return ""; + return string.Empty; } private static string FindQtDirFromExtension(string content, string extension) diff --git a/src/qtprojectlib/QMakeProcess.cs b/src/qtprojectlib/QMakeProcess.cs index 6bcbe2a5..b95cb3d7 100644 --- a/src/qtprojectlib/QMakeProcess.cs +++ b/src/qtprojectlib/QMakeProcess.cs @@ -287,7 +287,7 @@ namespace QtProjectLib private string queryResult; public QMakeQuery(VersionInformation vi) - : base(null, "", false, vi) + : base(null, string.Empty, false, vi) { qtVersionInformation = vi; } @@ -338,7 +338,7 @@ namespace QtProjectLib var dashIndex = result.IndexOf('-'); if (dashIndex == -1) { errorValue = -1; - result = ""; + result = string.Empty; } else { result = result.Substring(dashIndex + 1).Trim(); } diff --git a/src/qtprojectlib/QtModules.cs b/src/qtprojectlib/QtModules.cs index 17007c68..4c5461d5 100644 --- a/src/qtprojectlib/QtModules.cs +++ b/src/qtprojectlib/QtModules.cs @@ -93,7 +93,7 @@ namespace QtProjectLib { private QtModule moduleId = QtModule.Invalid; public List<string> Defines = new List<string>(); - public string LibraryPrefix = ""; + public string LibraryPrefix = string.Empty; public bool HasDLL = true; public List<string> AdditionalLibraries = new List<string>(); public List<string> AdditionalLibrariesDebug = new List<string>(); @@ -216,7 +216,7 @@ namespace QtProjectLib InitQtModule(QtModule.XmlPatterns, "QtXmlPatterns", "QT_XMLPATTERNS_LIB"); moduleInfo = InitQtModule(QtModule.ScriptTools, "QtScriptTools", "QT_SCRIPTTOOLS_LIB"); moduleInfo = InitQtModule(QtModule.Designer, "QtDesigner", new string[] { "QDESIGNER_EXPORT_WIDGETS", "QT_DESIGNER_LIB" }); - moduleInfo = InitQtModule(QtModule.Main, "qtmain", ""); + moduleInfo = InitQtModule(QtModule.Main, "qtmain", string.Empty); moduleInfo.proVarQT = null; moduleInfo.HasDLL = false; moduleInfo.IncludePath = null; @@ -228,7 +228,7 @@ namespace QtProjectLib moduleInfo = InitQtModule(QtModule.Help, "QtHelp", "QT_HELP_LIB"); moduleInfo.proVarQT = null; moduleInfo.proVarCONFIG = "help"; - moduleInfo = InitQtModule(QtModule.WebKit, "QtWebKit", ""); + moduleInfo = InitQtModule(QtModule.WebKit, "QtWebKit", string.Empty); moduleInfo = InitQtModule(QtModule.Svg, "QtSvg", "QT_SVG_LIB"); @@ -244,7 +244,7 @@ namespace QtProjectLib moduleInfo.AdditionalLibraries.Add("Qt5AxBase.lib"); moduleInfo.AdditionalLibrariesDebug.Add("Qt5AxBased.lib"); - moduleInfo = InitQtModule(QtModule.ActiveQtC, "QtAxContainer", ""); + moduleInfo = InitQtModule(QtModule.ActiveQtC, "QtAxContainer", string.Empty); moduleInfo.HasDLL = false; moduleInfo.IncludePath = "$(QTDIR)\\include\\ActiveQt"; moduleInfo.AdditionalLibraries.Add("Qt5AxBase.lib"); diff --git a/src/qtprojectlib/QtProject.cs b/src/qtprojectlib/QtProject.cs index 0ce0b9f5..b232ff48 100644 --- a/src/qtprojectlib/QtProject.cs +++ b/src/qtprojectlib/QtProject.cs @@ -681,7 +681,7 @@ namespace QtProjectLib { // As .moc files are included, we should not add anything there if (!HelperFunctions.HasHeaderFileExtension(file.Name)) - return ""; + return string.Empty; string additionalMocOptions = "\"-f" + compiler.GetPrecompiledHeaderThrough().Replace('\\', '/') + "\" "; //Get mocDir without .\\ at the beginning of it @@ -923,7 +923,7 @@ namespace QtProjectLib // remove the moc option file commands { var rex = new Regex("^echo.+[.](moc|cpp)[.]inc\"\r\n", RegexOptions.Multiline); - cmdLine = rex.Replace(cmdLine, ""); + cmdLine = rex.Replace(cmdLine, string.Empty); } var m = System.Text.RegularExpressions.Regex.Match(cmdLine, @@ -1233,11 +1233,11 @@ namespace QtProjectLib var reg = new Regex("Moc'ing .+\\.\\.\\."); string addDepends = tool.AdditionalDependencies; addDepends = System.Text.RegularExpressions.Regex.Replace(addDepends, - @"(\S*moc.exe|""\S+:\\\.*moc.exe"")", ""); - addDepends = addDepends.Replace(file.RelativePath, ""); - tool.AdditionalDependencies = ""; - tool.Description = reg.Replace(tool.Description, ""); - tool.Description = tool.Description.Replace("MOC " + file.Name, ""); + @"(\S*moc.exe|""\S+:\\\.*moc.exe"")", string.Empty); + addDepends = addDepends.Replace(file.RelativePath, string.Empty); + tool.AdditionalDependencies = string.Empty; + tool.Description = reg.Replace(tool.Description, string.Empty); + tool.Description = tool.Description.Replace("MOC " + file.Name, string.Empty); var baseFileName = file.Name.Remove(file.Name.LastIndexOf('.')); string pattern = "(\"(.*\\\\" + GetMocFileName(file.FullPath) + ")\"|(\\S*" + GetMocFileName(file.FullPath) + "))"; @@ -1252,12 +1252,12 @@ namespace QtProjectLib outputMocFile = matchList[1].ToString(); } } - tool.Outputs = System.Text.RegularExpressions.Regex.Replace(tool.Outputs, pattern, "", - RegexOptions.Multiline | RegexOptions.IgnoreCase); + tool.Outputs = System.Text.RegularExpressions.Regex.Replace(tool.Outputs, + pattern, string.Empty, RegexOptions.Multiline | RegexOptions.IgnoreCase); tool.Outputs = System.Text.RegularExpressions.Regex.Replace(tool.Outputs, @"\s*;\s*;\s*", ";", RegexOptions.Multiline); tool.Outputs = System.Text.RegularExpressions.Regex.Replace(tool.Outputs, - @"(^\s*;|\s*;\s*$)", "", RegexOptions.Multiline); + @"(^\s*;|\s*;\s*$)", string.Empty, RegexOptions.Multiline); if (outputMocFile != null) { if (outputMocFile.StartsWith("\"", StringComparison.Ordinal)) @@ -1315,10 +1315,10 @@ namespace QtProjectLib return; foreach (VCFileConfiguration config in (IVCCollection) file.FileConfigurations) { var tool = HelperFunctions.GetCustomBuildTool(config); - tool.AdditionalDependencies = ""; - tool.Description = ""; - tool.CommandLine = ""; - tool.Outputs = ""; + tool.AdditionalDependencies = string.Empty; + tool.Description = string.Empty; + tool.CommandLine = string.Empty; + tool.Outputs = string.Empty; } RemoveUiHeaderFile(file); } @@ -1992,7 +1992,7 @@ namespace QtProjectLib string idc3 = "$(QTDIR)\\bin\\idc.exe \"$(TargetPath)\" /regserver"; tool.CommandLine = idc + "\r\n" + midl + "\r\n" + idc2 + "\r\n" + idc3; - tool.Description = ""; + tool.Description = string.Empty; var linker = (VCLinkerTool) ((IVCCollection) config.Tools).Item("VCLinkerTool"); var librarian = (VCLibrarianTool) ((IVCCollection) config.Tools).Item("VCLibrarianTool"); @@ -2962,7 +2962,7 @@ namespace QtProjectLib /// </summary> public void SetQtEnvironment(string qtVersion) { - SetQtEnvironment(qtVersion, ""); + SetQtEnvironment(qtVersion, string.Empty); } /// <summary> diff --git a/src/qtvstools/AddQtVersionDialog.cs b/src/qtvstools/AddQtVersionDialog.cs index f6e2de68..95c02795 100644 --- a/src/qtvstools/AddQtVersionDialog.cs +++ b/src/qtvstools/AddQtVersionDialog.cs @@ -238,7 +238,7 @@ namespace QtVsTools private void DataChanged(object sender, EventArgs e) { - errorLabel.Text = ""; + errorLabel.Text = string.Empty; errorTimer.Stop(); errorTimer.Start(); var name = nameBox.Text.Trim(); @@ -273,7 +273,7 @@ namespace QtVsTools try { var di = new System.IO.DirectoryInfo(pathBox.Text); if (!di.Exists) { - lastErrorString = ""; + lastErrorString = string.Empty; okButton.Enabled = false; return; } @@ -310,7 +310,7 @@ namespace QtVsTools } okButton.Enabled = !found; if (!found) - lastErrorString = ""; + lastErrorString = string.Empty; } private void browseButton_Click(object sender, EventArgs e) @@ -335,7 +335,7 @@ namespace QtVsTools } catch { } - return ""; + return string.Empty; } private static void SaveLastSelectedPath(string path) diff --git a/src/qtvstools/FormVSQtSettings.cs b/src/qtvstools/FormVSQtSettings.cs index a5b47282..83dd64d3 100644 --- a/src/qtvstools/FormVSQtSettings.cs +++ b/src/qtvstools/FormVSQtSettings.cs @@ -134,7 +134,7 @@ namespace QtVsTools else defaultCombo.Text = (string) defaultCombo.Items[0]; } else { - defaultCombo.Text = ""; + defaultCombo.Text = string.Empty; } } diff --git a/src/qtvstools/Translation.cs b/src/qtvstools/Translation.cs index 876156b5..42b1fcf4 100644 --- a/src/qtvstools/Translation.cs +++ b/src/qtvstools/Translation.cs @@ -174,7 +174,7 @@ namespace QtVsTools sw.WriteLine("CODECFORTR = " + codec); } - cmdLine = ""; + cmdLine = string.Empty; if (!string.IsNullOrEmpty(options)) cmdLine += options + " "; cmdLine += "\"" + temporaryProFile + "\""; diff --git a/src/qtwizard/ConsoleWizard.cs b/src/qtwizard/ConsoleWizard.cs index 119ba042..58363856 100644 --- a/src/qtwizard/ConsoleWizard.cs +++ b/src/qtwizard/ConsoleWizard.cs @@ -97,7 +97,7 @@ namespace QtProjectWizard replacements["$Keyword$"] = Resources.qtProjectKeyword; replacements["$ProjectGuid$"] = @"{B12702AD-ABFB-343A-A199-8E24837244A3}"; - replacements["$PlatformToolset$"] = version.Replace(".", ""); + replacements["$PlatformToolset$"] = version.Replace(".", string.Empty); } catch { try { Directory.Delete(replacements["$destinationdirectory$"]); diff --git a/src/qtwizard/CoreClassWizard.cs b/src/qtwizard/CoreClassWizard.cs index 408199d8..8a5af1ed 100644 --- a/src/qtwizard/CoreClassWizard.cs +++ b/src/qtwizard/CoreClassWizard.cs @@ -176,10 +176,10 @@ namespace QtProjectWizard QtProject.ReplaceTokenInFile(hppFile, "%BASECLASS%", data.BaseClass); if (string.IsNullOrEmpty(data.BaseClass)) { - QtProject.ReplaceTokenInFile(hppFile, "%BASEDECL%", ""); - QtProject.ReplaceTokenInFile(hppFile, "%BASECLASSINCLUDE%", ""); - QtProject.ReplaceTokenInFile(hppFile, "%Q_OBJECT%", ""); - QtProject.ReplaceTokenInFile(hppFile, "%CTORSIG%", ""); + QtProject.ReplaceTokenInFile(hppFile, "%BASEDECL%", string.Empty); + QtProject.ReplaceTokenInFile(hppFile, "%BASECLASSINCLUDE%", string.Empty); + QtProject.ReplaceTokenInFile(hppFile, "%Q_OBJECT%", string.Empty); + QtProject.ReplaceTokenInFile(hppFile, "%CTORSIG%", string.Empty); } else { QtProject.ReplaceTokenInFile(hppFile, "%BASEDECL%", " : public " + data.BaseClass); diff --git a/src/qtwizard/DesignerWizard.cs b/src/qtwizard/DesignerWizard.cs index bbf84db9..22d90304 100644 --- a/src/qtwizard/DesignerWizard.cs +++ b/src/qtwizard/DesignerWizard.cs @@ -199,7 +199,7 @@ namespace QtProjectWizard replacements["$Keyword$"] = Resources.qtProjectKeyword; replacements["$ProjectGuid$"] = @"{B12702AD-ABFB-343A-A199-8E24837244A3}"; - replacements["$PlatformToolset$"] = version.Replace(".", ""); + replacements["$PlatformToolset$"] = version.Replace(".", string.Empty); replacements["$classname$"] = data.ClassName; replacements["$baseclass$"] = data.BaseClass; diff --git a/src/qtwizard/GuiClassWizard.cs b/src/qtwizard/GuiClassWizard.cs index 513b9031..14c70b82 100644 --- a/src/qtwizard/GuiClassWizard.cs +++ b/src/qtwizard/GuiClassWizard.cs @@ -378,7 +378,7 @@ namespace QtProjectWizard QtProject.ReplaceTokenInFile(uiFile, "%CENTRAL_WIDGET%", "\r\n <widget class=\"QWidget\" name=\"widget\" />"); } else { - QtProject.ReplaceTokenInFile(uiFile, "%CENTRAL_WIDGET%", ""); + QtProject.ReplaceTokenInFile(uiFile, "%CENTRAL_WIDGET%", string.Empty); } return uiFile; diff --git a/src/qtwizard/GuiWizard.cs b/src/qtwizard/GuiWizard.cs index 16342442..c06bc4e8 100644 --- a/src/qtwizard/GuiWizard.cs +++ b/src/qtwizard/GuiWizard.cs @@ -129,7 +129,7 @@ namespace QtProjectWizard replacements["$Keyword$"] = Resources.qtProjectKeyword; replacements["$ProjectGuid$"] = @"{B12702AD-ABFB-343A-A199-8E24837244A3}"; - replacements["$PlatformToolset$"] = version.Replace(".", ""); + replacements["$PlatformToolset$"] = version.Replace(".", string.Empty); replacements["$classname$"] = data.ClassName; replacements["$baseclass$"] = data.BaseClass; diff --git a/src/qtwizard/LibraryWizard.cs b/src/qtwizard/LibraryWizard.cs index e9799acf..7985d9f5 100644 --- a/src/qtwizard/LibraryWizard.cs +++ b/src/qtwizard/LibraryWizard.cs @@ -183,7 +183,7 @@ namespace QtProjectWizard replacements["$Keyword$"] = Resources.qtProjectKeyword; replacements["$ProjectGuid$"] = @"{B12702AD-ABFB-343A-A199-8E24837244A3}"; - replacements["$PlatformToolset$"] = version.Replace(".", ""); + replacements["$PlatformToolset$"] = version.Replace(".", string.Empty); replacements["$classname$"] = data.ClassName; replacements["$sourcefilename$"] = data.ClassSourceFile; diff --git a/src/qtwizard/ServerWizard.cs b/src/qtwizard/ServerWizard.cs index c11af2db..008fb595 100644 --- a/src/qtwizard/ServerWizard.cs +++ b/src/qtwizard/ServerWizard.cs @@ -197,7 +197,7 @@ namespace QtProjectWizard replacements["$Keyword$"] = Resources.qtProjectKeyword; replacements["$ProjectGuid$"] = @"{B12702AD-ABFB-343A-A199-8E24837244A3}"; - replacements["$PlatformToolset$"] = version.Replace(".", ""); + replacements["$PlatformToolset$"] = version.Replace(".", string.Empty); replacements["$classname$"] = data.ClassName; replacements["$sourcefilename$"] = data.ClassSourceFile; |