Skip to content

Commit

Permalink
2002-07-24 Tim Coleman <tim@timcoleman.com>
Browse files Browse the repository at this point in the history
        * CodeIdentifier.cs:
        * IXmlSerializable.cs:
        * XmlSerializationCollectionFixupCallback.cs:
        * XmlSerializationFixupCallback.cs:
        * XmlSerializationReadCallback.cs:
        * XmlSerializationReader.cs:
        * XmlSerializationWriteCallback.cs:
                Add new classes.
        * XmlSchemas.cs
        * CodeIdentifiers.cs:
                Implement some of these classes
        * XmlCodeExporter.cs:
                Fix return type of a function

svn path=/trunk/mcs/; revision=6157
  • Loading branch information
Tim Coleman committed Jul 24, 2002
1 parent e1acf0f commit 52a614c
Show file tree
Hide file tree
Showing 11 changed files with 639 additions and 30 deletions.
15 changes: 15 additions & 0 deletions mcs/class/System.XML/System.Xml.Serialization/ChangeLog
@@ -1,3 +1,18 @@
2002-07-24 Tim Coleman <tim@timcoleman.com>
* CodeIdentifier.cs:
* IXmlSerializable.cs:
* XmlSerializationCollectionFixupCallback.cs:
* XmlSerializationFixupCallback.cs:
* XmlSerializationReadCallback.cs:
* XmlSerializationReader.cs:
* XmlSerializationWriteCallback.cs:
Add new classes.
* XmlSchemas.cs
* CodeIdentifiers.cs:
Implement some of these classes
* XmlCodeExporter.cs:
Fix return type of a function

2002-07-24 Tim Coleman <tim@timcoleman.com>
* SoapReflectionImporter.cs:
New class added to build
Expand Down
50 changes: 50 additions & 0 deletions mcs/class/System.XML/System.Xml.Serialization/CodeIdentifier.cs
@@ -0,0 +1,50 @@
//
// System.Xml.Serialization.CodeIdentifier.cs
//
// Author:
// Tim Coleman (tim@timcoleman.com)
//
// Copyright (C) Tim Coleman, 2002
//

using System;

namespace System.Xml.Serialization {
public class CodeIdentifier {

public CodeIdentifier ()
{
}

public static string MakeCamel (string identifier)
{
string validIdentifier = MakeValid (identifier);
return (Char.ToLower (validIdentifier[0]) + validIdentifier.Substring (1));
}

public static string MakePascal (string identifier)
{
string validIdentifier = MakeValid (identifier);
return (Char.ToUpper (validIdentifier[0]) + validIdentifier.Substring (1));
}

public static string MakeValid (string identifier)
{
if (identifier == null)
throw new NullReferenceException ();
if (identifier.Length == 0)
return identifier;

string output;

if (Char.IsNumber (identifier[0]))
output = "Item";

foreach (char c in identifier)
if (Char.IsLetterOrDigit (c) || c == '_')
output += c;

return output;
}
}
}
42 changes: 25 additions & 17 deletions mcs/class/System.XML/System.Xml.Serialization/CodeIdentifiers.cs
Expand Up @@ -7,12 +7,16 @@
// Copyright (C) Tim Coleman, 2002
//

using System;
using System.Collections;

