当前位置: 首页>>代码示例>>C#>>正文


C# TypedefType类代码示例

本文整理汇总了C#中TypedefType的典型用法代码示例。如果您正苦于以下问题:C# TypedefType类的具体用法?C# TypedefType怎么用?C# TypedefType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


TypedefType类属于命名空间,在下文中一共展示了TypedefType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: VisitTypedefType

        public override bool VisitTypedefType(TypedefType typedef,
            TypeQualifiers quals)
        {
            TypeMap typeMap;
            if (TypeMapDatabase.FindTypeMap(typedef, out typeMap)
                && typeMap.IsIgnored)
            {
                Ignore();
                return false;
            }

            return base.VisitTypedefType(typedef, quals);
        }
开发者ID:ddobrev,项目名称:CppSharp,代码行数:13,代码来源:Types.cs

示例2: TypedefType

 protected TypedefType(TypedefType.Internal* native, bool skipVTables = false)
     : base((CppSharp.Parser.AST.Type.Internal*) null)
 {
     __PointerAdjustment = 0;
     if (native == null)
         return;
     __Instance = new global::System.IntPtr(native);
 }
开发者ID:CSRedRat,项目名称:CppSharp,代码行数:8,代码来源:AST.cs

示例3: __CreateInstance

 public static TypedefType __CreateInstance(TypedefType.Internal native, bool skipVTables = false)
 {
     return new TypedefType(native, skipVTables);
 }
开发者ID:CSRedRat,项目名称:CppSharp,代码行数:4,代码来源:AST.cs

示例4: __CopyValue

 private static void* __CopyValue(TypedefType.__Internal native)
 {
     var ret = Marshal.AllocHGlobal(12);
     global::CppSharp.Parser.AST.TypedefType.__Internal.cctor_2(ret, new global::System.IntPtr(&native));
     return ret.ToPointer();
 }
开发者ID:ddobrev,项目名称:CppSharp,代码行数:6,代码来源:CppSharp.CppParser.cs

示例5: TypedefType

 internal TypedefType(TypedefType.Internal native)
     : this(&native)
 {
 }
开发者ID:kidleon,项目名称:CppSharp,代码行数:4,代码来源:AST.cs

示例6: VisitTypedefType

        public override bool VisitTypedefType(TypedefType typedef, TypeQualifiers quals)
        {
            var decl = typedef.Declaration;

            TypeMap typeMap;
            if (Context.Driver.TypeDatabase.FindTypeMap(decl, out typeMap) && typeMap.DoesMarshalling)
            {
                typeMap.CLIMarshalToNative(Context);
                return typeMap.IsValueType;
            }

            FunctionType func;
            if (decl.Type.IsPointerTo(out func))
            {
                // Use the original typedef name if available, otherwise just use the function pointer type
                string cppTypeName;
                if (!decl.IsSynthetized)
                    cppTypeName = "::" + typedef.Declaration.QualifiedOriginalName;
                else
                {
                    var cppTypePrinter = new CppTypePrinter(Context.Driver.TypeDatabase);
                    cppTypeName = decl.Type.Visit(cppTypePrinter, quals);
                }

                VisitDelegateType(func, cppTypeName);
                return true;
            }

            PrimitiveType primitive;
            if (decl.Type.IsPrimitiveType(out primitive))
            {
                Context.Return.Write("(::{0})", typedef.Declaration.QualifiedOriginalName);
            }

            return decl.Type.Visit(this);
        }
开发者ID:KonajuGames,项目名称:CppSharp,代码行数:36,代码来源:CLIMarshal.cs

示例7: TypedefType

 private TypedefType(TypedefType.Internal native)
     : this(__CopyValue(native))
 {
     __ownsNativeInstance = true;
     NativeToManagedMap[__Instance] = this;
 }
开发者ID:RainsSoft,项目名称:CppSharp,代码行数:6,代码来源:AST.cs

示例8: TypedefType

 internal TypedefType(TypedefType.Internal native)
     : this(__CopyValue(native))
 {
 }
开发者ID:vovkasm,项目名称:CppSharp,代码行数:4,代码来源:AST.cs

示例9: GetType

 protected AST.Type GetType(string typeName)
 {
     if (typeCache == null)
         typeCache = new Dictionary<string, AST.Type>();
     AST.Type result;
     if (!typeCache.TryGetValue(typeName, out result))
     {
         var typeDef = Driver.ASTContext.FindTypedef(typeName)
             .FirstOrDefault();
         if (typeDef != null)
             result = new TypedefType() { Declaration = typeDef };
         typeCache.Add(typeName, result);
     }
     return result;
 }
开发者ID:kitsilanosoftware,项目名称:CppSharp,代码行数:15,代码来源:ObjectOverridesPass.cs

