/// <summary>
 /// Constructor
 /// </summary>
 /// <param name="name">Name of the entry</param>
 /// <param name="types">The list of types this member can choose from</param>
 public SequenceChoiceMemberEntry(string name, IEnumerable <SequenceParserType> types)
     : base(name, new SequenceParserType("DUMMY"))
 {
     _choices   = new SequenceChoice[0];
     _reference = new MemberEntryReference(this, typeof(MemberEntry));
     _types     = types;
 }
Beispiel #2
0
        /// <summary>
        /// Get list of standard values
        /// </summary>
        /// <param name="context">Converter context</param>
        /// <returns>The list of standard values</returns>
        public override TypeConverter.StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
        {
            List <string> names = new List <string>();

            MemberEntry          entry     = context.Instance as MemberEntry;
            MemberEntryReference memberRef = GetReference(context);

            if ((entry != null) && (entry.Parent != null))
            {
                foreach (MemberEntry currEntry in entry.Parent.Members)
                {
                    // For now we only support length fields which come before the array
                    if (currEntry == entry)
                    {
                        break;
                    }

                    if (memberRef.IsValidType(currEntry))
                    {
                        names.Add(currEntry.Name);
                    }
                }
            }

            return(new StandardValuesCollection(names.ToArray()));
        }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="name">Name of the entry</param>
 /// <param name="types">The list of types this member can choose from</param>
 public SequenceChoiceMemberEntry(string name, IEnumerable<SequenceParserType> types)
     : base(name, new SequenceParserType("DUMMY"))
 {
     _choices = new SequenceChoice[0];
     _reference = new MemberEntryReference(this, typeof(MemberEntry));
     _types = types;
 }
Beispiel #4
0
        public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value)
        {
            object ret = null;

            if (value.GetType() == typeof(String))
            {
                MemberEntryReference memberRef = GetReference(context);

                MemberEntryReference reference = new MemberEntryReference((MemberEntry)context.Instance, memberRef.ValidTypes.ToArray());

                reference.SetReferenceChain(value.ToString());

                ret = reference;
            }
            else
            {
                ret = base.ConvertFrom(context, culture, value);
            }

            return(ret);
        }
        public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value)
        {
            object ret = null;

            if (value.GetType() == typeof(String))
            {
                MemberEntryReference memberRef = GetReference(context);

                MemberEntryReference reference = new MemberEntryReference((MemberEntry)context.Instance, memberRef.ValidTypes.ToArray());

                reference.SetReferenceChain(value.ToString());

                ret = reference;
            }
            else
            {
                ret = base.ConvertFrom(context, culture, value);
            }

            return ret;
        }
Beispiel #6
0
        public override bool Equals(object obj)
        {
            MemberEntryReference reference = obj as MemberEntryReference;
            bool ret = false;

            if (reference != null)
            {
                if ((reference._container == _container) && (reference._reference.Length == _reference.Length))
                {
                    int i = 0;
                    for (i = 0; i < _reference.Length; ++i)
                    {
                        if (reference._reference[i] != _reference[i])
                        {
                            break;
                        }
                    }

                    ret = i == _reference.Length;
                }
            }

            return(ret);
        }
 public ReferenceLengthSequenceArrayMemberEntry(SequenceMemberEntry entry)
     : base((MemberEntry)entry)
 {
     _reference = new MemberEntryReference(this, typeof(IntegerPrimitiveMemberEntry), typeof(StringMemberEntry));
 }
 public ReferenceLengthStringMemberEntry(string name)
     : base(name)
 {
     _reference = new MemberEntryReference(this, typeof(IntegerPrimitiveMemberEntry), typeof(StringMemberEntry));
 }
 public ReferenceLengthGenericArrayMemberEntry(IMemberReaderWriter entry)
     : base((MemberEntry)entry)
 {
     _reference = new MemberEntryReference(this);
 }
 public ReferenceLengthSequenceArrayMemberEntry(SequenceMemberEntry entry)
     : base((MemberEntry)entry)
 {
     _reference = new MemberEntryReference(this, typeof(IntegerPrimitiveMemberEntry), typeof(StringMemberEntry));
 }
 public ReferenceLengthStringMemberEntry(string name)
     : base(name)
 {
     _reference = new MemberEntryReference(this, typeof(IntegerPrimitiveMemberEntry), typeof(StringMemberEntry));
 }
Beispiel #12
0
 public ReferenceLengthGenericArrayMemberEntry(IMemberReaderWriter entry)
     : base((MemberEntry)entry)
 {
     _reference = new MemberEntryReference(this);
 }