Ejemplo n.º 1
0
        private static void SaveEnumeration(EnumerationDef enumerationDef, CodeWriter writer)
        {
            SaveComments(enumerationDef, writer);
            SaveDecorators(enumerationDef, writer);

            writer.Write("enum {0} : {1} {{", enumerationDef.Name, enumerationDef.UnderlyingType);
            writer.Indent();

            if (enumerationDef.Members.Count > 0)
            {
                writer.NewLine();
                for (Int32 index = 0; index < enumerationDef.Members.Count; index += 1)
                {
                    EnumerationMemberDef memberDef = enumerationDef.Members[index];
                    SaveComments(memberDef, writer);
                    SaveDecorators(memberDef, writer);

                    writer.WriteLine("{0} = {1};", memberDef.Name, memberDef.Value);
                    if (index + 1 < enumerationDef.Members.Count)
                    {
                        writer.NewLine();
                    }
                }
            }

            writer.Dedent();
            writer.WriteLine("}");
        }
Ejemplo n.º 2
0
        internal EnumerationMemberDef([NotNull] EnumerationDef owner, [NotNull] String name, [CanBeNull, ItemNotNull] List <String> comments = null)
            : base(name, comments)
        {
            Owner = owner;

            FullName = $"{owner.FullName}.{Name}";

            owner.Members.Add(this);
        }
Ejemplo n.º 3
0
        public EnumerationMemberDef([NotNull] EnumerationDef owner, [NotNull] String name, [NotNull] LiteralInteger value, [CanBeNull, ItemNotNull] List <String> comments = null)
            : base(name, comments)
        {
            Value = value;
            Owner = owner;

            FullName = $"{owner.FullName}.{Name}";

            owner.Members.Add(this);
        }
Ejemplo n.º 4
0
 public TypeEnumeration(EnumerationDef definition)
     : base(TypeKind.Enumeration)
 {
     Definition = definition;
 }