gmime r1410 - trunk/mono
- From: fejj svn gnome org
- To: svn-commits-list gnome org
- Subject: gmime r1410 - trunk/mono
- Date: Wed, 20 Aug 2008 02:16:18 +0000 (UTC)
Author: fejj
Date: Wed Aug 20 02:16:17 2008
New Revision: 1410
URL: http://svn.gnome.org/viewvc/gmime?rev=1410&view=rev
Log:
updated
Added:
trunk/mono/InternetAddressList.custom
Removed:
trunk/mono/InternetAddressList.cs
Modified:
trunk/mono/GMime.metadata
trunk/mono/Makefile.am
Modified: trunk/mono/GMime.metadata
==============================================================================
--- trunk/mono/GMime.metadata (original)
+++ trunk/mono/GMime.metadata Wed Aug 20 02:16:17 2008
@@ -147,9 +147,31 @@
<attr path="/api/namespace/object[ cname='InternetAddressMailbox']/method[ name='SetAddr']" name="name">SetAddress</attr>
<!-- InternetAddressList -->
- <!-- We implement this class by hand, remove it. -->
- <attr path="/api/namespace/object[ cname='InternetAddressList']" name="hidden">true</attr>
-
+ <!-- Remove internal methods/fields/signals -->
+ <remove-node path="/api/namespace/object[ cname='InternetAddressList']/signal[ name='Changed']"/>
+ <remove-node path="/api/namespace/object[ cname='InternetAddressList']/method[ name='Writer']"/>
+ <remove-node path="/api/namespace/object[ cname='InternetAddressList']/field[ name='Array']"/>
+ <!-- We're going to implement the IList interface -->
+ <add-node path="/api/namespace/object[ cname='InternetAddressList']">
+ <implements>
+ <interface name="IList"/>
+ </implements>
+ </add-node>
+ <!-- Remove methods we're going to implement manually in InternetAddressList.custom -->
+ <remove-node path="/api/namespace/object[ cname='InternetAddressList']/method[ name='Add']"/>
+ <remove-node path="/api/namespace/object[ cname='InternetAddressList']/method[ name='Clear']"/>
+ <remove-node path="/api/namespace/object[ cname='InternetAddressList']/method[ name='Concat']"/>
+ <remove-node path="/api/namespace/object[ cname='InternetAddressList']/method[ name='Contains']"/>
+ <remove-node path="/api/namespace/object[ cname='InternetAddressList']/method[ name='IndexOf']"/>
+ <remove-node path="/api/namespace/object[ cname='InternetAddressList']/method[ name='Insert']"/>
+ <remove-node path="/api/namespace/object[ cname='InternetAddressList']/method[ name='Length']"/>
+ <remove-node path="/api/namespace/object[ cname='InternetAddressList']/method[ name='ParseString']"/>
+ <remove-node path="/api/namespace/object[ cname='InternetAddressList']/method[ name='Remove']"/>
+ <remove-node path="/api/namespace/object[ cname='InternetAddressList']/method[ name='RemoveAt']"/>
+ <remove-node path="/api/namespace/object[ cname='InternetAddressList']/method[ name='GetAddress']"/>
+ <remove-node path="/api/namespace/object[ cname='InternetAddressList']/method[ name='SetAddress']"/>
+ <remove-node path="/api/namespace/object[ cname='InternetAddressList']/method[ name='ToString']"/>
+
<!-- Message -->
<attr path="/api/namespace/object[ cname='GMimeMessage']/method[ name='GetMimePart']/return-type" name="owned">true</attr>
<!-- We implement these properties by hand, hide them. -->
Added: trunk/mono/InternetAddressList.custom
==============================================================================
--- (empty file)
+++ trunk/mono/InternetAddressList.custom Wed Aug 20 02:16:17 2008
@@ -0,0 +1,299 @@
+#region Native Methods
+ [DllImport("gmime")]
+ static extern int internet_address_list_length (IntPtr list);
+
+ [DllImport("gmime")]
+ static extern void internet_address_list_clear (IntPtr list);
+
+ [DllImport("gmime")]
+ static extern int internet_address_list_add (IntPtr list, IntPtr ia);
+
+ //[DllImport("gmime")]
+ //static extern void internet_address_list_concat (IntPtr list, IntPtr concat);
+
+ [DllImport("gmime")]
+ static extern void internet_address_list_insert (IntPtr list, int index, IntPtr concat);
+
+ [DllImport("gmime")]
+ static extern bool internet_address_list_remove (IntPtr list, IntPtr ia);
+
+ [DllImport("gmime")]
+ static extern bool internet_address_list_remove_at (IntPtr list, int index);
+
+ [DllImport("gmime")]
+ static extern bool internet_address_list_contains (IntPtr list, IntPtr ia);
+
+ [DllImport("gmime")]
+ static extern int internet_address_list_index_of (IntPtr list, IntPtr ia);
+
+ [DllImport("gmime")]
+ static extern IntPtr internet_address_list_get_address (IntPtr list, int index);
+
+ [DllImport("gmime")]
+ static extern void internet_address_list_set_address (IntPtr list, int index, IntPtr ia);
+
+ [DllImport("gmime")]
+ static extern IntPtr internet_address_list_to_string (IntPtr list, bool encode);
+
+ [DllImport("gmime")]
+ static extern IntPtr internet_address_list_parse_string (IntPtr str);
+#endregion
+
+ Exception CannotAdd (object value)
+ {
+ if (value == null)
+ return new ArgumentNullException ("value");
+
+ string message = String.Format ("Cannot add objects of type '{0}' to an InternetAddressList.",
+ value.GetType ().ToString ());
+
+ return new InvalidOperationException (message);
+ }
+
+ Exception CannotInsert (object value)
+ {
+ if (value == null)
+ return new ArgumentNullException ("value");
+
+ string message = String.Format ("Cannot insert objects of type '{0}' into an InternetAddressList.",
+ value.GetType ().ToString ());
+
+ return new InvalidOperationException (message);
+ }
+
+ Exception CannotRemove (object value)
+ {
+ if (value == null)
+ return new ArgumentNullException ("value");
+
+ string message = String.Format ("Cannot remove objects of type '{0}' from an InternetAddressList.",
+ value.GetType ().ToString ());
+
+ return new InvalidOperationException (message);
+ }
+
+ Exception CannotSet (object value)
+ {
+ if (value == null)
+ return new ArgumentNullException ("value");
+
+ string message = String.Format ("Cannot set objects of type '{0}' on an InternetAddressList.",
+ value.GetType ().ToString ());
+
+ return new InvalidOperationException (message);
+ }
+
+ public int Count {
+ get { return internet_address_list_length (Handle); }
+ }
+
+ public bool IsFixedSize {
+ get { return false; }
+ }
+
+ public bool IsReadOnly {
+ get { return false; }
+ }
+
+ public bool IsSynchronized {
+ get { return false; }
+ }
+
+ public object SyncRoot {
+ get { return this; }
+ }
+
+ public int Add (InternetAddress addr)
+ {
+ if (addr == null)
+ throw CannotAdd (addr);
+
+ return internet_address_list_add (Handle, addr.Handle);
+ }
+
+ int IList.Add (object value)
+ {
+ InternetAddress addr = value as InternetAddress;
+
+ if (addr == null)
+ throw CannotAdd (value);
+
+ return Add (value as InternetAddress);
+ }
+
+ public void Clear ()
+ {
+ internet_address_list_clear (Handle);
+ }
+
+ public bool Contains (InternetAddress addr)
+ {
+ if (addr == null)
+ return false;
+
+ return internet_address_list_contains (Handle, addr.Handle);
+ }
+
+ bool IList.Contains (object value)
+ {
+ return Contains (value as InternetAddress);
+ }
+
+ public void CopyTo (Array array, int index)
+ {
+ if (array == null)
+ throw new ArgumentNullException ("array");
+
+ if (index < 0)
+ throw new ArgumentOutOfRangeException ("index");
+
+ int n = Count;
+
+ for (int i = 0; i < n; i++)
+ array.SetValue (((IList) this)[i], index + i);
+ }
+
+ public IEnumerator GetEnumerator ()
+ {
+ return new InternetAddressListIterator (this);
+ }
+
+ public int IndexOf (InternetAddress addr)
+ {
+ if (addr == null)
+ return -1;
+
+ return internet_address_list_index_of (Handle, addr.Handle);
+ }
+
+ int IList.IndexOf (object value)
+ {
+ return IndexOf (value as InternetAddress);
+ }
+
+ public void Insert (int index, InternetAddress addr)
+ {
+ if (addr == null)
+ throw CannotInsert (addr);
+
+ if (index < 0)
+ throw new ArgumentOutOfRangeException ("index");
+
+ internet_address_list_insert (Handle, index, addr.Handle);
+ }
+
+ void IList.Insert (int index, object value)
+ {
+ InternetAddress addr = value as InternetAddress;
+
+ if (addr == null)
+ throw CannotInsert (value);
+
+ Insert (index, addr);
+ }
+
+ public void Remove (InternetAddress addr)
+ {
+ if (addr == null)
+ throw CannotRemove (addr);
+
+ internet_address_list_remove (Handle, addr.Handle);
+ }
+
+ void IList.Remove (object value)
+ {
+ InternetAddress addr = value as InternetAddress;
+
+ if (addr == null)
+ throw CannotRemove (value);
+
+ Remove (addr);
+ }
+
+ public void RemoveAt (int index)
+ {
+ if (index < 0 || index >= Count)
+ throw new ArgumentOutOfRangeException ("index");
+
+ internet_address_list_remove_at (Handle, index);
+ }
+
+ public InternetAddress this[int index] {
+ get {
+ IntPtr raw = internet_address_list_get_address (Handle, index);
+
+ if (raw == IntPtr.Zero)
+ return null;
+
+ return GLib.Object.GetObject (raw) as InternetAddress;
+ }
+
+ set {
+ if (value == null)
+ throw CannotSet (value);
+
+ internet_address_list_set_address (Handle, index, value.Handle);
+ }
+ }
+
+ object IList.this[int index] {
+ get {
+ return this[index];
+ }
+
+ set {
+ this[index] = value as InternetAddress;
+ }
+ }
+
+ public static InternetAddressList Parse (string str)
+ {
+ IntPtr native_str = GLib.Marshaller.StringToPtrGStrdup (str);
+ IntPtr raw = internet_address_list_parse_string (native_str);
+ InternetAddressList list = null;
+
+ if (raw != IntPtr.Zero)
+ list = new InternetAddressList (raw);
+
+ GLib.Marshaller.Free (native_str);
+
+ return list;
+ }
+
+ public string ToString (bool encode)
+ {
+ IntPtr raw = internet_address_list_to_string (Handle, encode);
+
+ return GLib.Marshaller.PtrToStringGFree (raw);
+ }
+
+ public override string ToString ()
+ {
+ return ToString (false);
+ }
+
+ internal class InternetAddressListIterator : IEnumerator {
+ InternetAddressList list;
+ int index = -1;
+
+ public InternetAddressListIterator (InternetAddressList list)
+ {
+ this.list = list;
+ }
+
+ public object Current {
+ get { return list[index]; }
+ }
+
+ public void Reset ()
+ {
+ index = -1;
+ }
+
+ public bool MoveNext ()
+ {
+ index++;
+
+ return index < list.Count;
+ }
+ }
Modified: trunk/mono/Makefile.am
==============================================================================
--- trunk/mono/Makefile.am (original)
+++ trunk/mono/Makefile.am Wed Aug 20 02:16:17 2008
@@ -18,11 +18,9 @@
pkgconfig_DATA = gmime-sharp-2.4.pc
sources = \
- InternetAddressList.cs \
StreamWrapper.cs
build_sources = \
- $(srcdir)/InternetAddressList.cs\
$(srcdir)/StreamWrapper.cs \
AssemblyInfo.cs
@@ -31,17 +29,19 @@
Global.custom \
HeaderList.custom \
InternetAddress.custom \
+ InternetAddressList.custom \
Message.custom \
Object.custom \
Stream.custom
-build_customs = \
- $(srcdir)/DataWrapper.custom \
- $(srcdir)/Global.custom \
- $(srcdir)/HeaderList.custom \
- $(srcdir)/InternetAddress.custom\
- $(srcdir)/Message.custom \
- $(srcdir)/Object.custom \
+build_customs = \
+ $(srcdir)/DataWrapper.custom \
+ $(srcdir)/Global.custom \
+ $(srcdir)/HeaderList.custom \
+ $(srcdir)/InternetAddress.custom \
+ $(srcdir)/InternetAddressList.custom \
+ $(srcdir)/Message.custom \
+ $(srcdir)/Object.custom \
$(srcdir)/Stream.custom
EXTRA_DIST = \
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]