public VariantListEnumerator(VariantList collection)
 {
     this.collectionRef = collection;
     this.currentIndex  = -1;
     this.currentObject = null;
     this.currentSize   = this.collectionRef.Count;
 }
 public VariantList(VariantList other) : this(AppUtilPINVOKE.new_VariantList__SWIG_1(VariantList.getCPtr(other)), true)
 {
     if (AppUtilPINVOKE.SWIGPendingException.Pending)
     {
         throw AppUtilPINVOKE.SWIGPendingException.Retrieve();
     }
 }
 public void SetRange(int index, VariantList values)
 {
     AppUtilPINVOKE.VariantList_SetRange(this.swigCPtr, index, VariantList.getCPtr(values));
     if (AppUtilPINVOKE.SWIGPendingException.Pending)
     {
         throw AppUtilPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Exemplo n.º 4
0
        public VariantList vector()
        {
            VariantList result = new VariantList(AppUtilPINVOKE.Variant_vector__SWIG_0(this.swigCPtr), false);

            if (AppUtilPINVOKE.SWIGPendingException.Pending)
            {
                throw AppUtilPINVOKE.SWIGPendingException.Retrieve();
            }
            return(result);
        }
        public static VariantList Repeat(Variant value, int count)
        {
            IntPtr      intPtr = AppUtilPINVOKE.VariantList_Repeat(Variant.getCPtr(value), count);
            VariantList result = (!(intPtr == IntPtr.Zero)) ? new VariantList(intPtr, true) : null;

            if (AppUtilPINVOKE.SWIGPendingException.Pending)
            {
                throw AppUtilPINVOKE.SWIGPendingException.Retrieve();
            }
            return(result);
        }
        public VariantList GetRange(int index, int count)
        {
            IntPtr      intPtr = AppUtilPINVOKE.VariantList_GetRange(this.swigCPtr, index, count);
            VariantList result = (!(intPtr == IntPtr.Zero)) ? new VariantList(intPtr, true) : null;

            if (AppUtilPINVOKE.SWIGPendingException.Pending)
            {
                throw AppUtilPINVOKE.SWIGPendingException.Retrieve();
            }
            return(result);
        }
Exemplo n.º 7
0
 public static Variant FromObject(object o)
 {
     if (o == null)
     {
         return(Variant.Null());
     }
     if (o is string)
     {
         return(Variant.FromString((string)o));
     }
     if (o is long)
     {
         return(Variant.FromInt64((long)o));
     }
     if (o is double)
     {
         return(Variant.FromDouble((double)o));
     }
     if (o is bool)
     {
         return(Variant.FromBool((bool)o));
     }
     if (o is byte[])
     {
         return(Variant.FromBlob((byte[])o));
     }
     if (o is IList)
     {
         IList       list        = (IList)o;
         Variant     variant     = Variant.EmptyVector();
         VariantList variantList = variant.vector();
         IEnumerator enumerator  = list.GetEnumerator();
         try
         {
             while (enumerator.MoveNext())
             {
                 object o2 = enumerator.Current;
                 variantList.Add(Variant.FromObject(o2));
             }
         }
         finally
         {
             IDisposable disposable;
             if ((disposable = (enumerator as IDisposable)) != null)
             {
                 disposable.Dispose();
             }
         }
         return(variant);
     }
     if (o is IDictionary)
     {
         IDictionary           dictionary        = (IDictionary)o;
         Variant               variant2          = Variant.EmptyMap();
         VariantVariantMap     variantVariantMap = variant2.map();
         IDictionaryEnumerator enumerator2       = dictionary.GetEnumerator();
         try
         {
             while (enumerator2.MoveNext())
             {
                 object          obj             = enumerator2.Current;
                 DictionaryEntry dictionaryEntry = (DictionaryEntry)obj;
                 Variant         key             = Variant.FromObject(dictionaryEntry.Key);
                 Variant         value           = Variant.FromObject(dictionaryEntry.Value);
                 variantVariantMap[key] = value;
             }
         }
         finally
         {
             IDisposable disposable2;
             if ((disposable2 = (enumerator2 as IDisposable)) != null)
             {
                 disposable2.Dispose();
             }
         }
         return(variant2);
     }
     if (o is byte || o is short || o is int || o is sbyte || o is ushort || o is uint)
     {
         return(Variant.FromInt64(Convert.ToInt64(o)));
     }
     if (o is float)
     {
         return(Variant.FromDouble(Convert.ToDouble(o)));
     }
     throw new ArgumentException("Invalid type " + o.GetType() + " for conversion to Variant");
 }
 internal static HandleRef getCPtr(VariantList obj)
 {
     return((obj != null) ? obj.swigCPtr : new HandleRef(null, IntPtr.Zero));
 }