Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

SetBuilder Class Reference

Inheritance diagram for SetBuilder

Inheritance graph
[legend]
Collaboration diagram for SetBuilder:

Collaboration graph
[legend]
List of all members.

Public Methods

const cmt_stringbuild (const Symbol& symbol, const cmt_string& tag_name = "")
const cmt_stringclean (const Symbol& symbol, const cmt_string& tag_name = "")

Private Attributes

cmt_string temp

Member Function Documentation

const cmt_string & SetBuilder::build ( const Symbol & symbol,
const cmt_string & tag_name = "" ) [virtual]
 

Reimplemented from ValueBuilder.

Definition at line 1379 of file cmt_symbol.cxx.

01381 {
01382   int show_it = 0;
01383 
01384   static cmt_string previous_temp;
01385   cmt_string new_value;
01386   static const cmt_string empty;
01387 
01388   if (Cmt::get_action () == action_show_set)
01389     {
01390       if (symbol.name == Cmt::get_current_target ())
01391         {
01392           show_it = 1;
01393         }
01394     }
01395 
01396   temp = "";
01397 
01398   for (int i = 0; i < symbol.value_lists.size (); i++)
01399     {
01400       const SymbolValueList& value_list = symbol.value_lists[i];
01401 
01402       if (value_list.discarded) continue;
01403 
01404       if ((value_list.use != 0) &&
01405           (value_list.use->discarded)) continue;
01406 
01407       const int selected = value_list.select_first ();
01408 
01409       if (selected < 0) continue;
01410 
01411       SymbolValue& value = value_list.values[selected];
01412 
01413       if (show_it)
01414         {
01415           cout << "# Package ";
01416           if (value_list.use != 0)
01417             {
01418               cout << value_list.use->package << " " << value_list.use->version;
01419             }
01420         }
01421       
01422         //
01423         // One should accumulate values if it refers to
01424         // itself.
01425         //
01426       
01427       new_value = value.text;
01428       
01429       resolve_value_for_macros (new_value);
01430       
01431       switch (value_list.command_type)
01432         {
01433           case CommandSet :
01434             
01435             if (show_it)
01436               {
01437                 cout << " defines set " << symbol.name << " as ";
01438               }
01439             
01440             if (!value_list.is_reflexive || 
01441                 !symbol.value_is_reflexive (value.text))
01442               {
01443                 resolve_value (new_value, symbol.name, temp);
01444                 temp = new_value;
01445               }
01446             else if (temp == "")
01447               {
01448                 temp = CmtSystem::getenv (symbol.name);
01449               }
01450 
01451             break;
01452           case CommandSetAppend :
01453             
01454             if (show_it)
01455               {
01456                 cout << " appends to set " << symbol.name << " : ";
01457               }
01458             
01459             if (new_value != "")
01460               {
01461                 temp += new_value;
01462               }
01463             
01464             break;
01465           case CommandSetPrepend :
01466             
01467             if (show_it)
01468               {
01469                 cout << " prepends to set " << symbol.name << " : ";
01470               }
01471             
01472             if (new_value != "")
01473               {
01474                 previous_temp = temp;
01475                 temp = new_value;
01476                 temp += previous_temp;
01477               }
01478             
01479             break;
01480           case CommandSetRemove :
01481             
01482             if (show_it)
01483               {
01484                 cout << " removes from set " << symbol.name << " : ";
01485               }
01486             
01487             if (new_value != "")
01488               {
01489                 temp.replace_all (new_value, empty);
01490               }
01491             
01492             break;
01493           case CommandAlias :
01494             
01495             if (show_it)
01496               {
01497                 cout << " defines alias " << symbol.name << " as ";
01498               }
01499             
01500             resolve_value (new_value, symbol.name, temp);
01501             temp = new_value;
01502             
01503             break;
01504         }
01505       
01506       if (show_it)
01507         {
01508           cout << "'" << value.text << "'";
01509           
01510           Tag* selected_tag = value.tag;
01511 
01512           if ((selected_tag == 0) ||
01513               (selected_tag == Tag::get_default ()))
01514             {
01515               cout << " for default tag";
01516             }
01517           else
01518             {
01519               cout << " for tag '" << selected_tag->name << "'";
01520             }
01521 
01522           cout << endl;
01523         }
01524     }
01525 
01526   return (temp);
01527 }

const cmt_string & SetBuilder::clean ( const Symbol & symbol,
const cmt_string & tag_name = "" ) [inline, virtual]
 

Reimplemented from ValueBuilder.

Definition at line 17 of file cmt_symbol.cxx.

00019       {
00020         static const cmt_string empty = "";
00021         return (empty);
00022       }


Member Data Documentation

cmt_string SetBuilder::temp [private]
 

Definition at line 25 of file cmt_symbol.cxx.


The documentation for this class was generated from the following file:
Generated at Thu Apr 11 16:50:56 2002 for CMT by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000