aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/DOMap.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/DOMap.cs (renamed from OpenSim/ApplicationPlugins/Rest/RestXmlWriter.cs)76
1 files changed, 51 insertions, 25 deletions
diff --git a/OpenSim/ApplicationPlugins/Rest/RestXmlWriter.cs b/OpenSim/Framework/DOMap.cs
index 283fa2e..755e129 100644
--- a/OpenSim/ApplicationPlugins/Rest/RestXmlWriter.cs
+++ b/OpenSim/Framework/DOMap.cs
@@ -25,48 +25,74 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System;
29using System.Collections;
30using System.Collections.Generic;
28using System.IO; 31using System.IO;
29using System.Text; 32using System.Text;
30using System.Xml; 33using System.Xml;
34using System.Xml.Schema;
35using System.Xml.Serialization;
36using OpenMetaverse;
37using OpenMetaverse.StructuredData;
31 38
32namespace OpenSim.ApplicationPlugins.Rest 39namespace OpenSim.Framework
33{ 40{
34 public class RestXmlWriter: XmlTextWriter 41 /// <summary>
42 /// This class stores and retrieves dynamic objects.
43 /// </summary>
44 /// <remarks>
45 /// Experimental - DO NOT USE.
46 /// </remarks>
47 public class DOMap
35 { 48 {
36 private StringWriter m_sw = null; 49 private IDictionary<string, object> m_map;
37 50
38 public RestXmlWriter(StringWriter sw) : base(sw) 51 public void Add(string key, object dynObj)
39 {
40 m_sw = sw;
41 Formatting = Formatting.Indented;
42 }
43
44 public RestXmlWriter(TextWriter textWriter) : base(textWriter)
45 { 52 {
46 } 53 DAMap.ValidateKey(key);
47 54
48 public RestXmlWriter(Stream stream) 55 lock (this)
49 : this(stream, Encoding.UTF8) 56 {
50 { 57 if (m_map == null)
51 } 58 m_map = new Dictionary<string, object>();
52 59
53 public RestXmlWriter(Stream stream, Encoding enc) : base(stream, enc) 60 m_map.Add(key, dynObj);
54 { 61 }
55 } 62 }
56 63
57 public override void WriteStartDocument() 64 public bool ContainsKey(string key)
58 { 65 {
66 return Get(key) != null;
59 } 67 }
60 68
61 public override void WriteStartDocument(bool standalone) 69 /// <summary>
70 /// Get a dynamic object
71 /// </summary>
72 /// <remarks>
73 /// Not providing an index method so that users can't casually overwrite each other's objects.
74 /// </remarks>
75 /// <param name='key'></param>
76 public object Get(string key)
62 { 77 {
78 lock (this)
79 {
80 if (m_map == null)
81 return null;
82 else
83 return m_map[key];
84 }
63 } 85 }
64 86
65 public override string ToString() 87 public bool Remove(string key)
66 { 88 {
67 Flush(); 89 lock (this)
68 Close(); 90 {
69 return m_sw.ToString(); 91 if (m_map == null)
92 return false;
93 else
94 return m_map.Remove(key);
95 }
70 } 96 }
71 } 97 }
72} 98} \ No newline at end of file