mirror of https://github.com/mono/CppSharp.git
14 changed files with 148 additions and 54 deletions
@ -1,9 +0,0 @@ |
|||||||
QObject |
|
||||||
QApplication |
|
||||||
QCoreApplication |
|
||||||
QWidget |
|
||||||
QAbstractButton |
|
||||||
QPushButton |
|
||||||
QPaintDevice |
|
||||||
QString |
|
||||||
QSize |
|
@ -0,0 +1,27 @@ |
|||||||
|
<!-- |
||||||
|
This XML filter file format. |
||||||
|
|
||||||
|
There are 3 different modes: |
||||||
|
Include -> include this type in the generated output |
||||||
|
Exclude -> do not include this type in the generated output. methods using this type will be removed (virtual methods will be stubbed with IntPtr) |
||||||
|
External -> do not include this type in the generated output, but expect an implementation to be provided |
||||||
|
The type of external implementation can be specified: |
||||||
|
class (default) -> this type is implemented as a managed reference type |
||||||
|
struct -> this type is implemented as a managed value type. when passed as pointer or reference, the managed "ref" prefix will be used |
||||||
|
|
||||||
|
|
||||||
|
The default behavior is Include. Change the default by specifying the default attribute on the top-level Filter tag. |
||||||
|
Specify exceptions to the default behavior with child nodes named after one of the modes above… |
||||||
|
--> |
||||||
|
|
||||||
|
<Filter default="Exclude"> |
||||||
|
<Include>QObject</Include> |
||||||
|
<Include>QApplication</Include> |
||||||
|
<Include>QCoreApplication</Include> |
||||||
|
<Include>QWidget</Include> |
||||||
|
<Include>QAbstractButton</Include> |
||||||
|
<Include>QPushButton</Include> |
||||||
|
<Include>QPaintDevice</Include> |
||||||
|
<External implementation="struct">QString</External> |
||||||
|
<External implementation="struct">QSize</External> |
||||||
|
</Filter> |
@ -0,0 +1,20 @@ |
|||||||
|
using System; |
||||||
|
using System.Runtime.InteropServices; |
||||||
|
using Mono.Cxxi; |
||||||
|
|
||||||
|
namespace Qt.Gui { |
||||||
|
public partial class QPushButton { |
||||||
|
|
||||||
|
public QPushButton (QString text, QWidget parent) |
||||||
|
: this (ref text, parent) |
||||||
|
{ |
||||||
|
} |
||||||
|
|
||||||
|
public QPushButton (QString text) |
||||||
|
: this (ref text, null) |
||||||
|
{ |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
|
|
@ -0,0 +1,36 @@ |
|||||||
|
using System; |
||||||
|
using System.Linq; |
||||||
|
using System.Xml.Linq; |
||||||
|
using System.Collections.Generic; |
||||||
|
|
||||||
|
public enum FilterMode { |
||||||
|
Include, |
||||||
|
Exclude, |
||||||
|
External |
||||||
|
} |
||||||
|
|
||||||
|
public enum ImplementationType { |
||||||
|
@class, |
||||||
|
@struct |
||||||
|
} |
||||||
|
|
||||||
|
public struct Filter { |
||||||
|
|
||||||
|
public string TypeName { get; set; } |
||||||
|
public FilterMode Mode { get; set; } |
||||||
|
public ImplementationType ImplType { get; set; } |
||||||
|
|
||||||
|
public static Dictionary<string, Filter> Load (XDocument doc, out FilterMode @default) |
||||||
|
{ |
||||||
|
string value; |
||||||
|
@default = (value = (string)doc.Root.Attribute ("default")) != null ? (FilterMode)Enum.Parse (typeof (FilterMode), value) : FilterMode.Include; |
||||||
|
|
||||||
|
var rules = from rule in doc.Root.Elements () |
||||||
|
let mode = (FilterMode)Enum.Parse (typeof (FilterMode), rule.Name.LocalName) |
||||||
|
let impl = (value = (string)rule.Attribute ("implementation")) != null ? (ImplementationType)Enum.Parse (typeof (ImplementationType), value) : ImplementationType.@class |
||||||
|
select new Filter { TypeName = rule.Value, Mode = mode, ImplType = impl }; |
||||||
|
|
||||||
|
|
||||||
|
return rules.ToDictionary<Filter,string> (r => r.TypeName); |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue