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


C# TextGenerator类代码示例

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


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

示例1: GenerateBuilderMembers

 public void GenerateBuilderMembers(TextGenerator writer)
 {
     // Note:  We can return the original list here, because we make it unmodifiable when we build
       writer.WriteLine("public scg::IList<{0}> {1}List {{", TypeName, PropertyName);
       writer.WriteLine("  get {{ return result.{0}_; }}", Name);
       writer.WriteLine("}");
       writer.WriteLine("public int {0}Count {{", PropertyName);
       writer.WriteLine("  get {{ return result.{0}Count; }}", PropertyName);
       writer.WriteLine("}");
       writer.WriteLine("public {0} Get{1}(int index) {{", TypeName, PropertyName);
       writer.WriteLine("  return result.Get{0}(index);", PropertyName);
       writer.WriteLine("}");
       writer.WriteLine("public Builder Set{0}(int index, {1} value) {{", PropertyName, TypeName);
       AddNullCheck(writer);
       writer.WriteLine("  result.{0}_[index] = value;", Name);
       writer.WriteLine("  return this;");
       writer.WriteLine("}");
       writer.WriteLine("public Builder Add{0}({1} value) {{", PropertyName, TypeName);
       AddNullCheck(writer);
       writer.WriteLine("  result.{0}_.Add(value);", Name, TypeName);
       writer.WriteLine("  return this;");
       writer.WriteLine("}");
       writer.WriteLine("public Builder AddRange{0}(scg::IEnumerable<{1}> values) {{", PropertyName, TypeName);
       writer.WriteLine("  base.AddRange(values, result.{0}_);", Name);
       writer.WriteLine("  return this;");
       writer.WriteLine("}");
       writer.WriteLine("public Builder Clear{0}() {{", PropertyName);
       writer.WriteLine("  result.{0}_.Clear();", Name);
       writer.WriteLine("  return this;");
       writer.WriteLine("}");
 }
开发者ID:nuirnr01,项目名称:dotnet-protobufs,代码行数:31,代码来源:RepeatedPrimitiveFieldGenerator.cs

示例2: GenerateSerializedSizeCode

 public void GenerateSerializedSizeCode(TextGenerator writer)
 {
     writer.WriteLine("if (Has{0}) {{", PropertyName);
       writer.WriteLine("  size += pb::CodedOutputStream.Compute{0}Size({1}, {2});",
       CapitalizedTypeName, Number, PropertyName);
       writer.WriteLine("}");
 }
开发者ID:nuirnr01,项目名称:dotnet-protobufs,代码行数:7,代码来源:PrimitiveFieldGenerator.cs

示例3: GenerateBuilderMembers

 public void GenerateBuilderMembers(TextGenerator writer)
 {
     AddDeprecatedFlag(writer);
     writer.WriteLine("public bool Has{0} {{", PropertyName);
     writer.WriteLine(" get {{ return result.has{0}; }}", PropertyName);
     writer.WriteLine("}");
     AddPublicMemberAttributes(writer);
     writer.WriteLine("public {0} {1} {{", TypeName, PropertyName);
     writer.WriteLine("  get {{ return result.{0}; }}", PropertyName);
     writer.WriteLine("  set {{ Set{0}(value); }}", PropertyName);
     writer.WriteLine("}");
     AddPublicMemberAttributes(writer);
     writer.WriteLine("public Builder Set{0}({1} value) {{", PropertyName, TypeName);
     writer.WriteLine("  PrepareBuilder();");
     writer.WriteLine("  result.has{0} = true;", PropertyName);
     writer.WriteLine("  result.{0}_ = value;", Name);
     writer.WriteLine("  return this;");
     writer.WriteLine("}");
     AddDeprecatedFlag(writer);
     writer.WriteLine("public Builder Clear{0}() {{", PropertyName);
     writer.WriteLine("  PrepareBuilder();");
     writer.WriteLine("  result.has{0} = false;", PropertyName);
     writer.WriteLine("  result.{0}_ = {1};", Name, DefaultValue);
     writer.WriteLine("  return this;");
     writer.WriteLine("}");
 }
开发者ID:ZhouX1ang,项目名称:protobuf-csharp-port,代码行数:26,代码来源:EnumFieldGenerator.cs

示例4: GenerateBuilderMembers

 public void GenerateBuilderMembers(TextGenerator writer)
 {
     // Note:  We can return the original list here, because we make it unmodifiable when we build
       // We return it via IPopsicleList so that collection initializers work more pleasantly.
       writer.WriteLine("public pbc::IPopsicleList<{0}> {1}List {{", TypeName, PropertyName);
       writer.WriteLine("  get {{ return result.{0}_; }}", Name);
       writer.WriteLine("}");
       writer.WriteLine("public int {0}Count {{", PropertyName);
       writer.WriteLine("  get {{ return result.{0}Count; }}", PropertyName);
       writer.WriteLine("}");
       writer.WriteLine("public {0} Get{1}(int index) {{", TypeName, PropertyName);
       writer.WriteLine("  return result.Get{0}(index);", PropertyName);
       writer.WriteLine("}");
       writer.WriteLine("public Builder Set{0}(int index, {1} value) {{", PropertyName, TypeName);
       writer.WriteLine("  result.{0}_[index] = value;", Name);
       writer.WriteLine("  return this;");
       writer.WriteLine("}");
       writer.WriteLine("public Builder Add{0}({1} value) {{", PropertyName, TypeName);
       writer.WriteLine("  result.{0}_.Add(value);", Name, TypeName);
       writer.WriteLine("  return this;");
       writer.WriteLine("}");
       writer.WriteLine("public Builder AddRange{0}(scg::IEnumerable<{1}> values) {{", PropertyName, TypeName);
       writer.WriteLine("  base.AddRange(values, result.{0}_);", Name);
       writer.WriteLine("  return this;");
       writer.WriteLine("}");
       writer.WriteLine("public Builder Clear{0}() {{", PropertyName);
       writer.WriteLine("  result.{0}_.Clear();", Name);
       writer.WriteLine("  return this;");
       writer.WriteLine("}");
 }
开发者ID:ayende,项目名称:dotnet-protobufs,代码行数:30,代码来源:RepeatedEnumFieldGenerator.cs

示例5: CSharpMarshalContext

 public CSharpMarshalContext(Driver driver)
     : base(driver)
 {
     Kind = CSharpMarshalKind.Unknown;
     ArgumentPrefix = new TextGenerator();
     Cleanup = new TextGenerator();
 }
开发者ID:fangsunjian,项目名称:CppSharp,代码行数:7,代码来源:CSharpMarshal.cs

示例6: MarshalContext

 public MarshalContext(Driver driver)
 {
     Driver = driver;
     SupportBefore = new TextGenerator();
     Return = new TextGenerator();
     MarshalVarPrefix = string.Empty;
 }
开发者ID:kitsilanosoftware,项目名称:CppSharp,代码行数:7,代码来源:Marshal.cs

示例7: WriteNamespaces

 internal static void WriteNamespaces(TextGenerator writer)
 {
     writer.WriteLine("using pb = global::Google.ProtocolBuffers;");
       writer.WriteLine("using pbc = global::Google.ProtocolBuffers.Collections;");
       writer.WriteLine("using pbd = global::Google.ProtocolBuffers.Descriptors;");
       writer.WriteLine("using scg = global::System.Collections.Generic;");
 }
开发者ID:ayende,项目名称:dotnet-protobufs,代码行数:7,代码来源:Helpers.cs

示例8: GenerateBuilderMembers

 public void GenerateBuilderMembers(TextGenerator writer)
 {
     // Note:  We can return the original list here, because we make it unmodifiable when we build
     // We return it via IPopsicleList so that collection initializers work more pleasantly.
     AddDeprecatedFlag(writer);
     writer.WriteLine("public pbc::IPopsicleList<{0}> {1}List {{", TypeName, PropertyName);
     writer.WriteLine("  get {{ return PrepareBuilder().{0}_; }}", Name);
     writer.WriteLine("}");
     AddDeprecatedFlag(writer);
     writer.WriteLine("public int {0}Count {{", PropertyName);
     writer.WriteLine("  get {{ return result.{0}Count; }}", PropertyName);
     writer.WriteLine("}");
     AddDeprecatedFlag(writer);
     writer.WriteLine("public {0} Get{1}(int index) {{", TypeName, PropertyName);
     writer.WriteLine("  return result.Get{0}(index);", PropertyName);
     writer.WriteLine("}");
     AddDeprecatedFlag(writer);
     writer.WriteLine("public Builder Set{0}(int index, {1} value) {{", PropertyName, TypeName);
     AddNullCheck(writer);
     writer.WriteLine("  PrepareBuilder();");
     writer.WriteLine("  result.{0}_[index] = value;", Name);
     writer.WriteLine("  return this;");
     writer.WriteLine("}");
     // Extra overload for builder (just on messages)
     AddDeprecatedFlag(writer);
     writer.WriteLine("public Builder Set{0}(int index, {1}.Builder builderForValue) {{", PropertyName, TypeName);
     AddNullCheck(writer, "builderForValue");
     writer.WriteLine("  PrepareBuilder();");
     writer.WriteLine("  result.{0}_[index] = builderForValue.Build();", Name);
     writer.WriteLine("  return this;");
     writer.WriteLine("}");
     AddDeprecatedFlag(writer);
     writer.WriteLine("public Builder Add{0}({1} value) {{", PropertyName, TypeName);
     AddNullCheck(writer);
     writer.WriteLine("  PrepareBuilder();");
     writer.WriteLine("  result.{0}_.Add(value);", Name, TypeName);
     writer.WriteLine("  return this;");
     writer.WriteLine("}");
     // Extra overload for builder (just on messages)
     AddDeprecatedFlag(writer);
     writer.WriteLine("public Builder Add{0}({1}.Builder builderForValue) {{", PropertyName, TypeName);
     AddNullCheck(writer, "builderForValue");
     writer.WriteLine("  PrepareBuilder();");
     writer.WriteLine("  result.{0}_.Add(builderForValue.Build());", Name);
     writer.WriteLine("  return this;");
     writer.WriteLine("}");
     AddDeprecatedFlag(writer);
     writer.WriteLine("public Builder AddRange{0}(scg::IEnumerable<{1}> values) {{", PropertyName, TypeName);
     writer.WriteLine("  PrepareBuilder();");
     writer.WriteLine("  result.{0}_.Add(values);", Name);
     writer.WriteLine("  return this;");
     writer.WriteLine("}");
     AddDeprecatedFlag(writer);
     writer.WriteLine("public Builder Clear{0}() {{", PropertyName);
     writer.WriteLine("  PrepareBuilder();");
     writer.WriteLine("  result.{0}_.Clear();", Name);
     writer.WriteLine("  return this;");
     writer.WriteLine("}");
 }
开发者ID:ZhouX1ang,项目名称:protobuf-csharp-port,代码行数:59,代码来源:RepeatedMessageFieldGenerator.cs

示例9: Block

 public Block(int kind)
 {
     Kind = kind;
     Blocks = new List<Block>();
     Text = new TextGenerator();
     hasIndentChanged = false;
     isSubBlock = false;
 }
开发者ID:ddobrev,项目名称:CppSharp,代码行数:8,代码来源:Template.cs

示例10: GenerateMembers

 public void GenerateMembers(TextGenerator writer) {
   writer.WriteLine("private bool has{0};", PropertyName);
   writer.WriteLine("private {0} {1}_ = {2};", TypeName, Name, DefaultValue);
   writer.WriteLine("public bool Has{0} {{", PropertyName);
   writer.WriteLine("  get {{ return has{0}; }}", PropertyName);
   writer.WriteLine("}");
   writer.WriteLine("public {0} {1} {{", TypeName, PropertyName);
   writer.WriteLine("  get {{ return {0}_; }}", Name);
   writer.WriteLine("}");
 }
开发者ID:huawuzui,项目名称:HBNews,代码行数:10,代码来源:MessageFieldGenerator.cs

