summaryrefslogtreecommitdiff
path: root/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/ICustomPropertyProvider.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/ICustomPropertyProvider.cs')
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/ICustomPropertyProvider.cs126
1 files changed, 62 insertions, 64 deletions
diff --git a/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/ICustomPropertyProvider.cs b/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/ICustomPropertyProvider.cs
index 3bbde35a3c..f461327712 100644
--- a/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/ICustomPropertyProvider.cs
+++ b/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/ICustomPropertyProvider.cs
@@ -16,7 +16,6 @@ using System.Security;
namespace System.Runtime.InteropServices.WindowsRuntime
{
-
//
// ICustomProperty Implementation helpers
//
@@ -32,7 +31,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
Contract.Requires(propertyName != null);
IGetProxyTarget proxy = target as IGetProxyTarget;
- if (proxy != null)
+ if (proxy != null)
target = proxy.GetTarget();
// Only return public instance/static properties
@@ -50,7 +49,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
// Creates a ICustomProperty implementation for Jupiter
// Called from ICustomPropertyProvider_GetIndexedProperty from within runtime
//
- static internal unsafe ICustomProperty CreateIndexedProperty(object target, string propertyName, TypeNameNative *pIndexedParamType)
+ static internal unsafe ICustomProperty CreateIndexedProperty(object target, string propertyName, TypeNameNative* pIndexedParamType)
{
Contract.Requires(target != null);
Contract.Requires(propertyName != null);
@@ -58,7 +57,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
Type indexedParamType = null;
SystemTypeMarshaler.ConvertToManaged(pIndexedParamType, ref indexedParamType);
- return CreateIndexedProperty(target, propertyName, indexedParamType);
+ return CreateIndexedProperty(target, propertyName, indexedParamType);
}
static internal ICustomProperty CreateIndexedProperty(object target, string propertyName, Type indexedParamType)
@@ -67,7 +66,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
Contract.Requires(propertyName != null);
IGetProxyTarget proxy = target as IGetProxyTarget;
- if (proxy != null)
+ if (proxy != null)
target = proxy.GetTarget();
// Only return public instance/static properties
@@ -86,25 +85,25 @@ namespace System.Runtime.InteropServices.WindowsRuntime
return new CustomPropertyImpl(propertyInfo);
}
- static internal unsafe void GetType(object target, TypeNameNative *pIndexedParamType)
- {
+ static internal unsafe void GetType(object target, TypeNameNative* pIndexedParamType)
+ {
IGetProxyTarget proxy = target as IGetProxyTarget;
- if (proxy != null)
+ if (proxy != null)
target = proxy.GetTarget();
SystemTypeMarshaler.ConvertToNative(target.GetType(), pIndexedParamType);
- }
+ }
}
[Flags]
- enum InterfaceForwardingSupport
+ internal enum InterfaceForwardingSupport
{
- None = 0,
- IBindableVector = 0x1, // IBindableVector -> IBindableVector
- IVector = 0x2, // IBindableVector -> IVector<T>
- IBindableVectorView = 0x4, // IBindableVectorView -> IBindableVectorView
- IVectorView = 0x8, // IBindableVectorView -> IVectorView<T>
- IBindableIterableOrIIterable= 0x10 // IBindableIterable -> IBindableIterable/IIterable<T>
+ None = 0,
+ IBindableVector = 0x1, // IBindableVector -> IBindableVector
+ IVector = 0x2, // IBindableVector -> IVector<T>
+ IBindableVectorView = 0x4, // IBindableVectorView -> IBindableVectorView
+ IVectorView = 0x8, // IBindableVectorView -> IVectorView<T>
+ IBindableIterableOrIIterable = 0x10 // IBindableIterable -> IBindableIterable/IIterable<T>
}
//
@@ -113,9 +112,9 @@ namespace System.Runtime.InteropServices.WindowsRuntime
//
internal interface IGetProxyTarget
{
- object GetTarget();
+ object GetTarget();
}
-
+
//
// Proxy that supports data binding on another object
//
@@ -164,7 +163,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
// doesn't recognize, and therefore IEnumerable cast won't be able to take advantage of this QI
if (target as IList<T1> != null)
supportFlags |= InterfaceForwardingSupport.IVector;
-
+
if (target as IBindableVectorView != null)
supportFlags |= InterfaceForwardingSupport.IBindableVectorView;
@@ -181,8 +180,8 @@ namespace System.Runtime.InteropServices.WindowsRuntime
// succeeded, IEnumerable needs to know that
if (target as IEnumerable != null)
supportFlags |= InterfaceForwardingSupport.IBindableIterableOrIIterable;
-
- return new ICustomPropertyProviderProxy<T1, T2>(target, supportFlags);
+
+ return new ICustomPropertyProviderProxy<T1, T2>(target, supportFlags);
}
@@ -213,26 +212,26 @@ namespace System.Runtime.InteropServices.WindowsRuntime
{
// Reject the QI if target doesn't implement IEnumerable
if ((_flags & (InterfaceForwardingSupport.IBindableIterableOrIIterable)) == 0)
- return CustomQueryInterfaceResult.Failed;
+ return CustomQueryInterfaceResult.Failed;
}
if (iid == typeof(IBindableVector).GUID)
{
// Reject the QI if target doesn't implement IBindableVector/IVector
if ((_flags & (InterfaceForwardingSupport.IBindableVector | InterfaceForwardingSupport.IVector)) == 0)
- return CustomQueryInterfaceResult.Failed;
+ return CustomQueryInterfaceResult.Failed;
}
if (iid == typeof(IBindableVectorView).GUID)
{
// Reject the QI if target doesn't implement IBindableVectorView/IVectorView
if ((_flags & (InterfaceForwardingSupport.IBindableVectorView | InterfaceForwardingSupport.IVectorView)) == 0)
- return CustomQueryInterfaceResult.Failed;
+ return CustomQueryInterfaceResult.Failed;
}
-
+
return CustomQueryInterfaceResult.NotHandled;
}
-
+
//
// IEnumerable methods
//
@@ -257,14 +256,14 @@ namespace System.Runtime.InteropServices.WindowsRuntime
{
// IBindableVector -> IVector<T>
return GetVectorOfT().GetAt(index);
- }
+ }
}
-
+
[Pure]
- uint IBindableVector.Size
- {
+ uint IBindableVector.Size
+ {
get
- {
+ {
IBindableVector bindableVector = GetIBindableVectorNoThrow();
if (bindableVector != null)
{
@@ -275,10 +274,10 @@ namespace System.Runtime.InteropServices.WindowsRuntime
{
// IBindableVector -> IVector<T>
return GetVectorOfT().Size;
- }
+ }
}
}
-
+
[Pure]
IBindableVectorView IBindableVector.GetView()
{
@@ -292,7 +291,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
{
// IBindableVector -> IVector<T>
return new IVectorViewToIBindableVectorViewAdapter<T1>(GetVectorOfT().GetView());
- }
+ }
}
private sealed class IVectorViewToIBindableVectorViewAdapter<T> : IBindableVectorView
@@ -300,8 +299,8 @@ namespace System.Runtime.InteropServices.WindowsRuntime
private IVectorView<T> _vectorView;
public IVectorViewToIBindableVectorViewAdapter(IVectorView<T> vectorView)
- {
- this._vectorView = vectorView;
+ {
+ _vectorView = vectorView;
}
[Pure]
@@ -309,16 +308,16 @@ namespace System.Runtime.InteropServices.WindowsRuntime
{
return _vectorView.GetAt(index);
}
-
+
[Pure]
uint IBindableVectorView.Size
- {
+ {
get
{
return _vectorView.Size;
}
}
-
+
[Pure]
bool IBindableVectorView.IndexOf(object value, out uint index)
{
@@ -329,9 +328,8 @@ namespace System.Runtime.InteropServices.WindowsRuntime
{
return new IteratorOfTToIteratorAdapter<T>(_vectorView.First());
}
+ }
- }
-
[Pure]
bool IBindableVector.IndexOf(object value, out uint index)
{
@@ -345,9 +343,9 @@ namespace System.Runtime.InteropServices.WindowsRuntime
{
// IBindableVector -> IVector<T>
return GetVectorOfT().IndexOf(ConvertTo<T1>(value), out index);
- }
+ }
}
-
+
void IBindableVector.SetAt(uint index, object value)
{
IBindableVector bindableVector = GetIBindableVectorNoThrow();
@@ -360,9 +358,9 @@ namespace System.Runtime.InteropServices.WindowsRuntime
{
// IBindableVector -> IVector<T>
GetVectorOfT().SetAt(index, ConvertTo<T1>(value));
- }
+ }
}
-
+
void IBindableVector.InsertAt(uint index, object value)
{
IBindableVector bindableVector = GetIBindableVectorNoThrow();
@@ -375,9 +373,9 @@ namespace System.Runtime.InteropServices.WindowsRuntime
{
// IBindableVector -> IVector<T>
GetVectorOfT().InsertAt(index, ConvertTo<T1>(value));
- }
+ }
}
-
+
void IBindableVector.RemoveAt(uint index)
{
IBindableVector bindableVector = GetIBindableVectorNoThrow();
@@ -390,9 +388,9 @@ namespace System.Runtime.InteropServices.WindowsRuntime
{
// IBindableVector -> IVector<T>
GetVectorOfT().RemoveAt(index);
- }
+ }
}
-
+
void IBindableVector.Append(object value)
{
IBindableVector bindableVector = GetIBindableVectorNoThrow();
@@ -405,9 +403,9 @@ namespace System.Runtime.InteropServices.WindowsRuntime
{
// IBindableVector -> IVector<T>
GetVectorOfT().Append(ConvertTo<T1>(value));
- }
- }
-
+ }
+ }
+
void IBindableVector.RemoveAtEnd()
{
IBindableVector bindableVector = GetIBindableVectorNoThrow();
@@ -420,9 +418,9 @@ namespace System.Runtime.InteropServices.WindowsRuntime
{
// IBindableVector -> IVector<T>
GetVectorOfT().RemoveAtEnd();
- }
+ }
}
-
+
void IBindableVector.Clear()
{
IBindableVector bindableVector = GetIBindableVectorNoThrow();
@@ -435,7 +433,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
{
// IBindableVector -> IVector<T>
GetVectorOfT().Clear();
- }
+ }
}
private IBindableVector GetIBindableVectorNoThrow()
@@ -454,7 +452,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
throw new InvalidOperationException(); // We should not go down this path, unless Jupiter pass this out to managed code
// and managed code use reflection to do the cast
}
-
+
//
// IBindableVectorView implementation (forwarding to IBindableVectorView or IVectorView<T>)
//
@@ -467,10 +465,10 @@ namespace System.Runtime.InteropServices.WindowsRuntime
else
return GetVectorViewOfT().GetAt(index);
}
-
+
[Pure]
uint IBindableVectorView.Size
- {
+ {
get
{
IBindableVectorView bindableVectorView = GetIBindableVectorViewNoThrow();
@@ -480,7 +478,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
return GetVectorViewOfT().Size;
}
}
-
+
[Pure]
bool IBindableVectorView.IndexOf(object value, out uint index)
{
@@ -505,12 +503,12 @@ namespace System.Runtime.InteropServices.WindowsRuntime
private IIterator<T> _iterator;
public IteratorOfTToIteratorAdapter(IIterator<T> iterator)
- { this._iterator = iterator; }
+ { _iterator = iterator; }
public bool HasCurrent { get { return _iterator.HasCurrent; } }
- public object Current { get { return (object)_iterator.Current; } }
+ public object Current { get { return (object)_iterator.Current; } }
public bool MoveNext() { return _iterator.MoveNext(); }
- }
+ }
private IBindableVectorView GetIBindableVectorViewNoThrow()
{
@@ -537,9 +535,9 @@ namespace System.Runtime.InteropServices.WindowsRuntime
// Throw ArgumentNullException if value is null (otherwise we'll throw NullReferenceException
// when casting value to T)
ThrowHelper.IfNullAndNullsAreIllegalThenThrow<T>(value, ExceptionArgument.value);
-
+
// No coersion support needed. If we need coersion later, this is the place
- return (T) value;
+ return (T)value;
}
}
}