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


C# IType.StringLength方法代码示例

本文整理汇总了C#中IType.StringLength方法的典型用法代码示例。如果您正苦于以下问题:C# IType.StringLength方法的具体用法?C# IType.StringLength怎么用?C# IType.StringLength使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IType的用法示例。


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

示例1: WriteRttiClassInfoDefinition

        /// <summary>
        /// </summary>
        /// <param name="type">
        /// </param>
        /// <param name="llvmWriter">
        /// </param>
        public static void WriteRttiClassInfoDefinition(IType type, LlvmWriter llvmWriter)
        {
            var writer = llvmWriter.Output;

            writer.WriteLine("{");
            writer.Indent++;
            writer.WriteLine("i8* bitcast (i8** getelementptr inbounds (i8** @_ZTVN10__cxxabiv117__class_type_infoE, i32 2) to i8*),");
            writer.WriteLine("i8* getelementptr inbounds ([{1} x i8]* @\"{0}\", i32 0, i32 0)", type.GetRttiStringName(), type.StringLength());
            writer.Indent--;
            writer.WriteLine("}");
        }
开发者ID:SperoSophia,项目名称:il2bc,代码行数:17,代码来源:RttiClassWithNoBaseAndNoInterfaces.cs

示例2: WriteRttiClassInfoDefinition

        /// <summary>
        /// </summary>
        /// <param name="type">
        /// </param>
        /// <param name="llvmWriter">
        /// </param>
        public static void WriteRttiClassInfoDefinition(IType type, LlvmWriter llvmWriter)
        {
            var writer = llvmWriter.Output;

            writer.WriteLine("{");
            writer.Indent++;
            writer.WriteLine("i8* bitcast (i8** getelementptr inbounds (i8** @_ZTVN10__cxxabiv120__si_class_type_infoE, i32 2) to i8*),");
            writer.WriteLine("i8* getelementptr inbounds ([{1} x i8]* @\"{0}\", i32 0, i32 0),", type.GetRttiStringName(), type.StringLength());
            writer.Write("i8* bitcast (");

            var singleInheritanceType = type.GetInterfaces().First();

            singleInheritanceType.WriteRttiClassInfoDeclaration(writer);
            writer.WriteLine("* @\"{0}\" to i8*)", singleInheritanceType.GetRttiInfoName());
            writer.Indent--;
            writer.WriteLine("}");
        }
开发者ID:SperoSophia,项目名称:il2bc,代码行数:23,代码来源:RttiClassWithNoBaseAndSingleInterface.cs

示例3: WriteRttiClassInfoDefinition

        /// <summary>
        /// </summary>
        /// <param name="type">
        /// </param>
        /// <param name="llvmWriter">
        /// </param>
        public static void WriteRttiClassInfoDefinition(IType type, LlvmWriter llvmWriter)
        {
            var writer = llvmWriter.Output;

            var @interfaces = type.GetInterfaces();

            writer.WriteLine("{");
            writer.Indent++;
            writer.WriteLine(
                "i8* bitcast (i8** getelementptr inbounds (i8** @_ZTVN10__cxxabiv121__vmi_class_type_infoE, i32 2) to i8*),");
            writer.WriteLine(
                "i8* getelementptr inbounds ([{1} x i8]* @\"{0}\", i32 0, i32 0),",
                type.GetRttiStringName(),
                type.StringLength());
            writer.WriteLine("i32 0,");
            writer.WriteLine("i32 {0}", @interfaces.Count() + (type.BaseType != null ? 1 : 0));

            var nextFlag = 2;

            if (type.BaseType != null)
            {
                writer.Write(",i8* bitcast (");
                type.BaseType.WriteRttiClassInfoDeclaration(writer);
                writer.WriteLine("* @\"{0}\" to i8*),", type.BaseType.GetRttiInfoName());

                // if class does not have any virtual method then next value should be 0, else 2 (and next class should be +1024)
                writer.WriteLine("i32 {0}", nextFlag);

                // apply fields shift + base item
                // nextFlag += 1024 * (type.BaseType.GetFieldsShift() + 1);
                nextFlag += 1024 * (type.BaseType.GetTypeSize(llvmWriter) / LlvmWriter.PointerSize);
            }

            foreach (var @interface in type.GetInterfaces())
            {
                writer.Write(",i8* bitcast (");
                @interface.WriteRttiClassInfoDeclaration(writer);
                writer.WriteLine("* @\"{0}\" to i8*),", @interface.GetRttiInfoName());
                writer.WriteLine("i32 {0}", nextFlag);
                nextFlag += 1024;
            }

            writer.Indent--;
            writer.WriteLine("}");
        }
开发者ID:afrog33k,项目名称:csnative,代码行数:51,代码来源:RttiClassWithBaseAndInterfaces.cs


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