qaTree/functions/gfunc.cpp
// remove
// removes a specific attribute from project tree
remove
removes a specific attribute from project tree
remove removes a specific attribute from project tree
void rem_attr(qaTree* proj, string cat, string attr_ID) {
   qaTree* categ = find_cat(proj, cat);
   for (size_t child = 0; child < categ->children.size(); child++) {
      if (categ->children[child]->ID.compare(attr_ID) == 0) { 
         categ->children.erase(categ->children.begin()+child);
      }
   }
   if (categ->children.empty()) {
      for (size_t ctg = 0; ctg < proj->cachildren.size(); ctg++) {
         if (proj->cachildren[ctg]->name.compare(categ->name) == 0) {
            proj->cachildren.erase(proj->cachildren.begin()+ctg);
         } 
      }
   free(categ);
   }
}
void rem_attr ( qaTree * proj , string cat , string attr_ID ) { qaTree * categ = find_cat ( proj , cat ) ; for ( size_t child = 0 ; child < categ -> children . size ( ) ; child ++ ) { if ( categ -> children [ child ] -> ID . compare ( attr_ID ) == 0 ) { categ -> children . erase ( categ -> children . begin ( ) + child ) ; } } if ( categ -> children . empty ( ) ) { for ( size_t ctg = 0 ; ctg < proj -> cachildren . size ( ) ; ctg ++ ) { if ( proj -> cachildren [ ctg ] -> name . compare ( categ -> name ) == 0 ) { proj -> cachildren . erase ( proj -> cachildren . begin ( ) + ctg ) ; } } free ( categ ) ; } }
remove
removes a specific attribute from project tree
remove removes a specific attribute from project tree
// remove attr so that no trace of it exists furthermore // if this deletion results in an empty category, delete category // memory things