aboutsummaryrefslogtreecommitdiff
path: root/cs-dotnet/src/gatslist.cs
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2012-11-17 18:10:06 +0000
committerMike Buland <eichlan@xagasoft.com>2012-11-17 18:10:06 +0000
commitf68cfc5a0a8a07a2729636b1a1bedc41d2de738d (patch)
tree40fc14f900b14e5db66b54ddf9b2e8bfb0035dae /cs-dotnet/src/gatslist.cs
parent38f03bf3279c5e0351539777db52bb9f1a4bc614 (diff)
downloadlibgats-f68cfc5a0a8a07a2729636b1a1bedc41d2de738d.tar.gz
libgats-f68cfc5a0a8a07a2729636b1a1bedc41d2de738d.tar.bz2
libgats-f68cfc5a0a8a07a2729636b1a1bedc41d2de738d.tar.xz
libgats-f68cfc5a0a8a07a2729636b1a1bedc41d2de738d.zip
Added XML standard in-code documentation, also GatsList and GatsDictionary
helpers.
Diffstat (limited to '')
-rw-r--r--cs-dotnet/src/gatslist.cs108
1 files changed, 108 insertions, 0 deletions
diff --git a/cs-dotnet/src/gatslist.cs b/cs-dotnet/src/gatslist.cs
index 7d57035..0f93d1e 100644
--- a/cs-dotnet/src/gatslist.cs
+++ b/cs-dotnet/src/gatslist.cs
@@ -13,6 +13,15 @@ using System.Collections.Generic;
13 13
14namespace Com.Xagasoft.Gats 14namespace Com.Xagasoft.Gats
15{ 15{
16 /// <summary>
17 /// Encapsulates a single list of GatsObjects.
18 /// </summary>
19 /// <remarks>
20 /// A list of arbitrary size containing ordered GatsObjects. All standard
21 /// .NET IList, ICollection, and IEnumerable interfaces are implemented,
22 /// so a GatsList should work just like a standard List, but with a few
23 /// extras.
24 /// </remarks>
16 public class GatsList : GatsObject, IList<GatsObject>, 25 public class GatsList : GatsObject, IList<GatsObject>,
17 ICollection<GatsObject>, IEnumerable<GatsObject> 26 ICollection<GatsObject>, IEnumerable<GatsObject>
18// IReadOnlyList<GatsObject>, IReadOnlyCollection<GatsObject>, 27// IReadOnlyList<GatsObject>, IReadOnlyCollection<GatsObject>,
@@ -60,6 +69,105 @@ namespace Com.Xagasoft.Gats
60 } 69 }
61 70
62 // 71 //
72 // Helper functions
73 //
74
75 /// <summary>
76 /// Helper function to add a new GatsString to the list.
77 /// </summary>
78 /// <param name="val">The byte array to be added as a GatsString</param>
79 public void Add( byte[] val )
80 {
81 Add( new GatsString( val ) );
82 }
83
84 /// <summary>
85 /// Helper function to add a new GatsString to the list.
86 /// </summary>
87 /// <remarks>
88 /// The string is encoded UTF-8 by .NETs internal facilities.
89 /// </remarks>
90 /// <param name="val">The string to be added as a GatsString</param>
91 public void Add( string val )
92 {
93 Add( new GatsString( val ) );
94 }
95
96 /// <summary>
97 /// Helper function to add a new GatsInteger to the list.
98 /// </summary>
99 /// <remarks>
100 /// Implicit upcasting should allow all integer types (byte, short,
101 /// int, long), and automatic unboxing should allow all object variants
102 /// to be passed into this method without problem.
103 /// </remarks>
104 /// <param name="val">The long to be added as a GatsInteger</param>
105 public void Add( long val )
106 {
107 Add( new GatsInteger( val ) );
108 }
109
110 /// <summary>
111 /// Helper function to add a new GatsFloat to the list.
112 /// </summary>
113 /// <remarks>
114 /// Implicit upcasting should allow floats and doubles to both be
115 /// accepted by this method. Please note that decimal types are not
116 /// strictly compatible, please see GatsFloat for more details.
117 /// </remarks>
118 /// <param name="val">The double to be added as a GatsFloat</param>
119 public void Add( double val )
120 {
121 Add( new GatsFloat( val ) );
122 }
123
124 /// <summary>
125 /// Helper function to add a new GatsBoolean to the list.
126 /// </summary>
127 /// <param name="val">
128 /// The boolean value to be added as a GatsBoolean
129 /// </param>
130 public void Add( bool val )
131 {
132 Add( new GatsBoolean( val ) );
133 }
134
135 /// <summary>
136 /// Helper to append a GatsNull to the list.
137 /// </summary>
138 public void AddNull()
139 {
140 Add( new GatsNull() );
141 }
142
143 /// <summary>
144 /// Helper to append a GatsDictionary to the list.
145 /// </summary>
146 /// <remarks>
147 /// A new GatsDictionary is constructed, appended to the list, and
148 /// returned.
149 /// </remarks>
150 public GatsDictionary AddDict()
151 {
152 GatsDictionary dict = new GatsDictionary();
153 Add( dict );
154 return dict;
155 }
156
157 /// <summary>
158 /// Helper to append a GatsList to the list.
159 /// </summary>
160 /// <remarks>
161 /// A new GatsList is constructed, appended to the list, and returned.
162 /// </remarks>
163 public GatsList AddList()
164 {
165 GatsList list = new GatsList();
166 Add( list );
167 return list;
168 }
169
170 //
63 // List interface overrides under here. 171 // List interface overrides under here.
64 // 172 //
65 public int IndexOf( GatsObject obj ) 173 public int IndexOf( GatsObject obj )