Skip to content

Commit

Permalink
ongoing implementation.
Browse files Browse the repository at this point in the history
svn path=/trunk/mcs/; revision=155129
  • Loading branch information
atsushieno committed Apr 9, 2010
1 parent c78a0e1 commit 6d9958e
Show file tree
Hide file tree
Showing 14 changed files with 768 additions and 151 deletions.
4 changes: 4 additions & 0 deletions mcs/class/System.Xaml/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
2010-04-09 Atsushi Enomoto <atsushi@ximian.com>

* System.Xaml_test.dll.sources : add XamlLanguageTest.cs.

2010-04-09 Atsushi Enomoto <atsushi@ximian.com>

* System.Xaml.dll.sources
Expand Down
23 changes: 23 additions & 0 deletions mcs/class/System.Xaml/System.Windows.Markup/ArrayExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,29 @@ namespace System.Windows.Markup
[ContentProperty ("Items")]
public class ArrayExtension : MarkupExtension
{
public ArrayExtension ()
{
Items = new List<object> ();
}

public ArrayExtension (Array elements)
{
if (elements == null)
throw new ArgumentNullException ("elements");
Items = elements;
}

public ArrayExtension (Type arrayType)
{
if (arrayType == null)
throw new ArgumentNullException ("arrayType");
Type = arrayType;
Items = (IList) Activator.CreateInstance (typeof (List<>).MakeGenericType (arrayType), new object [0]);
}

public IList Items { get; private set; }
public Type Type { get; set; }

public void AddChild (Object value)
{
throw new NotImplementedException ();
Expand Down
4 changes: 4 additions & 0 deletions mcs/class/System.Xaml/System.Windows.Markup/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
2010-04-09 Atsushi Enomoto <atsushi@ximian.com>

* ArrayExtension.cs, TypeExtension.cs : add missing members.

2010-04-08 Atsushi Enomoto <atsushi@ximian.com>

* ValueSerializer.cs : add missing members.
Expand Down
4 changes: 4 additions & 0 deletions mcs/class/System.Xaml/System.Windows.Markup/TypeExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ namespace System.Windows.Markup
[MarkupExtensionReturnType (typeof (Type))]
public class TypeExtension : MarkupExtension
{
public TypeExtension ()
{
}

public TypeExtension (string typeName)
{
TypeName = typeName;
Expand Down
8 changes: 8 additions & 0 deletions mcs/class/System.Xaml/System.Xaml/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
2010-04-09 Atsushi Enomoto <atsushi@ximian.com>

* TypeExtension.cs
XamlMember.cs
XamlDirective.cs
XamlType.cs
XamlLanguage.cs : ongoing implementation.

2010-04-09 Atsushi Enomoto <atsushi@ximian.com>

* XamlType.cs : implemented lots of members.
Expand Down
2 changes: 1 addition & 1 deletion mcs/class/System.Xaml/System.Xaml/TypeExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

namespace System.Xaml
{
static class TypeExtension
static class TypeExtensionMethods
{
public static string GetXamlName (this Type type)
{
Expand Down
5 changes: 5 additions & 0 deletions mcs/class/System.Xaml/System.Xaml/XamlDirective.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ public XamlDirective (IEnumerable<string> xamlNamespaces, string name, XamlType
bool is_unknown;
IList<string> xaml_namespaces;

// this is for XamlLanguage.UnknownContent
internal bool InternalIsUnknown {
set { is_unknown = value; }
}

public override int GetHashCode ()
{
throw new NotImplementedException ();
Expand Down
261 changes: 120 additions & 141 deletions mcs/class/System.Xaml/System.Xaml/XamlLanguage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,164 +25,143 @@
using System.Collections.ObjectModel;
using System.Globalization;
using System.Reflection;
using System.Xaml;
using System.Xaml.Schema;
using System.Windows.Markup;

namespace System.Xaml.Schema
namespace System.Xaml
{
public static class XamlLanguage
{
public const string Xaml2006Namespace = "http://schemas.microsoft.com/winfx/2006/xaml";
public const string Xml1998Namespace = "http://www.w3.org/XML/1998/namespace";

public static ReadOnlyCollection<XamlDirective> AllDirectives {
get { throw new NotImplementedException (); }
}
public static ReadOnlyCollection<XamlType> AllTypes {
get { throw new NotImplementedException (); }
}
public static XamlDirective Arguments {
get { throw new NotImplementedException (); }
}
public static XamlType Array {
get { throw new NotImplementedException (); }
}
public static XamlDirective AsyncRecords {
get { throw new NotImplementedException (); }
}
public static XamlDirective Base {
get { throw new NotImplementedException (); }
}
public static XamlType Boolean {
get { throw new NotImplementedException (); }
}
public static XamlType Byte {
get { throw new NotImplementedException (); }
}
public static XamlType Char {
get { throw new NotImplementedException (); }
}
public static XamlDirective Class {
get { throw new NotImplementedException (); }
}
public static XamlDirective ClassAttributes {
get { throw new NotImplementedException (); }
}
public static XamlDirective ClassModifier {
get { throw new NotImplementedException (); }
}
public static XamlDirective Code {
get { throw new NotImplementedException (); }
}
public static XamlDirective ConnectionId {
get { throw new NotImplementedException (); }
}
public static XamlType Decimal {
get { throw new NotImplementedException (); }
}
public static XamlType Double {
get { throw new NotImplementedException (); }
}
public static XamlDirective FactoryMethod {
get { throw new NotImplementedException (); }
}
public static XamlDirective FieldModifier {
get { throw new NotImplementedException (); }
}
public static XamlDirective Initialization {
get { throw new NotImplementedException (); }
}
public static XamlType Int16 {
get { throw new NotImplementedException (); }
}
public static XamlType Int32 {
get { throw new NotImplementedException (); }
}
public static XamlType Int64 {
get { throw new NotImplementedException (); }
}
public static XamlDirective Items {
get { throw new NotImplementedException (); }
}
public static XamlDirective Key {
get { throw new NotImplementedException (); }
}
public static XamlDirective Lang {
get { throw new NotImplementedException (); }
}
public static XamlType Member {
get { throw new NotImplementedException (); }
}
public static XamlDirective Members {
get { throw new NotImplementedException (); }
}
public static XamlDirective Name {
get { throw new NotImplementedException (); }
}
public static XamlType Null {
get { throw new NotImplementedException (); }
}
public static XamlType Object {
get { throw new NotImplementedException (); }
}
public static XamlDirective PositionalParameters {
get { throw new NotImplementedException (); }
}
public static XamlType Property {
get { throw new NotImplementedException (); }
}
public static XamlType Reference {
get { throw new NotImplementedException (); }
}
public static XamlDirective Shared {
get { throw new NotImplementedException (); }
}
public static XamlType Single {
get { throw new NotImplementedException (); }
}
public static XamlDirective Space {
get { throw new NotImplementedException (); }
}
public static XamlType Static {
get { throw new NotImplementedException (); }
}
public static XamlType String {
get { throw new NotImplementedException (); }
}
public static XamlDirective Subclass {
get { throw new NotImplementedException (); }
}
public static XamlDirective SynchronousMode {
get { throw new NotImplementedException (); }
}
public static XamlType TimeSpan {
get { throw new NotImplementedException (); }
}
public static XamlType Type {
get { throw new NotImplementedException (); }
}
public static XamlDirective TypeArguments {
get { throw new NotImplementedException (); }
}
public static XamlDirective Uid {
get { throw new NotImplementedException (); }
}
public static XamlDirective UnknownContent {
get { throw new NotImplementedException (); }
static readonly XamlSchemaContext sctx = new XamlSchemaContext (null, null);

static XamlType XT<T> ()
{
return new XamlType (typeof (T), sctx);
}
public static XamlType Uri {
get { throw new NotImplementedException (); }

static XamlLanguage ()
{
// types

Array = new XamlType (typeof (ArrayExtension), sctx);
Boolean = new XamlType (typeof (bool), sctx);
Byte = new XamlType (typeof (byte), sctx);
Char = new XamlType (typeof (char), sctx);
Decimal = new XamlType (typeof (decimal), sctx);
Double = new XamlType (typeof (double), sctx);
Int16 = new XamlType (typeof (short), sctx);
Int32 = new XamlType (typeof (int), sctx);
Int64 = new XamlType (typeof (long), sctx);
Member = new XamlType (typeof (MemberDefinition), sctx);
Null = new XamlType (typeof (NullExtension), sctx);
Object = new XamlType (typeof (object), sctx);
Property = new XamlType (typeof (PropertyDefinition), sctx);
Reference = new XamlType (typeof (Reference), sctx);
Single = new XamlType (typeof (float), sctx);
Static = new XamlType (typeof (StaticExtension), sctx);
String = new XamlType (typeof (string), sctx);
TimeSpan = new XamlType (typeof (TimeSpan), sctx);
Type = new XamlType (typeof (TypeExtension), sctx);
Uri = new XamlType (typeof (Uri), sctx);
XData = new XamlType (typeof (XData), sctx);

AllTypes = new ReadOnlyCollection<XamlType> (new XamlType [] {Array, Boolean, Byte, Char, Decimal, Double, Int16, Int32, Int64, Member, Null, Object, Property, Reference, Single, Static, String, TimeSpan, Type, Uri, XData});

// directives

var nss = new string [] {XamlLanguage.Xaml2006Namespace};
var nssXml = new string [] {XamlLanguage.Xml1998Namespace};

Arguments = new XamlDirective (nss, "Arguments", XT<List<object>> (), null, AllowedMemberLocations.Any);
AsyncRecords = new XamlDirective (nss, "AsyncRecords", XT<string> (), null, AllowedMemberLocations.Attribute);
Base = new XamlDirective (nssXml, "base", XT<string> (), null, AllowedMemberLocations.Attribute);
Class = new XamlDirective (nss, "Class", XT<string> (), null, AllowedMemberLocations.Attribute);
ClassAttributes = new XamlDirective (nss, "ClassAttributes", XT<List<Attribute>> (), null, AllowedMemberLocations.MemberElement);
ClassModifier = new XamlDirective (nss, "ClassModifier", XT<string> (), null, AllowedMemberLocations.Attribute);
Code = new XamlDirective (nss, "Code", XT<string> (), null, AllowedMemberLocations.Attribute);
ConnectionId = new XamlDirective (nss, "ConnectionId", XT<string> (), null, AllowedMemberLocations.Any);
FactoryMethod = new XamlDirective (nss, "FactoryMethod", XT<string> (), null, AllowedMemberLocations.Any);
FieldModifier = new XamlDirective (nss, "FieldModifier", XT<string> (), null, AllowedMemberLocations.Attribute);
Initialization = new XamlDirective (nss, "_Initialization", XT<object> (), null, AllowedMemberLocations.Any);
Items = new XamlDirective (nss, "_Items", XT<List<object>> (), null, AllowedMemberLocations.Any);
Key = new XamlDirective (nss, "Key", XT<object> (), null, AllowedMemberLocations.Any);
Lang = new XamlDirective (nssXml, "lang", XT<string> (), null, AllowedMemberLocations.Attribute);
Members = new XamlDirective (nss, "Members", XT<List<MemberDefinition>> (), null, AllowedMemberLocations.MemberElement);
Name = new XamlDirective (nss, "Name", XT<string> (), null, AllowedMemberLocations.Attribute);
PositionalParameters = new XamlDirective (nss, "_PositionalParameters", XT<List<object>> (), null, AllowedMemberLocations.Any);
Space = new XamlDirective (nssXml, "space", XT<string> (), null, AllowedMemberLocations.Attribute);
Subclass = new XamlDirective (nss, "Subclass", XT<string> (), null, AllowedMemberLocations.Attribute);
SynchronousMode = new XamlDirective (nss, "SynchronousMode", XT<string> (), null, AllowedMemberLocations.Attribute);
Shared = new XamlDirective (nss, "Shared", XT<string> (), null, AllowedMemberLocations.Attribute);
TypeArguments = new XamlDirective (nss, "TypeArguments", XT<string> (), null, AllowedMemberLocations.Attribute);
Uid = new XamlDirective (nss, "Uid", XT<string> (), null, AllowedMemberLocations.Attribute);
UnknownContent = new XamlDirective (nss, "_UnknownContent", XT<object> (), null, AllowedMemberLocations.MemberElement) { InternalIsUnknown = true };

AllDirectives = new ReadOnlyCollection<XamlDirective> (new XamlDirective [] {Arguments, AsyncRecords, Base, Class, ClassAttributes, ClassModifier, Code, ConnectionId, FactoryMethod, FieldModifier, Initialization, Items, Key, Lang, Members, Name, PositionalParameters, Space, Subclass, SynchronousMode, Shared, TypeArguments, Uid, UnknownContent});
}

public static IList<string> XamlNamespaces {
get { throw new NotImplementedException (); }
}
public static XamlType XData {
get { throw new NotImplementedException (); }
}

public static IList<string> XmlNamespaces {
get { throw new NotImplementedException (); }
}

public static ReadOnlyCollection<XamlDirective> AllDirectives { get; private set; }

public static XamlDirective Arguments { get; private set; }
public static XamlDirective AsyncRecords { get; private set; }
public static XamlDirective Base { get; private set; }
public static XamlDirective Class { get; private set; }
public static XamlDirective ClassAttributes { get; private set; }
public static XamlDirective ClassModifier { get; private set; }
public static XamlDirective Code { get; private set; }
public static XamlDirective ConnectionId { get; private set; }
public static XamlDirective FactoryMethod { get; private set; }
public static XamlDirective FieldModifier { get; private set; }
public static XamlDirective Initialization { get; private set; }
public static XamlDirective Items { get; private set; }
public static XamlDirective Key { get; private set; }
public static XamlDirective Lang { get; private set; }
public static XamlDirective Members { get; private set; }
public static XamlDirective Name { get; private set; }
public static XamlDirective PositionalParameters { get; private set; }
public static XamlDirective Subclass { get; private set; }
public static XamlDirective SynchronousMode { get; private set; }
public static XamlDirective Shared { get; private set; }
public static XamlDirective Space { get; private set; }
public static XamlDirective TypeArguments { get; private set; }
public static XamlDirective Uid { get; private set; }
public static XamlDirective UnknownContent { get; private set; }

public static ReadOnlyCollection<XamlType> AllTypes { get; private set; }

public static XamlType Array { get; private set; }
public static XamlType Boolean { get; private set; }
public static XamlType Byte { get; private set; }
public static XamlType Char { get; private set; }
public static XamlType Decimal { get; private set; }
public static XamlType Double { get; private set; }
public static XamlType Int16 { get; private set; }
public static XamlType Int32 { get; private set; }
public static XamlType Int64 { get; private set; }
public static XamlType Member { get; private set; }
public static XamlType Null { get; private set; }
public static XamlType Object { get; private set; }
public static XamlType Property { get; private set; }
public static XamlType Reference { get; private set; }
public static XamlType Single { get; private set; }
public static XamlType Static { get; private set; }
public static XamlType String { get; private set; }
public static XamlType TimeSpan { get; private set; }
public static XamlType Type { get; private set; }
public static XamlType Uri { get; private set; }
public static XamlType XData { get; private set; }

internal static bool IsValidXamlName (string name)
{
if (string.IsNullOrEmpty (name))
Expand Down

0 comments on commit 6d9958e

Please sign in to comment.