public bool Equals(ST_VectorBaseType other) { if (other == (ST_VectorBaseType)null) { return(false); } return(this._ooxmlEnumerationValue == other._ooxmlEnumerationValue); }
private T AddNewObject <T>(ST_VectorBaseType type) where T : class, new() { T t = new T(); lock (this) { this.itemsElementNameField.Add(type); this.itemsField.Add(t); } return(t); }
private T GetObjectArray <T>(int p, ST_VectorBaseType type) where T : class { lock (this) { int pos = GetObjectIndex(type, p); if (pos < 0 || pos >= this.itemsField.Count) { return(null); } return(itemsField[pos] as T); } }
private void RemoveObject(ST_VectorBaseType type, int p) { lock (this) { int pos = GetObjectIndex(type, p); if (pos < 0 || pos >= this.itemsField.Count) { return; } itemsElementNameField.RemoveAt(pos); itemsField.RemoveAt(pos); } }
private int SizeOfArray(ST_VectorBaseType type) { lock (this) { int size = 0; for (int i = 0; i < itemsElementNameField.Count; i++) { if (itemsElementNameField[i] == type) { size++; } } return(size); } }
private List <T> GetObjectList <T>(ST_VectorBaseType type) where T : class { lock (this) { List <T> list = new List <T>(); for (int i = 0; i < itemsElementNameField.Count; i++) { if (itemsElementNameField[i] == type) { list.Add(itemsField[i] as T); } } return(list); } }
private void SetObject <T>(ST_VectorBaseType type, int p, T obj) where T : class { lock (this) { int pos = GetObjectIndex(type, p); if (pos < 0 || pos >= this.itemsField.Count) { return; } if (this.itemsField[pos] is T) { this.itemsField[pos] = obj; } else { throw new Exception(string.Format(@"object types are difference, itemsField[{0}] is {1}, and parameter obj is {2}", pos, this.itemsField[pos].GetType().Name, typeof(T).Name)); } } }
private int GetObjectIndex(ST_VectorBaseType type, int p) { int index = -1; int pos = 0; for (int i = 0; i < itemsElementNameField.Count; i++) { if (itemsElementNameField[i] == type) { if (pos == p) { //return itemsField[p] as T; index = i; break; } else { pos++; } } } return(index); }
static ST_VectorBaseType() { ST_VectorBaseType.variant = new ST_VectorBaseType("variant"); ST_VectorBaseType.i1 = new ST_VectorBaseType("i1"); ST_VectorBaseType.i2 = new ST_VectorBaseType("i2"); ST_VectorBaseType.i4 = new ST_VectorBaseType("i4"); ST_VectorBaseType.i8 = new ST_VectorBaseType("i8"); ST_VectorBaseType.ui1 = new ST_VectorBaseType("ui1"); ST_VectorBaseType.ui2 = new ST_VectorBaseType("ui2"); ST_VectorBaseType.ui4 = new ST_VectorBaseType("ui4"); ST_VectorBaseType.ui8 = new ST_VectorBaseType("ui8"); ST_VectorBaseType.r4 = new ST_VectorBaseType("r4"); ST_VectorBaseType.r8 = new ST_VectorBaseType("r8"); ST_VectorBaseType.lpstr = new ST_VectorBaseType("lpstr"); ST_VectorBaseType.lpwstr = new ST_VectorBaseType("lpwstr"); ST_VectorBaseType.bstr = new ST_VectorBaseType("bstr"); ST_VectorBaseType.date = new ST_VectorBaseType("date"); ST_VectorBaseType.filetime = new ST_VectorBaseType("filetime"); ST_VectorBaseType._bool = new ST_VectorBaseType("bool"); ST_VectorBaseType.cy = new ST_VectorBaseType("cy"); ST_VectorBaseType.error = new ST_VectorBaseType("error"); ST_VectorBaseType.clsid = new ST_VectorBaseType("clsid"); ST_VectorBaseType.cf = new ST_VectorBaseType("cf"); }
static ST_VectorBaseType() { variant = new ST_VectorBaseType("variant"); i1 = new ST_VectorBaseType("i1"); i2 = new ST_VectorBaseType("i2"); i4 = new ST_VectorBaseType("i4"); i8 = new ST_VectorBaseType("i8"); ui1 = new ST_VectorBaseType("ui1"); ui2 = new ST_VectorBaseType("ui2"); ui4 = new ST_VectorBaseType("ui4"); ui8 = new ST_VectorBaseType("ui8"); r4 = new ST_VectorBaseType("r4"); r8 = new ST_VectorBaseType("r8"); lpstr = new ST_VectorBaseType("lpstr"); lpwstr = new ST_VectorBaseType("lpwstr"); bstr = new ST_VectorBaseType("bstr"); date = new ST_VectorBaseType("date"); filetime = new ST_VectorBaseType("filetime"); _bool = new ST_VectorBaseType("bool"); cy = new ST_VectorBaseType("cy"); error = new ST_VectorBaseType("error"); clsid = new ST_VectorBaseType("clsid"); cf = new ST_VectorBaseType("cf"); }