Files Classes Functions Hierarchy
#include <cfcontainervec.h>
Public Member Functions | |
| void | construct (uintc size) |
| Not necessary for this data structure. | |
| compilationfile * | operator[] (stringc &filename) const |
| Search. | |
| boolc | add (compilationfile *cf) |
| Looks before adding the compilation file. | |
| boolc | remove (stringc &filename) |
| If found, sets the pointer to zero. | |
| void | reset () |
| Reset the iterator. | |
| boolc | operator! () |
| Are there more elements? | |
| void | operator++ () |
| Increment. | |
| compilationfile * | operator() () const |
| Access the current iterator element. | |
Both an iterator and an access similar to a map, its a just do it iterator. Its got terrible complexity O(N).
Implements interface
// Resize the container. void construct(uintc size); // Search. compilationfile* operator [] (stringc & filename) const; // Looks before adding the compilation file. boolc add(compilationfile* cf); // Remove the element. boolc remove(stringc & filename); // Reset the iterator. void reset(); // Are there more elements? boolc operator ! (); // Increment. void operator ++ (); // Access the current iterator element. compilationfile* operator() () const;
Definition at line 37 of file cfcontainervec.h.
| boolc cfcontainervec::add | ( | compilationfile * | cf | ) |
Looks before adding the compilation file.
Definition at line 22 of file cfcontainervec.cpp.
References compilationfile::filename.
00023 { 00024 assert(cf); 00025 00026 //compilationfile* x = access(cf->filename); 00027 compilationfile* x = (*this)[cf->filename]; 00028 if (x!=0) 00029 return false; 00030 00031 vi.push_back(cf); 00032 00033 return true; 00034 }
| void cfcontainervec::construct | ( | uintc | size | ) | [inline] |
| boolc cfcontainervec::operator! | ( | ) |
Are there more elements?
Definition at line 41 of file cfcontainervec.cpp.
00042 { 00043 // As this operator is called before accessing and ++, 00044 // it has the responsibility of incrementing to a valid state. 00045 uint currentmax=vi.size(); 00046 if (current >=currentmax) 00047 return false; 00048 00049 while (vi[current]==0) 00050 { 00051 ++current; 00052 if (current==currentmax) 00053 return false; 00054 } 00055 00056 return true; 00057 00058 /* 00059 while ((current<currentmax)&&(vi[current]==0)) 00060 { 00061 ++current; 00062 } 00063 */ 00064 00065 // return (current < currentmax); 00066 }
| compilationfile * cfcontainervec::operator() | ( | ) | const |
| void cfcontainervec::operator++ | ( | ) |
| compilationfile * cfcontainervec::operator[] | ( | stringc & | filename | ) | const |
Search.
Definition at line 7 of file cfcontainervec.cpp.
00008 { 00009 uint imax=vi.size(); 00010 for (uint i=0; i<imax; ++i) 00011 { 00012 if (!vi[i]) 00013 continue; 00014 00015 if (vi[i]->filename == filename) 00016 return vi[i]; 00017 } 00018 00019 return 0; 00020 }
If found, sets the pointer to zero.
Definition at line 80 of file cfcontainervec.cpp.
00081 { 00082 //cout << filename << endl; 00083 //if (filename=="main.h") 00084 // cout << "* main.h" << endl; 00085 00086 uint imax=vi.size(); 00087 for (uint i=0; i<imax; ++i) 00088 { 00089 if (!vi[i]) 00090 continue; 00091 00092 if (vi[i]->filename == filename) 00093 { 00094 vi[i] = 0; 00095 return true; 00096 } 00097 } 00098 00099 return false; 00100 }
| void cfcontainervec::reset | ( | ) |
1.5.8