Ejemplo n.º 1
0
 public static CppElementMappingRule Map <TCppElement>(this CppMappingRules dispatcher, string cppRegexName, [CallerFilePath] string mapOriginFilePath = null, [CallerLineNumber] int mapLineNumber = 0) where TCppElement : CppElement
 {
     return(new CppElementMappingRule(new CppElementTypeMatcher <TCppElement>(), new CppElementRegexMatcher(cppRegexName))
     {
         DeclarationFileName = mapOriginFilePath,
         DeclarationLineNumber = mapLineNumber
     });
 }
Ejemplo n.º 2
0
 public static CppMacroToConstMappingRule MapMacroToConst(this CppMappingRules dispatcher, string cppRegexMatchMacroName, string cppType, bool explicitCast = false, string enumItemName = null, [CallerFilePath] string mapOriginFilePath = null, [CallerLineNumber] int mapLineNumber = 0)
 {
     return(new CppMacroToConstMappingRule(new CppElementRegexMatcher(cppRegexMatchMacroName))
     {
         ConstFieldTypeName = cppType,
         ConstFieldName = enumItemName,
         DeclarationFileName = mapOriginFilePath,
         DeclarationLineNumber = mapLineNumber,
         ExplicitCast = explicitCast,
     });
 }
Ejemplo n.º 3
0
 public static void Tester()
 {
     var rules = new CppMappingRules()
     {
         e => e.Map("name").Private(),
         e => e.Map("xxx").Name("test").Private(),
         e => e.MapAll <CppEnumItem>().CppAction((converter, element) => {}),
         e => e.MapMacroToConst("MACRO", "int"),
         e => e.MapType("int", "SharpDX.Int4"),
         e => e.MapArrayType("int", 4, "SharpDX.Int4"),
     };
 }
Ejemplo n.º 4
0
 public static CppMacroToEnumMappingRule MapMacroToEnum(this CppMappingRules dispatcher, string cppRegexName, string cppEnumTypeName, string cppEnumItemName = null, string integerType = "int", bool explicitCast = false, [CallerFilePath] string mapOriginFilePath = null, [CallerLineNumber] int mapLineNumber = 0)
 {
     return(new CppMacroToEnumMappingRule(new CppElementRegexMatcher(cppRegexName))
     {
         CppEnumTypeName = cppEnumTypeName,
         CppEnumItemName = cppEnumItemName,
         CppIntegerTypeName = integerType,
         DeclarationFileName = mapOriginFilePath,
         DeclarationLineNumber = mapLineNumber,
         ExplicitCast = explicitCast,
     });
 }
Ejemplo n.º 5
0
        public CSharpConverterOptions()
        {
            Plugins = new List <ICSharpConverterPlugin>()
            {
                new DefaultCommentConverter(),
                new DefaultGetCSharpNamePlugin(),
                new DefaultContainerResolver(),
                new DefaultTypedefConverter(),
                new DefaultEnumConverter(),
                new DefaultEnumItemConverter(),
                new DefaultFunctionConverter(),
                new DefaultParameterConverter(),
                new DefaultInterfaceConverter(),
                new DefaultStructConverter(),
                new DefaultFieldConverter(),
                new DefaultFunctionTypeConverter(),
                new DefaultTypeConverter(),
                new DefaultDllImportConverter(),
                new DefaultMappingRulesConverter(),
            };

            MappingRules                     = new CppMappingRules();
            DefaultNamespace                 = "LibNative";
            DefaultOutputFilePath            = "/LibNative.generated.cs";
            DefaultClassLib                  = "libnative";
            DefaultDllImportNameAndArguments = "\"libnative\"";
            GenerateAsInternal               = false;
            GenerateEnumItemAsFields         = true;
            TypedefCodeGenKind               = CppTypedefCodeGenKind.Wrap;
            TypedefWrapWhiteList             = new HashSet <string>();
            Tags                    = new Dictionary <string, object>();
            DefaultCharSet          = CharSet.Ansi;
            AllowFixedSizeBuffers   = true;
            DefaultMarshalForString = new CSharpMarshalAttribute(CSharpUnmanagedKind.LPStr);
            DefaultMarshalForBool   = new CSharpMarshalAttribute(CSharpUnmanagedKind.U1);
        }
Ejemplo n.º 6
0
 public static CppElementMappingRule MapArrayType(this CppMappingRules dispatcher, string cppElementType, int arraySize, string csType, [CallerFilePath] string mapOriginFilePath = null, [CallerLineNumber] int mapLineNumber = 0)
 {
     throw new NotImplementedException();
 }