namespace System.Xml.Serialization {
public class CodeIdentifiers {

#region Fields

bool useCamelCasing;
static Hashtable table = new Hashtable ();

#endregion

Expand All @@ -35,61 +39,65 @@ public CodeIdentifiers ()

#region Methods

[MonoTODO]
public void Add (string identifier, object value)
{
throw new NotImplementedException ();
table.Add (identifier, value);
}

[MonoTODO]
[MonoTODO ("What does this do?")]
public void AddReserved (string identifier)
{
throw new NotImplementedException ();
}

[MonoTODO]
public void AddUnique (string identifier, object value)
{
throw new NotImplementedException ();
Add (MakeUnique (identifier), value);
}

[MonoTODO]
public void Clear ()
{
throw new NotImplementedException ();
table.Clear ();
}

[MonoTODO]
public bool IsInUse (string identifier)
{
throw new NotImplementedException ();
return (table.ContainsKey (identifier));
}

[MonoTODO]
public string MakeRightCase (string identifier)
{
throw new NotImplementedException ();
if (UseCamelCasing)
return CodeIdentifier.MakeCamel (identifier);
else
return CodeIdentifier.MakePascal (identifier);
}

[MonoTODO]
public string MakeUnique (string identifier)
{
throw new NotImplementedException ();
string uniqueIdentifier = identifier;
int i = 1;

while (IsInUse (uniqueIdentifier)) {
uniqueIdentifier = String.Format ("{0}{1}", identifier, i.ToString ());
i += 1;
}

return uniqueIdentifier;
}

[MonoTODO]
public void Remove (string identifier)
{
throw new NotImplementedException ();
table.Remove (identifier);
}

[MonoTODO]
[MonoTODO ("What does this do?")]
public void RemoveReserved (string identifier)
{
throw new NotImplementedException ();
}

[MonoTODO]
[MonoTODO ("Need to determine how to do the conversion.")]
public object ToArray (Type type)
{
throw new NotImplementedException ();
Expand Down
19 changes: 19 additions & 0 deletions mcs/class/System.XML/System.Xml.Serialization/IXmlSerializable.cs
@@ -0,0 +1,19 @@
//
// System.Xml.Serialization.IXmlSerializable.cs
//
// Author:
// Tim Coleman (tim@timcoleman.com)
//
// Copyright (C) Tim Coleman, 2002
//

using System.Xml.Schema;

namespace System.Xml.Serialization {
public interface IXmlSerializable {

XmlSchema GetSchema ();
void ReadXml (XmlReader reader);
void WriteXml (XmlWriter writer);
}
}
Expand Up @@ -71,7 +71,7 @@ public void ExportMembersMapping (XmlMembersMapping xmlMembersMapping)
}

[MonoTODO]
public XmlQualifiedName ExportTypeMapping (XmlTypeMapping xmlTypeMapping)
public void ExportTypeMapping (XmlTypeMapping xmlTypeMapping)
{
throw new NotImplementedException ();
}
Expand Down
19 changes: 7 additions & 12 deletions mcs/class/System.XML/System.Xml.Serialization/XmlSchemas.cs
Expand Up @@ -15,15 +15,14 @@ public class XmlSchemas : CollectionBase {

#region Fields

Hashtable table;
static Hashtable table = new Hashtable ();

#endregion

#region Constructors

public XmlSchemas ()
{
table = new Hashtable ();
}

#endregion // Constructors
Expand All @@ -37,7 +36,7 @@ public XmlSchemas ()

return (XmlSchema) List [index];
}
set { throw new NotImplementedException (); }
set { List [index] = value; }
}

public XmlSchema this [string ns] {
Expand Down Expand Up @@ -86,28 +85,24 @@ public static bool IsDataSet (XmlSchema schema)
throw new NotImplementedException ();
}

[MonoTODO]
protected override void OnClear ()
{
throw new NotImplementedException ();
table.Clear ();
}

[MonoTODO]
protected override void OnInsert (int index, object value)
{
throw new NotImplementedException ();
{
table [((XmlSchema) value).TargetNamespace] = value;
}

[MonoTODO]
protected override void OnRemove (int index, object value)
{
throw new NotImplementedException ();
table.Remove (value);
}

[MonoTODO]
protected override void OnSet (int index, object oldValue, object newValue)
{
throw new NotImplementedException ();
table [((XmlSchema) oldValue).TargetNamespace] = newValue;
}

public void Remove (XmlSchema schema)
Expand Down
@@ -0,0 +1,17 @@
//
// System.Xml.Serialization.XmlSerializationCollectionFixupCallback.cs:
//
// Author:
// Tim Coleman (tim@timcoleman.com)
//
// Copyright (C) Tim Coleman, 2002
//

using System;

namespace System.Xml.Serialization {

[Serializable]
public delegate void XmlSerializationCollectionFixupCallback (object collection, object collectionItems);
}

@@ -0,0 +1,17 @@
//
// System.Xml.Serialization.XmlSerializationFixupCallback.cs:
//
// Author:
// Tim Coleman (tim@timcoleman.com)
//
// Copyright (C) Tim Coleman, 2002
//

using System;

namespace System.Xml.Serialization {

[Serializable]
public delegate void XmlSerializationFixupCallback (object fixup);
}

@@ -0,0 +1,17 @@
//
// System.Xml.Serialization.XmlSerializationReadCallback.cs:
//
// Author:
// Tim Coleman (tim@timcoleman.com)
//
// Copyright (C) Tim Coleman, 2002
//

using System;

namespace System.Xml.Serialization {

[Serializable]
public delegate object XmlSerializationReadCallback ();
}

0 comments on commit 52a614c

Please sign in to comment.