14using System.Runtime.InteropServices;
16public class CharArray : IDisposable, System.Collections.IEnumerable
17, System.Collections.Generic.IList<char>
19 private Object locker =
new Object();
20 private HandleRef swigCPtr;
22 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
25 swigCPtr =
new HandleRef(
this, cPtr);
27 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
29 return (obj ==
null) ?
new HandleRef(
null, IntPtr.Zero) : obj.swigCPtr;
38 global::System.GC.SuppressFinalize(
this);
41 protected virtual void Dispose(
bool disposing) {
43 if (swigCPtr.Handle != global::System.IntPtr.Zero) {
48 swigCPtr =
new global::System.Runtime.InteropServices.HandleRef(
null, global::System.IntPtr.Zero);
53 public CharArray(System.Collections.ICollection c) : this() {
55 throw new ArgumentNullException(
"c");
56 foreach (
char element
in c) {
62 : this(
GlobalsPINVOKE.new_CharArray__SWIG_0(), bGCMemory_Own || MemoryManager.GetMemoryManager().GetCurrentTransaction() == null)
64 MemoryTransaction mTr = MemoryManager.GetMemoryManager().GetCurrentTransaction();
65 if (!bGCMemory_Own &&
null != mTr)
67 mTr.AddObject(
new CharArray(swigCPtr.Handle,
true));
73 MemoryTransaction mTr = MemoryManager.GetMemoryManager().GetCurrentTransaction();
74 if (!bGCMemory_Own &&
null != mTr)
76 mTr.AddObject(
new CharArray(swigCPtr.Handle,
true));
81 public CharArray(
int capacity,
bool bGCMemory_Own =
false) : this(
GlobalsPINVOKE.new_CharArray__SWIG_2(capacity), bGCMemory_Own || MemoryManager.GetMemoryManager().GetCurrentTransaction() == null) {
82 MemoryTransaction mTr = MemoryManager.GetMemoryManager().GetCurrentTransaction();
83 if (!bGCMemory_Own &&
null != mTr)
85 mTr.AddObject(
new CharArray(swigCPtr.Handle,
true));
102 public char this[
int index] {
104 return getitem(index);
107 setitem(index,
value);
113 return (
int)capacity();
117 throw new ArgumentOutOfRangeException(
"Capacity");
118 reserve((uint)
value);
139 public void CopyTo(
char[] array,
int arrayIndex)
144 public void CopyTo(
int index,
char[] array,
int arrayIndex,
int count)
147 throw new ArgumentNullException(
"array");
149 throw new ArgumentOutOfRangeException(
"index",
"Value is less than zero");
151 throw new ArgumentOutOfRangeException(
"arrayIndex",
"Value is less than zero");
153 throw new ArgumentOutOfRangeException(
"count",
"Value is less than zero");
155 throw new ArgumentException(
"Multi dimensional array.",
"array");
156 if (index+count > this.
Count || arrayIndex+count > array.Length)
157 throw new ArgumentException(
"Number of elements to copy is too large.");
158 for (
int i=0; i<count; i++)
159 array.SetValue(getitemcopy(index+i), arrayIndex+i);
162 System.Collections.Generic.IEnumerator<
char> System.Collections.Generic.IEnumerable<
char>.GetEnumerator() {
163 return new CharArrayEnumerator(
this);
166 System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() {
167 return new CharArrayEnumerator(
this);
180 , System.Collections.Generic.IEnumerator<char>
183 private int currentIndex;
184 private object currentObject;
185 private int currentSize;
188 collectionRef = collection;
190 currentObject =
null;
191 currentSize = collectionRef.
Count;
197 if (currentIndex == -1)
198 throw new InvalidOperationException(
"Enumeration not started.");
199 if (currentIndex > currentSize - 1)
200 throw new InvalidOperationException(
"Enumeration finished.");
201 if (currentObject ==
null)
202 throw new InvalidOperationException(
"Collection modified.");
203 return (
char)currentObject;
208 object System.Collections.IEnumerator.Current {
215 int size = collectionRef.
Count;
216 bool moveOkay = (currentIndex+1 < size) && (size == currentSize);
219 currentObject = collectionRef[currentIndex];
221 currentObject =
null;
228 currentObject =
null;
229 if (collectionRef.
Count != currentSize) {
230 throw new InvalidOperationException(
"Collection modified.");
236 currentObject =
null;
250 private uint size() {
256 private uint capacity() {
257 uint ret = GlobalsPINVOKE.CharArray_capacity(swigCPtr);
258 if (GlobalsPINVOKE.SWIGPendingException.Pending)
throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
262 private void reserve(uint n) {
263 GlobalsPINVOKE.CharArray_reserve(swigCPtr, n);
264 if (GlobalsPINVOKE.SWIGPendingException.Pending)
throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
272 private char getitemcopy(
int index) {
278 private char getitem(
int index) {
279 char ret = GlobalsPINVOKE.CharArray_getitem(swigCPtr, index);
280 if (GlobalsPINVOKE.SWIGPendingException.Pending)
throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
284 private void setitem(
int index,
char val) {
285 GlobalsPINVOKE.CharArray_setitem(swigCPtr, index, val);
286 if (GlobalsPINVOKE.SWIGPendingException.Pending)
throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
296 CharArray ret = (cPtr == global::System.IntPtr.Zero) ?
null :
new CharArray(cPtr,
false);
323 CharArray ret = (cPtr == global::System.IntPtr.Zero) ?
null :
new CharArray(cPtr,
true);
CharArrayEnumerator(CharArray collection)
void SetRange(int index, CharArray values)
virtual void Dispose(bool disposing)
void CopyTo(int index, char[] array, int arrayIndex, int count)
static HandleRef getCPtr(CharArray obj)
void CopyTo(char[] array)
CharArray GetRange(int index, int count)
CharArray(bool bGCMemory_Own=false)
void AddRange(CharArray values)
CharArrayEnumerator GetEnumerator()
CharArray(int capacity, bool bGCMemory_Own=false)
CharArray(CharArray other, bool bGCMemory_Own=false)
void resize(uint logicalLength)
CharArray(IntPtr cPtr, bool cMemoryOwn)
void RemoveRange(int index, int count)
void Insert(int index, char x)
int LastIndexOf(char value)
bool Contains(char value)
void CopyTo(char[] array, int arrayIndex)
CharArray(System.Collections.ICollection c)
void InsertRange(int index, CharArray values)
void Reverse(int index, int count)
static CharArray Repeat(char value, int count)
static global::System.Exception Retrieve()
static void CharArray_Clear(global::System.Runtime.InteropServices.HandleRef jarg1)
static bool CharArray_Contains(global::System.Runtime.InteropServices.HandleRef jarg1, char jarg2)
static void CharArray_resize(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2)
static void CharArray_SetRange(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, global::System.Runtime.InteropServices.HandleRef jarg3)
static int CharArray_LastIndexOf(global::System.Runtime.InteropServices.HandleRef jarg1, char jarg2)
static global::System.IntPtr CharArray_Repeat(char jarg1, int jarg2)
static global::System.IntPtr CharArray_GetRange(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, int jarg3)
static int CharArray_IndexOf(global::System.Runtime.InteropServices.HandleRef jarg1, char jarg2)
static uint CharArray_size(global::System.Runtime.InteropServices.HandleRef jarg1)
static void CharArray_RemoveRange(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, int jarg3)
static void CharArray_AddRange(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2)
static void CharArray_InsertRange(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, global::System.Runtime.InteropServices.HandleRef jarg3)
static void CharArray_Insert(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, char jarg3)
static void CharArray_Reverse__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, int jarg3)
static void delete_CharArray(global::System.Runtime.InteropServices.HandleRef jarg1)
static bool CharArray_Remove(global::System.Runtime.InteropServices.HandleRef jarg1, char jarg2)
static void CharArray_RemoveAt(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2)
static void CharArray_Reverse__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1)
static char CharArray_getitemcopy(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2)
static void CharArray_Add(global::System.Runtime.InteropServices.HandleRef jarg1, char jarg2)