This subclass of IBObject is used to represents an array (mutable or not).

When the IBObject.ObjectClass property of the IBArray is either "NSArray" or "NSMutableArray", the inner elements contains an element to indicate the XML serialization followed by the elements of the array.

Examples of XML code:

 <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="601701719"/> <reference ref="334170355"/> <reference ref="1001122846"/> <reference ref="431464563"/> <reference ref="692045935"/> <reference ref="383511723"/> </object> 
Inheritance: IBObject
Example #1
0
        public static IBObject GetInstance(IDictionary <String, String> attributes)
        {
            IBObject obj;

            switch (attributes["class"])
            {
            case "NSArray":
            case "NSMutableArray":
                obj = new IBArray(attributes);
                break;

            case "NSDictionary":
            case "NSMutableDictionary":
                obj = new IBDictionary(attributes);
                break;

            case "IBClassDescriber":
                obj = new IBClassDescriber(attributes);
                break;

            case "IBPartialClassDescription":
                obj = new IBPartialClassDescription(attributes);
                break;

            case "NSSet":
            case "NSMutableSet":
                obj = new IBSet(attributes);
                break;

            default:
                obj = new IBObject(attributes);
                break;
            }
            return(obj);
        }
Example #2
0
 public static IBObject GetInstance(IDictionary<String, String> attributes)
 {
     IBObject obj;
     switch (attributes["class"])
     {
         case "NSArray":
         case "NSMutableArray":
             obj = new IBArray(attributes);
             break;
         case "NSDictionary":
         case "NSMutableDictionary":
             obj = new IBDictionary(attributes);
             break;
         case "IBClassDescriber":
             obj = new IBClassDescriber(attributes);
             break;
         case "IBPartialClassDescription":
             obj = new IBPartialClassDescription(attributes);
             break;
         case "NSSet":
         case "NSMutableSet":
             obj = new IBSet(attributes);
             break;
         default:
             obj = new IBObject(attributes);
             break;
     }
     return obj;
 }
Example #3
0
        public override void Finish(IIBReferenceResolver resolver)
        {
            base.Finish(resolver);

            if (this.usesXmlCoder)
            {
                IIBItem item1  = this.Find <IIBItem>("dict.sortedKeys");
                IBArray keys   = this.DereferenceItem(resolver, item1) as IBArray;
                IIBItem item2  = this.Find <IIBItem>("dict.values");
                IBArray values = this.DereferenceItem(resolver, item2) as IBArray;
                if (keys != null && values != null)
                {
                    for (int i = 0; i < keys.Count; i++)
                    {
                        IBString key   = keys[i] as IBString;
                        IIBItem  value = values[i];
                        if (key != null)
                        {
                            this.Add(key.ToString(), value);
                        }
                    }
                }
                else
                {
                    throw new Exception("It seems that the parsing has really gone wrong. Can't find either keys or values...");
                }
            }
            else if (this.Value.Count > 0)
            {
                bool useKeyValuePair;

                // Probe for the keys used.
                IIBItem item = this[0];
                useKeyValuePair = item.Key.StartsWith("NS.key.");

                if (useKeyValuePair)
                {
                    for (int i = 0; i < this.Value.Count;)
                    {
                        IIBItem keyItem   = this[i++];
                        IIBItem valueItem = this[i++];
                        this.Add(keyItem.ToString(), valueItem);
                    }
                }
                else
                {
                    for (int i = 0; i < this.Value.Count; i++)
                    {
                        item = this[i];
                        this.Add(item.Key, item);
                    }
                }
            }
        }