示例11: CompanyMakerState

 public CompanyMakerState(DwarfGame game, GameStateManager stateManager)
     : base(game, "CompanyMakerState", stateManager)
 {
     CompanyName = DefaultName;
     CompanyMotto = DefaultMotto;
     CompanyLogo = DefaultLogo;
     CompanyColor = DefaultColor;
     EdgePadding = 32;
     Input = new InputManager();
     Drawer = new Drawer2D(Game.Content, Game.GraphicsDevice);
     TextGenerator = new TextGenerator();
 }
开发者ID:scorvi,项目名称:dwarfcorp,代码行数:12,代码来源:CompanyMakerState.cs

示例12: LayoutText

    public virtual void LayoutText(string content)
    {
        this.content = content.Trim();
        Canvas.ForceUpdateCanvases();

        TextGenerator generator = new TextGenerator();
        TextGenerationSettings settings = text.GetGenerationSettings(new Vector2(rectTransform.sizeDelta.x, 0));
        settings.updateBounds = true;
        settings.scaleFactor = 1;
        generator.Populate(content, settings);
        layoutElement.preferredHeight = generator.rectExtents.height;
    }
开发者ID:Giesch,项目名称:the-intercept,代码行数:12,代码来源:StoryElementView.cs

示例13: GenerateMembers

 public void GenerateMembers(TextGenerator writer)
 {
     writer.WriteLine("private bool has{0};", PropertyName);
     writer.WriteLine("private {0} {1}_{2};", TypeName, Name, HasDefaultValue ? " = " + DefaultValue : "");
     AddDeprecatedFlag(writer);
     writer.WriteLine("public bool Has{0} {{", PropertyName);
     writer.WriteLine("  get {{ return has{0}; }}", PropertyName);
     writer.WriteLine("}");
     AddPublicMemberAttributes(writer);
     writer.WriteLine("public {0} {1} {{", TypeName, PropertyName);
     writer.WriteLine("  get {{ return {0}_; }}", Name);
     writer.WriteLine("}");
 }
开发者ID:ZhouX1ang,项目名称:protobuf-csharp-port,代码行数:13,代码来源:PrimitiveFieldGenerator.cs

示例14: GenerateParsingCode

 public void GenerateParsingCode(TextGenerator writer)
 {
     // TODO(jonskeet): Make a more efficient way of doing this
       writer.WriteLine("int rawValue = input.ReadEnum();");
       writer.WriteLine("if (!global::System.Enum.IsDefined(typeof({0}), rawValue)) {{", TypeName);
       writer.WriteLine("  if (unknownFields == null) {"); // First unknown field - create builder now
       writer.WriteLine("    unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields);");
       writer.WriteLine("  }");
       writer.WriteLine("  unknownFields.MergeVarintField({0}, (ulong) rawValue);", Number);
       writer.WriteLine("} else {");
       writer.WriteLine("  {0} = ({1}) rawValue;", PropertyName, TypeName);
       writer.WriteLine("}");
 }
开发者ID:nuirnr01,项目名称:dotnet-protobufs,代码行数:13,代码来源:EnumFieldGenerator.cs

示例15: GenerateParsingCode

 public void GenerateParsingCode(TextGenerator writer)
 {
     writer.WriteLine("{0}.Builder subBuilder = {0}.CreateBuilder();", TypeName);
       writer.WriteLine("if (Has{0}) {{", PropertyName);
       writer.WriteLine("  subBuilder.MergeFrom({0});", PropertyName);
       writer.WriteLine("}");
       if (Descriptor.FieldType == FieldType.Group) {
     writer.WriteLine("input.ReadGroup({0}, subBuilder, extensionRegistry);", Number);
       } else {
     writer.WriteLine("input.ReadMessage(subBuilder, extensionRegistry);");
       }
       writer.WriteLine("{0} = subBuilder.BuildPartial();", PropertyName);
 }
开发者ID:nuirnr01,项目名称:dotnet-protobufs,代码行数:13,代码来源:MessageFieldGenerator.cs


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