FDO .NET API Reference | Feature Data Objects |
00001 /* 00002 * Copyright (C) 2004-2006 Autodesk, Inc. 00003 * 00004 * This library is free software; you can redistribute it and/or 00005 * modify it under the terms of version 2.1 of the GNU Lesser 00006 * General Public License as published by the Free Software Foundation. 00007 * 00008 * This library is distributed in the hope that it will be useful, 00009 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00011 * Lesser General Public License for more details. 00012 * 00013 * You should have received a copy of the GNU Lesser General Public 00014 * License along with this library; if not, write to the Free Software 00015 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00016 * 00017 */ 00018 00019 #pragma once 00020 00021 #include "Runtime\Disposable.h" 00022 00023 class FdoStringCollection; 00024 00025 BEGIN_NAMESPACE_OSGEO_COMMON 00026 public __gc class StringElement; 00027 00028 /// \ingroup (OSGeoFDOCommon) 00029 /// \brief 00030 /// StringCollection is a collection of name-value pairs. 00031 [System::Reflection::DefaultMemberAttribute("RealTypeItem")] 00032 public __sealed __gc class StringCollection : public NAMESPACE_OSGEO_RUNTIME::Disposable, public System::Collections::IList 00033 { 00034 /// \cond DOXYGEN-IGNORE 00035 private: 00036 /// \brief 00037 /// A Nested class defined to provide enumeration of Dictionary elements 00038 /// 00039 /// Enumerators can be used to read the data in the collection, 00040 /// but they cannot be used to modify the underlying collection. 00041 /// 00042 /// An enumerator remains valid as long as the collection remains unchanged. 00043 /// If changes are made to the collection, such as adding, modifying, or deleting 00044 /// elements, the enumerator is irrecoverably invalidated and the next call to 00045 /// MoveNext or Reset throws an InvalidOperationException. If the collection is 00046 /// modified between MoveNext and Current, Current returns the element that it is 00047 /// set to, even if the enumerator is already invalidated. 00048 /// 00049 /// The enumerator does not have exclusive access to the collection; therefore, 00050 /// enumerating through a collection is intrinsically not a thread-safe procedure. 00051 /// Even when a collection is synchronized, other threads can still modify the 00052 /// collection, which causes the enumerator to throw an exception. To guarantee 00053 /// thread safety during enumeration, you can either lock the collection during 00054 /// the entire enumeration or catch the exceptions resulting from changes made 00055 /// by other threads. 00056 /// 00057 __gc class Enumerator : public System::Collections::IEnumerator 00058 { 00059 private: 00060 StringCollection* m_pCol; 00061 System::Int32 m_nIdx; 00062 00063 public: 00064 /// \brief 00065 /// Constructs a new Collection Enumerator 00066 /// 00067 /// \param elements 00068 /// Input The String collection to enumerate. 00069 /// 00070 Enumerator(StringCollection* elements) : m_pCol(elements), m_nIdx(-1) 00071 { 00072 00073 } 00074 00075 /// \brief 00076 /// Retrieves the current String object at the enumerator location 00077 /// 00078 /// \return 00079 /// Retuns the current String referenced by the enumerator 00080 /// 00081 __property System::Object* get_Current(); 00082 00083 /// \brief 00084 /// Initially, the enumerator is positioned before the first element in the collection. 00085 /// At this position, calling the Current property throws an exception. 00086 /// Therefore, you must call the MoveNext method to advance the enumerator 00087 /// to the first element of the collection before reading the value of Current. 00088 // If MoveNext passes the end of the collection, the enumerator is positioned 00089 /// after the last element in the collection and MoveNext returns false. 00090 /// When the enumerator is at this position, subsequent calls to MoveNext also return false. 00091 /// If the last call to MoveNext returned false, calling Current throws an exception. 00092 // To set Current to the first element of the collection again, you can call Reset 00093 /// followed by MoveNext. 00094 /// 00095 /// \return 00096 /// Retuns true if the Enumerator is able to move to a valid string element 00097 /// otherwise false. 00098 /// 00099 System::Boolean MoveNext(); 00100 00101 /// \brief 00102 /// Initially, the enumerator is positioned before the first element in the collection. 00103 /// The Reset method brings the enumerator back to this position. 00104 /// 00105 System::Void Reset(); 00106 }; 00107 00108 public private: 00109 inline FdoStringCollection* GetImpObj(); 00110 00111 private: 00112 // System::Collections::ICollection interface properties 00113 __property System::Object* System::Collections::ICollection::get_SyncRoot(); 00114 __property System::Boolean System::Collections::ICollection::get_IsSynchronized(); 00115 00116 // System::Collections::ICollection interface methods 00117 System::Void System::Collections::ICollection::CopyTo(System::Array* array,System::Int32 index); 00118 00119 // System::Collections::IList interface properties 00120 __property System::Boolean System::Collections::IList::get_IsFixedSize(); 00121 __property System::Boolean System::Collections::IList::get_IsReadOnly(); 00122 __property Object* System::Collections::IList::get_Item(System::Int32 index); 00123 __property System::Void System::Collections::IList::set_Item(System::Int32 index, Object* value); 00124 00125 // System::Collections::IList interface methods 00126 System::Int32 System::Collections::IList::Add(Object* value); 00127 System::Boolean System::Collections::IList::Contains(Object* value); 00128 System::Int32 System::Collections::IList::IndexOf(Object* value); 00129 System::Void System::Collections::IList::Insert(System::Int32 index, Object* value); 00130 System::Void System::Collections::IList::Remove(Object* value); 00131 00132 /// \endcond 00133 00134 public: 00135 /// \brief 00136 /// Constructs a new empty string collection 00137 /// 00138 StringCollection(); 00139 00140 /// \brief 00141 /// Creates a copy of string collection 00142 /// 00143 /// \param collection 00144 /// Input the source collection 00145 /// 00146 StringCollection(StringCollection* collection); 00147 00148 /// \brief 00149 /// Creates a string collection that is tokenized from a string. 00150 /// The collection contains an element for each token. 00151 /// 00152 /// \param data 00153 /// Input the string to tokenize. 00154 /// 00155 /// \param delimiters 00156 /// Input list of single character token delimiters. 00157 /// 00158 StringCollection(String* data, String* delimiters); 00159 00160 /// \brief 00161 /// Creates a string collection that is tokenized from a string. 00162 /// The collection contains an element for each token. 00163 /// 00164 /// \param data 00165 /// Input the string to tokenize. 00166 /// 00167 /// \param delimiters 00168 /// Input list of single character token delimiters. 00169 /// 00170 /// \param nullTokens 00171 /// true: include zero-length tokens in the collection. 00172 /// false: exclude zero-length tokens 00173 /// 00174 StringCollection(String* data, String* delimiters, Boolean nullTokens); 00175 00176 /// \brief 00177 /// Constructs a String Collection based on an unmanaged instance of the object 00178 /// 00179 /// \param unmanaged 00180 /// Input A Pointer to the unmanaged collection. 00181 /// 00182 /// \param autoDelete 00183 /// Input Indicates if the constructed collection should be automatically deleted 00184 /// once it no longer referenced. 00185 /// 00186 StringCollection(System::IntPtr unmanaged, System::Boolean autoDelete); 00187 00188 /// \brief 00189 /// Gets the count of items in collection. 00190 /// 00191 /// \return 00192 /// Returns the number of items in the collection. 00193 /// 00194 __property System::Int32 get_Count(System::Void); 00195 00196 /// \brief 00197 /// Gets an enumerator that can iterate through a collection. 00198 /// 00199 /// \return 00200 /// Returns an enumerator on the dictionary. 00201 /// 00202 __sealed System::Collections::IEnumerator* GetEnumerator(System::Void); 00203 00204 /// \brief 00205 /// Removes the index-th StringElement from this collection. 00206 /// 00207 /// \param index 00208 /// Input index of the element to remove. 00209 /// 00210 System::Void RemoveAt(System::Int32 index); 00211 00212 /// \brief 00213 /// Removes all elements from the collection. 00214 /// 00215 System::Void Clear(); 00216 00217 /// \brief 00218 /// Adds a StringElement object into the collection. 00219 /// 00220 /// \param value 00221 /// Input the StringElement object to add. 00222 /// 00223 /// \return 00224 /// Returns the position into which the new element was inserted. 00225 /// 00226 System::Int32 Add(StringElement* value); 00227 00228 /// \brief 00229 /// Appends the strings from src to the end of this collection. 00230 /// 00231 /// \param collection 00232 /// Input the source collection 00233 /// 00234 System::Void Append(StringCollection* collection); 00235 00236 /// \brief 00237 /// Gets a String in the collection. 00238 /// 00239 /// \param index 00240 /// Input index of the String to retrieve. 00241 /// 00242 /// \return 00243 /// Returns the requested String. 00244 /// 00245 __property System::String* get_String(System::Int32 index); 00246 00247 /// \brief 00248 /// Determines the index of a specific StringElement object. 00249 /// 00250 /// \param value 00251 /// Input the StringElement object to locate in the collection. 00252 /// 00253 /// \return 00254 /// The index of value if found in the collection; otherwise, -1. 00255 /// 00256 System::Int32 IndexOf(StringElement* value); 00257 00258 /// \brief 00259 /// Inserts a StringElement object into the collection at the specified position. 00260 /// 00261 /// \param index 00262 /// Input the zero-based index at which value should be inserted. 00263 /// 00264 /// \param value 00265 /// Input the StringElement object to insert. 00266 /// 00267 System::Void Insert(System::Int32 index, StringElement* value); 00268 00269 /// \brief 00270 /// Removes the first occurrence of a specific StringElement object. 00271 /// 00272 /// \param value 00273 /// Input the StringElement object to remove from the collection. 00274 /// 00275 System::Void Remove(StringElement* value); 00276 00277 /// \brief 00278 /// Determines whether the collection contains a specific StringElement object. 00279 /// 00280 /// \param value 00281 /// Input The StringElement object to search in the collection. 00282 /// 00283 /// \return 00284 /// Returns true if the value is found in the collection; otherwise, false. 00285 /// 00286 System::Boolean Contains(StringElement* value); 00287 00288 /// \brief 00289 /// Copies the elements of the collection to an array. 00290 /// 00291 /// \param array 00292 /// Output the one-dimensional Array that is the destination of the elements copied from this collection. 00293 /// 00294 /// \param index 00295 /// Input an integer that represents the index in array at which copying begins. 00296 /// 00297 System::Void CopyTo(StringElement* array[],System::Int32 index); 00298 00299 /// \brief 00300 /// Gets a StringElement in the collection. 00301 /// 00302 /// \param index 00303 /// Input index of the StringElement to retrieve. 00304 /// 00305 /// \return 00306 /// Returns the StringElement at the specified index 00307 /// 00308 __property StringElement* get_RealTypeItem(System::Int32 index); 00309 00310 /// \brief 00311 /// Sets the value of the StringElement at the specified index 00312 /// 00313 /// \param index 00314 /// Input index of the StringElement to set. 00315 /// 00316 /// \param value 00317 /// Input the value of the StringElement 00318 /// 00319 __property System::Void set_RealTypeItem(System::Int32 index, StringElement* value); 00320 00321 /// \brief 00322 /// Gets a StringElement in the collection. 00323 /// 00324 /// \param index 00325 /// Input index of the StringElement to retrieve. 00326 /// 00327 /// \return 00328 /// Returns the StringElement at the specified index 00329 /// 00330 __property StringElement* get_Item(System::Int32 index); 00331 00332 /// \brief 00333 /// Sets the value of the StringElement at the specified index 00334 /// 00335 /// \param index 00336 /// Input index of the StringElement to set. 00337 /// 00338 /// \param value 00339 /// Input the value of the string 00340 /// 00341 __property System::Void set_Item(System::Int32 index, StringElement* value); 00342 00343 /// \cond DOXYGEN-IGNORE 00344 protected: 00345 System::Void ReleaseUnmanagedObject(); 00346 /// \endcond 00347 }; 00348 00349 END_NAMESPACE_OSGEO_COMMON 00350 00351
Comments or suggestions? Send us feedback. |