Browse Source

Add C code generator GenerateClassEvents for common event handling.

pull/1580/head
Joao Matos 4 years ago
parent
commit
31c2bdb087
  1. 12
      src/Generator/Generators/C/CCodeGenerator.cs
  2. 2
      src/Generator/Generators/C/CppHeaders.cs
  3. 2
      src/Generator/Generators/CLI/CLIHeaders.cs
  4. 2
      src/Generator/Generators/CodeGenerator.cs
  5. 5
      src/Generator/Generators/QuickJS/QuickJSHeaders.cs

12
src/Generator/Generators/C/CCodeGenerator.cs

@ -312,6 +312,18 @@ namespace CppSharp.Generators.C @@ -312,6 +312,18 @@ namespace CppSharp.Generators.C
return true;
}
public virtual void GenerateClassEvents(Class @class)
{
Indent();
foreach (var @event in @class.Events)
{
if (!@event.IsGenerated) continue;
@event.Visit(this);
}
Unindent();
}
public virtual string GetMethodIdentifier(Function function,
TypePrinterContextKind context = TypePrinterContextKind.Managed)
{

2
src/Generator/Generators/C/CppHeaders.cs

@ -490,7 +490,7 @@ namespace CppSharp.Generators.Cpp @@ -490,7 +490,7 @@ namespace CppSharp.Generators.Cpp
return true;
}
public void GenerateClassEvents(Class @class)
public override void GenerateClassEvents(Class @class)
{
Indent();

2
src/Generator/Generators/CLI/CLIHeaders.cs

@ -462,7 +462,7 @@ namespace CppSharp.Generators.CLI @@ -462,7 +462,7 @@ namespace CppSharp.Generators.CLI
PopBlock();
}
public void GenerateClassEvents(Class @class)
public override void GenerateClassEvents(Class @class)
{
foreach (var @event in @class.Events)
{

2
src/Generator/Generators/CodeGenerator.cs

@ -398,7 +398,7 @@ namespace CppSharp.Generators @@ -398,7 +398,7 @@ namespace CppSharp.Generators
public virtual bool VisitEvent(Event @event)
{
throw new NotImplementedException();
return true;
}
public virtual bool VisitProperty(Property property)

5
src/Generator/Generators/QuickJS/QuickJSHeaders.cs

@ -47,5 +47,10 @@ namespace CppSharp.Generators.Cpp @@ -47,5 +47,10 @@ namespace CppSharp.Generators.Cpp
return true;
}
public override bool VisitEvent(Event @event)
{
return true;
}
}
}

Loading…
Cancel
Save