示例10: VisitTypedefType

        public override bool VisitTypedefType(TypedefType typedef, TypeQualifiers quals)
        {
            if (!VisitType(typedef, quals))
                return false;

            var decl = typedef.Declaration;

            FunctionType function;
            if (decl.Type.IsPointerTo(out function))
            {
                var ptrName = Generator.GeneratedIdentifier("ptr") +
                    Context.ParameterIndex;

                Context.SupportBefore.WriteLine("var {0} = {1};", ptrName,
                    Context.ReturnVarName);

                Context.Return.Write("({1})Marshal.GetDelegateForFunctionPointer({0}, typeof({1}))",
                    ptrName, typedef.ToString());
                return true;
            }

            return decl.Type.Visit(this);
        }
开发者ID:fangsunjian,项目名称:CppSharp,代码行数:23,代码来源:CSharpMarshal.cs

示例11: CheckType

        /// <summary>
        /// Generates a new typedef for the given type if necessary and returns the new type.
        /// </summary>
        /// <param name="namespace">The namespace the typedef will be added to.</param>
        /// <param name="type">The type to check.</param>
        /// <returns>The new type.</returns>
        private QualifiedType CheckType(DeclarationContext @namespace, QualifiedType type)
        {
            if (type.Type.IsDependent)
                return type;

            var pointerType = type.Type as PointerType;
            if (pointerType == null)
                return type;

            var functionType = pointerType.Pointee as FunctionType;
            if (functionType == null)
                return type;

            List<Typedef> typedefs;
            if (!allTypedefs.TryGetValue(@namespace.QualifiedName, out typedefs))
            {
                typedefs = new List<Typedef>();
                allTypedefs.Add(@namespace.QualifiedName, typedefs);
            }

            var typedef = FindMatchingTypedef(typedefs, functionType);
            if (typedef == null)
            {
                for (int i = 0; i < functionType.Parameters.Count; i++)
                {
                    functionType.Parameters[i].Name = string.Format("_{0}", i);
                }

                typedef = new TypedefDecl
                {
                    Access = AccessSpecifier.Public,
                    Name = string.Format("__AnonymousDelegate{0}", typedefs.Count),
                    Namespace = @namespace,
                    QualifiedType = type,
                    IsSynthetized = true
                };
                typedefs.Add(new Typedef
                {
                    Context = @namespace,
                    Declaration = typedef
                });
            }

            var typedefType = new TypedefType
            {
                Declaration = typedef
            };
            return new QualifiedType(typedefType);
        }
开发者ID:ddobrev,项目名称:CppSharp,代码行数:55,代码来源:GenerateAnonymousDelegatesPass.cs

示例12: VisitTypedefType

        public override bool VisitTypedefType(TypedefType typedef, TypeQualifiers quals)
        {
            var decl = typedef.Declaration;

            TypeMap typeMap;
            if (Context.Driver.TypeDatabase.FindTypeMap(decl, out typeMap) && typeMap.DoesMarshalling)
            {
                typeMap.Type = typedef;
                typeMap.CLIMarshalToManaged(Context);
                return typeMap.IsValueType;
            }

            FunctionType function;
            if (decl.Type.IsPointerTo(out function))
            {
                Context.Return.Write("safe_cast<{0}>(", typedef);
                Context.Return.Write("System::Runtime::InteropServices::Marshal::");
                Context.Return.Write("GetDelegateForFunctionPointer(");
                Context.Return.Write("IntPtr({0}), {1}::typeid))",Context.ReturnVarName,
                    typedef.ToString().TrimEnd('^'));
                return true;
            }

            return decl.Type.Visit(this);
        }
开发者ID:corefan,项目名称:CppSharp,代码行数:25,代码来源:CLIMarshal.cs

示例13: __CreateInstance

 public static TypedefType __CreateInstance(TypedefType.Internal native)
 {
     return new TypedefType(native);
 }
开发者ID:RainsSoft,项目名称:CppSharp,代码行数:4,代码来源:AST.cs

示例14: __CopyValue

 private static TypedefType.Internal* __CopyValue(TypedefType.Internal native)
 {
     var ret = Marshal.AllocHGlobal(16);
     CppSharp.Parser.AST.TypedefType.Internal.cctor_2(ret, new global::System.IntPtr(&native));
     return (TypedefType.Internal*) ret;
 }
开发者ID:RainsSoft,项目名称:CppSharp,代码行数:6,代码来源:AST.cs

示例15: TypedefType

 private TypedefType(TypedefType.Internal native)
     : this(__CopyValue(native))
 {
     __ownsNativeInstance = true;
 }
开发者ID:KonajuGames,项目名称:CppSharp,代码行数:5,代码来源:AST.cs


注:本文中的TypedefType类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。