00001 // idep_namearray.h 00002 #ifndef INCLUDED_IDEP_NAMEARRAY 00003 #define INCLUDED_IDEP_NAMEARRAY 00004 00005 // This leaf component defines 1 class: 00006 // idep_NameDep: extensible array of managed character string names. 00007 00008 #include <iosfwd> 00009 00010 class idep_NameArray { 00011 char **d_array_p; // array of dynamically allocated character strings 00012 int d_size; // physical size of array 00013 int d_length; // logical size of array 00014 00015 private: 00016 idep_NameArray(const idep_NameArray&); // not implemented 00017 idep_NameArray& operator=(const idep_NameArray&); // not implemented 00018 00019 public: 00020 // CREATORS 00021 idep_NameArray(int maxEntriesHint = 0); 00022 // Create a variable length array of const character strings. 00023 // The array will be allocated assuming a maximum expected number 00024 // of entries specified by the optional maxEntriesHint argument. 00025 // By default a fairly small array will be allocated. 00026 00027 ~idep_NameArray(); 00028 // Destroy this array including its contained copies of string names. 00029 00030 // MANIPULATORS 00031 int append(const char *newName); 00032 // Append a copy of the specified string to the end of the array. 00033 // The value of the new index is returned. No attempt is made to 00034 // check for repeated string values. 00035 00036 // ACCESSORS 00037 const char *operator[] (int index) const; 00038 // Return a pointer to the specified string. Strings are stored at 00039 // at consecutive non-negative index locations beginning with 0 up 00040 // to one less than the current length. If the index is out of range, 00041 // a null pointer will be returned. 00042 00043 int length() const; 00044 // Return the number of names currently stored in this array. 00045 }; 00046 00047 std::ostream& operator<<(std::ostream& out, const idep_NameArray& array); 00048 // Print the logical contents of this name array to the specified 00049 // output stream (out) in some suitable format. 00050 00051 #endif 00052
1.3.9.1