2 // System.Xml.Serialization.CodeIdentifiers
\r
5 // Tim Coleman (tim@timcoleman.com)
\r
7 // Copyright (C) Tim Coleman, 2002
\r
11 using System.Collections;
\r
13 namespace System.Xml.Serialization {
\r
14 public class CodeIdentifiers {
\r
18 bool useCamelCasing;
\r
19 static Hashtable table = new Hashtable ();
\r
23 #region Constructors
\r
25 public CodeIdentifiers ()
\r
29 #endregion // Constructors
\r
33 public bool UseCamelCasing {
\r
34 get { return useCamelCasing; }
\r
35 set { useCamelCasing = value; }
\r
38 #endregion // Properties
\r
42 public void Add (string identifier, object value)
\r
44 table.Add (identifier, value);
\r
47 [MonoTODO ("What does this do?")]
\r
48 public void AddReserved (string identifier)
\r
50 throw new NotImplementedException ();
\r
53 public void AddUnique (string identifier, object value)
\r
55 Add (MakeUnique (identifier), value);
\r
58 public void Clear ()
\r
63 public bool IsInUse (string identifier)
\r
65 return (table.ContainsKey (identifier));
\r
68 public string MakeRightCase (string identifier)
\r
71 return CodeIdentifier.MakeCamel (identifier);
\r
73 return CodeIdentifier.MakePascal (identifier);
\r
76 public string MakeUnique (string identifier)
\r
78 string uniqueIdentifier = identifier;
\r
81 while (IsInUse (uniqueIdentifier)) {
\r
82 uniqueIdentifier = String.Format ("{0}{1}", identifier, i.ToString ());
\r
86 return uniqueIdentifier;
\r
89 public void Remove (string identifier)
\r
91 table.Remove (identifier);
\r
94 [MonoTODO ("What does this do?")]
\r
95 public void RemoveReserved (string identifier)
\r
97 throw new NotImplementedException ();
\r
100 [MonoTODO ("Need to determine how to do the conversion.")]
\r
101 public object ToArray (Type type)
\r
103 throw new NotImplementedException ();
\r
106 #endregion // Methods
\r