297 lines
9.5 KiB
C#
297 lines
9.5 KiB
C#
/* ----------------------------------------------------------------------------
|
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
|
* Version 2.0.1
|
|
*
|
|
* Do not make changes to this file unless you know what you are doing--modify
|
|
* the SWIG interface file instead.
|
|
* ----------------------------------------------------------------------------- */
|
|
|
|
namespace cAudio {
|
|
|
|
using System;
|
|
using System.Runtime.InteropServices;
|
|
|
|
public class StringMap : IDisposable
|
|
#if !SWIG_DOTNET_1
|
|
, System.Collections.Generic.IDictionary<string, string>
|
|
#endif
|
|
{
|
|
private HandleRef swigCPtr;
|
|
protected bool swigCMemOwn;
|
|
|
|
internal StringMap(IntPtr cPtr, bool cMemoryOwn) {
|
|
swigCMemOwn = cMemoryOwn;
|
|
swigCPtr = new HandleRef(this, cPtr);
|
|
}
|
|
|
|
internal static HandleRef getCPtr(StringMap obj) {
|
|
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
|
|
}
|
|
|
|
~StringMap() {
|
|
Dispose();
|
|
}
|
|
|
|
public virtual void Dispose() {
|
|
lock(this) {
|
|
if (swigCPtr.Handle != IntPtr.Zero) {
|
|
if (swigCMemOwn) {
|
|
swigCMemOwn = false;
|
|
cAudioCSharpWrapperPINVOKE.delete_StringMap(swigCPtr);
|
|
}
|
|
swigCPtr = new HandleRef(null, IntPtr.Zero);
|
|
}
|
|
GC.SuppressFinalize(this);
|
|
}
|
|
}
|
|
|
|
|
|
public string this[string key] {
|
|
get {
|
|
return getitem(key);
|
|
}
|
|
|
|
set {
|
|
setitem(key, value);
|
|
}
|
|
}
|
|
|
|
public bool TryGetValue(string key, out string value) {
|
|
if (this.ContainsKey(key)) {
|
|
value = this[key];
|
|
return true;
|
|
}
|
|
value = default(string);
|
|
return false;
|
|
}
|
|
|
|
public int Count {
|
|
get {
|
|
return (int)size();
|
|
}
|
|
}
|
|
|
|
public bool IsReadOnly {
|
|
get {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
#if !SWIG_DOTNET_1
|
|
|
|
public System.Collections.Generic.ICollection<string> Keys {
|
|
get {
|
|
System.Collections.Generic.ICollection<string> keys = new System.Collections.Generic.List<string>();
|
|
int size = this.Count;
|
|
if (size > 0) {
|
|
IntPtr iter = create_iterator_begin();
|
|
for (int i = 0; i < size; i++) {
|
|
keys.Add(get_next_key(iter));
|
|
}
|
|
destroy_iterator(iter);
|
|
}
|
|
return keys;
|
|
}
|
|
}
|
|
|
|
public System.Collections.Generic.ICollection<string> Values {
|
|
get {
|
|
System.Collections.Generic.ICollection<string> vals = new System.Collections.Generic.List<string>();
|
|
foreach (System.Collections.Generic.KeyValuePair<string, string> pair in this) {
|
|
vals.Add(pair.Value);
|
|
}
|
|
return vals;
|
|
}
|
|
}
|
|
|
|
public void Add(System.Collections.Generic.KeyValuePair<string, string> item) {
|
|
Add(item.Key, item.Value);
|
|
}
|
|
|
|
public bool Remove(System.Collections.Generic.KeyValuePair<string, string> item) {
|
|
if (Contains(item)) {
|
|
return Remove(item.Key);
|
|
} else {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
public bool Contains(System.Collections.Generic.KeyValuePair<string, string> item) {
|
|
if (this[item.Key] == item.Value) {
|
|
return true;
|
|
} else {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
public void CopyTo(System.Collections.Generic.KeyValuePair<string, string>[] array) {
|
|
CopyTo(array, 0);
|
|
}
|
|
|
|
public void CopyTo(System.Collections.Generic.KeyValuePair<string, string>[] array, int arrayIndex) {
|
|
if (array == null)
|
|
throw new ArgumentNullException("array");
|
|
if (arrayIndex < 0)
|
|
throw new ArgumentOutOfRangeException("arrayIndex", "Value is less than zero");
|
|
if (array.Rank > 1)
|
|
throw new ArgumentException("Multi dimensional array.", "array");
|
|
if (arrayIndex+this.Count > array.Length)
|
|
throw new ArgumentException("Number of elements to copy is too large.");
|
|
|
|
System.Collections.Generic.IList<string> keyList = new System.Collections.Generic.List<string>(this.Keys);
|
|
for (int i = 0; i < keyList.Count; i++) {
|
|
string currentKey = keyList[i];
|
|
array.SetValue(new System.Collections.Generic.KeyValuePair<string, string>(currentKey, this[currentKey]), arrayIndex+i);
|
|
}
|
|
}
|
|
|
|
System.Collections.Generic.IEnumerator<System.Collections.Generic.KeyValuePair<string, string>> System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string, string>>.GetEnumerator() {
|
|
return new StringMapEnumerator(this);
|
|
}
|
|
|
|
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() {
|
|
return new StringMapEnumerator(this);
|
|
}
|
|
|
|
public StringMapEnumerator GetEnumerator() {
|
|
return new StringMapEnumerator(this);
|
|
}
|
|
|
|
// Type-safe enumerator
|
|
/// Note that the IEnumerator documentation requires an InvalidOperationException to be thrown
|
|
/// whenever the collection is modified. This has been done for changes in the size of the
|
|
/// collection but not when one of the elements of the collection is modified as it is a bit
|
|
/// tricky to detect unmanaged code that modifies the collection under our feet.
|
|
public sealed class StringMapEnumerator : System.Collections.IEnumerator,
|
|
System.Collections.Generic.IEnumerator<System.Collections.Generic.KeyValuePair<string, string>>
|
|
{
|
|
private StringMap collectionRef;
|
|
private System.Collections.Generic.IList<string> keyCollection;
|
|
private int currentIndex;
|
|
private object currentObject;
|
|
private int currentSize;
|
|
|
|
public StringMapEnumerator(StringMap collection) {
|
|
collectionRef = collection;
|
|
keyCollection = new System.Collections.Generic.List<string>(collection.Keys);
|
|
currentIndex = -1;
|
|
currentObject = null;
|
|
currentSize = collectionRef.Count;
|
|
}
|
|
|
|
// Type-safe iterator Current
|
|
public System.Collections.Generic.KeyValuePair<string, string> Current {
|
|
get {
|
|
if (currentIndex == -1)
|
|
throw new InvalidOperationException("Enumeration not started.");
|
|
if (currentIndex > currentSize - 1)
|
|
throw new InvalidOperationException("Enumeration finished.");
|
|
if (currentObject == null)
|
|
throw new InvalidOperationException("Collection modified.");
|
|
return (System.Collections.Generic.KeyValuePair<string, string>)currentObject;
|
|
}
|
|
}
|
|
|
|
// Type-unsafe IEnumerator.Current
|
|
object System.Collections.IEnumerator.Current {
|
|
get {
|
|
return Current;
|
|
}
|
|
}
|
|
|
|
public bool MoveNext() {
|
|
int size = collectionRef.Count;
|
|
bool moveOkay = (currentIndex+1 < size) && (size == currentSize);
|
|
if (moveOkay) {
|
|
currentIndex++;
|
|
string currentKey = keyCollection[currentIndex];
|
|
currentObject = new System.Collections.Generic.KeyValuePair<string, string>(currentKey, collectionRef[currentKey]);
|
|
} else {
|
|
currentObject = null;
|
|
}
|
|
return moveOkay;
|
|
}
|
|
|
|
public void Reset() {
|
|
currentIndex = -1;
|
|
currentObject = null;
|
|
if (collectionRef.Count != currentSize) {
|
|
throw new InvalidOperationException("Collection modified.");
|
|
}
|
|
}
|
|
|
|
public void Dispose() {
|
|
currentIndex = -1;
|
|
currentObject = null;
|
|
}
|
|
}
|
|
#endif
|
|
|
|
|
|
public StringMap() : this(cAudioCSharpWrapperPINVOKE.new_StringMap__SWIG_0(), true) {
|
|
}
|
|
|
|
public StringMap(StringMap other) : this(cAudioCSharpWrapperPINVOKE.new_StringMap__SWIG_1(StringMap.getCPtr(other)), true) {
|
|
if (cAudioCSharpWrapperPINVOKE.SWIGPendingException.Pending) throw cAudioCSharpWrapperPINVOKE.SWIGPendingException.Retrieve();
|
|
}
|
|
|
|
private uint size() {
|
|
uint ret = cAudioCSharpWrapperPINVOKE.StringMap_size(swigCPtr);
|
|
return ret;
|
|
}
|
|
|
|
public bool empty() {
|
|
bool ret = cAudioCSharpWrapperPINVOKE.StringMap_empty(swigCPtr);
|
|
return ret;
|
|
}
|
|
|
|
public void Clear() {
|
|
cAudioCSharpWrapperPINVOKE.StringMap_Clear(swigCPtr);
|
|
}
|
|
|
|
private string getitem(string key) {
|
|
string ret = cAudioCSharpWrapperPINVOKE.StringMap_getitem(swigCPtr, key);
|
|
if (cAudioCSharpWrapperPINVOKE.SWIGPendingException.Pending) throw cAudioCSharpWrapperPINVOKE.SWIGPendingException.Retrieve();
|
|
return ret;
|
|
}
|
|
|
|
private void setitem(string key, string x) {
|
|
cAudioCSharpWrapperPINVOKE.StringMap_setitem(swigCPtr, key, x);
|
|
if (cAudioCSharpWrapperPINVOKE.SWIGPendingException.Pending) throw cAudioCSharpWrapperPINVOKE.SWIGPendingException.Retrieve();
|
|
}
|
|
|
|
public bool ContainsKey(string key) {
|
|
bool ret = cAudioCSharpWrapperPINVOKE.StringMap_ContainsKey(swigCPtr, key);
|
|
if (cAudioCSharpWrapperPINVOKE.SWIGPendingException.Pending) throw cAudioCSharpWrapperPINVOKE.SWIGPendingException.Retrieve();
|
|
return ret;
|
|
}
|
|
|
|
public void Add(string key, string val) {
|
|
cAudioCSharpWrapperPINVOKE.StringMap_Add(swigCPtr, key, val);
|
|
if (cAudioCSharpWrapperPINVOKE.SWIGPendingException.Pending) throw cAudioCSharpWrapperPINVOKE.SWIGPendingException.Retrieve();
|
|
}
|
|
|
|
public bool Remove(string key) {
|
|
bool ret = cAudioCSharpWrapperPINVOKE.StringMap_Remove(swigCPtr, key);
|
|
if (cAudioCSharpWrapperPINVOKE.SWIGPendingException.Pending) throw cAudioCSharpWrapperPINVOKE.SWIGPendingException.Retrieve();
|
|
return ret;
|
|
}
|
|
|
|
private IntPtr create_iterator_begin() {
|
|
IntPtr ret = cAudioCSharpWrapperPINVOKE.StringMap_create_iterator_begin(swigCPtr);
|
|
return ret;
|
|
}
|
|
|
|
private string get_next_key(IntPtr swigiterator) {
|
|
string ret = cAudioCSharpWrapperPINVOKE.StringMap_get_next_key(swigCPtr, swigiterator);
|
|
return ret;
|
|
}
|
|
|
|
private void destroy_iterator(IntPtr swigiterator) {
|
|
cAudioCSharpWrapperPINVOKE.StringMap_destroy_iterator(swigCPtr, swigiterator);
|
|
}
|
|
|
|
}
|
|
|
|
}
|