#include <Info.h>
Collaboration diagram for FieldNameList:
Public Member Functions | |
FieldNameList () | |
~FieldNameList () | |
char * | nextFieldName () |
void | resetIter () |
int | size () |
DbRetVal | append (const char *name) |
appends field name to the list | |
DbRetVal | remove (const char *name) |
removes field name from the list | |
DbRetVal | removeAll () |
Definition at line 31 of file Info.h.
FieldNameList::FieldNameList | ( | ) | [inline] |
FieldNameList::~FieldNameList | ( | ) | [inline] |
DbRetVal FieldNameList::append | ( | const char * | name | ) |
appends field name to the list
name | field name |
Definition at line 240 of file FieldList.cxx.
References FieldNameNode::fldName, FieldNameNode::next, and OK.
Referenced by CacheTableLoader::load().
00241 { 00242 FieldNameNode *newNode = new FieldNameNode(); 00243 strcpy(newNode->fldName, name); 00244 newNode->next = NULL; 00245 //If this is the first node, set it as head 00246 if (NULL == head) { head = newNode; return OK; } 00247 00248 FieldNameNode *it = head; 00249 while (NULL != it->next) it = it->next; 00250 it->next = newNode; 00251 return OK; 00252 }
Here is the caller graph for this function:
char * FieldNameList::nextFieldName | ( | ) |
Definition at line 311 of file FieldList.cxx.
References FieldNameNode::fldName, and FieldNameNode::next.
Referenced by CatalogTableFIELD::getFieldPtrs(), and CatalogTableINDEXFIELD::insert().
00312 { 00313 if (iter == NULL) return NULL; 00314 FieldNameNode *node = iter; 00315 iter = iter ->next; 00316 return node->fldName; 00317 }
Here is the caller graph for this function:
DbRetVal FieldNameList::remove | ( | const char * | name | ) |
removes field name from the list
name | field name |
Definition at line 255 of file FieldList.cxx.
References ErrNotExists, ErrNotFound, FieldNameNode::fldName, FieldNameNode::next, OK, and printError.
00256 { 00257 if (NULL == head) 00258 { 00259 printError(ErrNotExists, "List is empty"); 00260 return ErrNotExists; 00261 } 00262 FieldNameNode *ite = head, *prev = head; 00263 while (ite->next != NULL) 00264 { 00265 if (0 == strcmp(ite->fldName, name)) 00266 { 00267 prev->next = ite->next; 00268 delete ite; 00269 } 00270 prev = ite; 00271 ite = ite->next; 00272 } 00273 if( ite == head) // there is only one node in the list 00274 { 00275 if (0 == strcmp(ite->fldName, name)) 00276 { 00277 delete head; 00278 head = NULL; 00279 return OK; 00280 } 00281 00282 } 00283 if( prev == head) // there are only two node in the list 00284 { 00285 if (0 == strcmp(ite->fldName, name)) 00286 { 00287 head->next = NULL; 00288 delete ite; 00289 return OK; 00290 } 00291 } 00292 printError(ErrNotFound, "Field name %s not present in the list", name); 00293 return ErrNotFound; 00294 }
DbRetVal FieldNameList::removeAll | ( | ) |
Definition at line 296 of file FieldList.cxx.
References FieldNameNode::next, and OK.
Referenced by IndexInitInfo::~IndexInitInfo().
00297 { 00298 if (NULL == head) return OK; 00299 FieldNameNode *iter = head, *next = head; 00300 while (iter->next != NULL) 00301 { 00302 next = iter->next; 00303 delete iter; 00304 iter = next; 00305 } 00306 delete iter; //deleting the last element 00307 head = NULL; 00308 return OK; 00309 }
Here is the caller graph for this function:
void FieldNameList::resetIter | ( | ) | [inline] |
Definition at line 39 of file Info.h.
Referenced by CatalogTableFIELD::getFieldPtrs(), and CatalogTableINDEXFIELD::insert().
Here is the caller graph for this function:
int FieldNameList::size | ( | ) |
Definition at line 319 of file FieldList.cxx.
References FieldNameNode::next.
00320 { 00321 FieldNameNode *it = head; 00322 if (NULL == it) return 0; 00323 int count = 1; 00324 while (NULL != it->next) {it = it->next; count++;} 00325 return count; 00326 }