Browse Source

Misc changes

pull/1918/head
duckdoom5 4 months ago
parent
commit
277dc5c2ac
  1. 1
      CppSharp.sln.DotSettings
  2. 22
      src/CppParser/Bootstrap/CodeGeneratorHelpers.cs
  3. 2
      src/Generator/Generators/CSharp/CSharpTypePrinter.cs

1
CppSharp.sln.DotSettings

@ -1,5 +1,6 @@ @@ -1,5 +1,6 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=CLI/@EntryIndexedValue">CLI</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=MD/@EntryIndexedValue">MD</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=MSVC/@EntryIndexedValue">MSVC</s:String>
<s:Boolean x:Key="/Default/UserDictionary/Words/=diag/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=undefine/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

22
src/CppParser/Bootstrap/CodeGeneratorHelpers.cs

@ -47,8 +47,7 @@ namespace CppSharp @@ -47,8 +47,7 @@ namespace CppSharp
return true;
}
if (property.Name is "beginLoc" or "endLoc" &&
@class.Name != "Stmt")
if (property.Name is "beginLoc" or "endLoc" && @class.Name != "Stmt")
return true;
switch (property.Name)
@ -319,11 +318,13 @@ namespace CppSharp @@ -319,11 +318,13 @@ namespace CppSharp
private static string CleanClangNamespaceFromName(string qualifiedName)
{
qualifiedName = qualifiedName.StartsWith("clang::") ?
qualifiedName.Substring("clang::".Length) : qualifiedName;
qualifiedName = qualifiedName.StartsWith("clang::")
? qualifiedName.Substring("clang::".Length)
: qualifiedName;
qualifiedName = qualifiedName.StartsWith("clang.") ?
qualifiedName.Substring("clang.".Length) : qualifiedName;
qualifiedName = qualifiedName.StartsWith("clang.")
? qualifiedName.Substring("clang.".Length)
: qualifiedName;
return qualifiedName;
}
@ -392,7 +393,8 @@ namespace CppSharp @@ -392,7 +393,8 @@ namespace CppSharp
if (typeResult.Type.Contains("MSGuidDecl"))
return typePrinter is CppTypePrinter
? "std::string" : "string";
? "std::string"
: "string";
var typeName = typeResult.ToString();
typeName = CleanClangNamespaceFromName(typeName);
@ -436,8 +438,7 @@ namespace CppSharp @@ -436,8 +438,7 @@ namespace CppSharp
className = "Declaration";
if (className != null)
return (typePrinter is CppTypePrinter) ?
$"{className}*" : className;
return (typePrinter is CppTypePrinter) ? $"{className}*" : className;
return typeName;
}
@ -525,8 +526,7 @@ namespace CppSharp @@ -525,8 +526,7 @@ namespace CppSharp
while (currentClass != null)
{
baseClasses.Add(currentClass);
currentClass = currentClass.HasBaseClass ?
currentClass.BaseClass : null;
currentClass = currentClass.HasBaseClass ? currentClass.BaseClass : null;
}
baseClasses.Reverse();

2
src/Generator/Generators/CSharp/CSharpTypePrinter.cs

@ -315,7 +315,7 @@ namespace CppSharp.Generators.CSharp @@ -315,7 +315,7 @@ namespace CppSharp.Generators.CSharp
TemplateArgument lastArg = args.Last();
TypePrinterResult typePrinterResult = VisitDeclaration(decl);
typePrinterResult.NameSuffix.Append($@"<{string.Join(", ",
args.Concat(Enumerable.Range(0, @class.TemplateParameters.Count - args.Count).Select(
args.Concat(Enumerable.Range(0, @class.TemplateParameters?.Count ?? 0 - args.Count).Select(
i => lastArg)).Select(this.VisitTemplateArgument))}>");
return typePrinterResult;
}

Loading…
Cancel
Save