SetEnumeratedType() public method

Sets the attribute definition to have an enumerated value.
If the type parameter is not either or .
public SetEnumeratedType ( string enumValues, AttributeType type ) : void
enumValues string The possible values in the enumeration.
type AttributeType The type to set the attribute to.
return void
Esempio n. 1
0
        private void ParseAttType(char ch, AttDef attdef)
        {
            if (ch == '%')
            {
                Entity e = this.ParseParameterEntity(WhiteSpace);
                this.PushEntity(this.m_current.ResolvedUri, e);
                this.ParseAttType(this.m_current.Lastchar, attdef);
                this.PopEntity(); // bugbug - are we at the end of the entity?
                ch = this.m_current.Lastchar;
                return;
            }

            if (ch == '(')
            {
                //attdef.EnumValues = ParseNameGroup(ch, false);
                //attdef.Type = AttributeType.ENUMERATION;
                attdef.SetEnumeratedType(this.ParseNameGroup(ch, false), AttributeType.ENUMERATION);
            }
            else
            {
                string token = this.ScanName(WhiteSpace);
                if (string.Equals(token, "NOTATION", StringComparison.OrdinalIgnoreCase))
                {
                    ch = this.m_current.SkipWhitespace();
                    if (ch != '(')
                    {
                        this.m_current.Error("Expecting name group '(', but found '{0}'", ch);
                    }
                    //attdef.Type = AttributeType.NOTATION;
                    //attdef.EnumValues = ParseNameGroup(ch, true);
                    attdef.SetEnumeratedType(this.ParseNameGroup(ch, true), AttributeType.NOTATION);
                }
                else
                {
                    attdef.SetType(token);
                }
            }
        }