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

# MacroBuilder Class Reference

Inheritance diagram for MacroBuilder

[legend]
Collaboration diagram for MacroBuilder:

[legend]
List of all members.

## Public Methods
const cmt_string& | build (const Symbol& symbol, const cmt_string& tag_name = "")
const cmt_string& | clean (const Symbol& symbol, const cmt_string& tag_name = "")
## Private Attributes
cmt_string | temp

## Member Function Documentation

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

| Reimplemented from ValueBuilder. Definition at line 1803 of file cmt_symbol.cxx.
    01805 {
    01806   static cmt_string previous_temp;
    01807   static const cmt_string empty;
    01808   int show_it = 0;
    01809
    01810   if (Cmt::get_action () == action_show_macro)
    01811     {
    01812       if (symbol.name == Cmt::get_current_target ())
    01813         {
    01814           show_it = 1;
    01815         }
    01816     }
    01817
    01818   temp = "";
    01819
    01820   int i;
    01821
    01822   for (i = 0; i < symbol.value_lists.size (); i++)
    01823     {
    01824       const SymbolValueList& value_list = symbol.value_lists[i];
    01825
    01826       if (value_list.discarded) continue;
    01827
    01828       if ((value_list.use != 0) &&
    01829           (value_list.use->discarded)) continue;
    01830
    01831       if (value_list.command_type != CommandMacroPrepend) continue;
    01832
    01833       const int selected = value_list.select_first (tag_name);
    01834
    01835       if (selected < 0) continue;
    01836
    01837       SymbolValue& value = value_list.values[selected];
    01838
    01839       if (show_it)
    01840         {
    01841           cout << "# Package ";
    01842           if (value_list.use != 0)
    01843             {
    01844               cout << value_list.use->package << " " << value_list.use->version;
    01845             }
    01846           cout << " prepends to macro " << symbol.name << " : ";
    01847         }
    01848
    01849       temp += value.text;
    01850
    01851       if (show_it)
    01852         {
    01853           cout << "'" << value.text << "'";
    01854
    01855           Tag* selected_tag = value.tag;
    01856
    01857           if ((selected_tag == 0) ||
    01858               (selected_tag == Tag::get_default ()))
    01859             {
    01860               cout << " for default tag";
    01861             }
    01862           else
    01863             {
    01864               cout << " for tag '" << selected_tag->name << "'";
    01865             }
    01866
    01867           cout << endl;
    01868         }
    01869     }
    01870
    01871   previous_temp = temp;
    01872   temp = "";
    01873
    01874   for (i = 0; i < symbol.value_lists.size (); i++)
    01875     {
    01876       const SymbolValueList& value_list = symbol.value_lists[i];
    01877
    01878       if (value_list.discarded) continue;
    01879
    01880       if ((value_list.use != 0) &&
    01881           (value_list.use->discarded)) continue;
    01882
    01883       if (value_list.command_type != CommandMacro) continue;
    01884
    01885       const int selected = value_list.select_first (tag_name);
    01886
    01887       if (selected >= 0)
    01888         {
    01889           SymbolValue& value = value_list.values[selected];
    01890
    01891           if (show_it)
    01892             {
    01893               cout << "# Package ";
    01894               if (value_list.use != 0)
    01895                 {
    01896                   cout << value_list.use->package << " " << value_list.use->version;
    01897                 }
    01898               cout << " defines macro " << symbol.name << " as ";
    01899             }
    01900
    01901           if (!value_list.is_reflexive ||
    01902               !symbol.value_is_reflexive (value.text))
    01903             {
    01904               temp = value.text;
    01905             }
    01906
    01907           if (show_it)
    01908             {
    01909               cout << "'" << value.text << "'";
    01910
    01911               Tag* selected_tag = value.tag;
    01912
    01913               if ((selected_tag == 0) ||
    01914                   (selected_tag == Tag::get_default ()))
    01915                 {
    01916                   cout << " for default tag";
    01917                 }
    01918               else
    01919                 {
    01920                   cout << " for tag '" << selected_tag->name << "'";
    01921                 }
    01922
    01923               cout << endl;
    01924             }
    01925         }
    01926     }
    01927
    01928   previous_temp += temp;
    01929   temp = previous_temp;
    01930
    01931   for (i = 0; i < symbol.value_lists.size (); i++)
    01932     {
    01933       const SymbolValueList& value_list = symbol.value_lists[i];
    01934
    01935       if (value_list.discarded) continue;
    01936
    01937       if ((value_list.use != 0) &&
    01938           (value_list.use->discarded)) continue;
    01939
    01940       if (value_list.command_type != CommandMacroAppend) continue;
    01941
    01942       const int selected = value_list.select_first (tag_name);
    01943
    01944       if (selected < 0) continue;
    01945
    01946       SymbolValue& value = value_list.values[selected];
    01947
    01948       if (show_it)
    01949         {
    01950           cout << "# Package ";
    01951           if (value_list.use != 0)
    01952             {
    01953               cout << value_list.use->package << " " << value_list.use->version;
    01954             }
    01955           cout << " appends to macro " << symbol.name << " : ";
    01956         }
    01957
    01958       temp += value.text;
    01959
    01960       if (show_it)
    01961         {
    01962           cout << "'" << value.text << "'";
    01963
    01964           Tag* selected_tag = value.tag;
    01965
    01966           if ((selected_tag == 0) ||
    01967               (selected_tag == Tag::get_default ()))
    01968             {
    01969               cout << " for default tag";
    01970             }
    01971           else
    01972             {
    01973               cout << " for tag '" << selected_tag->name << "'";
    01974             }
    01975
    01976           cout << endl;
    01977         }
    01978     }
    01979
    01980   for (i = 0; i < symbol.value_lists.size (); i++)
    01981     {
    01982       const SymbolValueList& value_list = symbol.value_lists[i];
    01983
    01984       if (value_list.discarded) continue;
    01985
    01986       if ((value_list.use != 0) &&
    01987           (value_list.use->discarded)) continue;
    01988
    01989       if ((value_list.command_type != CommandMacroRemove) &&
    01990           (value_list.command_type != CommandMacroRemoveAll)) continue;
    01991
    01992       const int selected = value_list.select_first (tag_name);
    01993
    01994       if (selected < 0) continue;
    01995
    01996       SymbolValue& value = value_list.values[selected];
    01997
    01998       if (show_it)
    01999         {
    02000           cout << "# Package ";
    02001           if (value_list.use != 0)
    02002             {
    02003               cout << value_list.use->package << " " << value_list.use->version;
    02004             }
    02005         }
    02006
    02007       switch (value_list.command_type)
    02008         {
    02009           case CommandMacroRemove :
    02010             if (show_it)
    02011               {
    02012                 cout << " remove from macro " << symbol.name << " : ";
    02013               }
    02014             temp.replace (value.text, empty);
    02015             break;
    02016           case CommandMacroRemoveAll :
    02017             if (show_it)
    02018               {
    02019                 cout << " remove all from macro " << symbol.name << " : ";
    02020               }
    02021             temp.replace_all (value.text, empty);
    02022             break;
    02023         }
    02024
    02025       if (show_it)
    02026         {
    02027           cout << "'" << value.text << "'";
    02028
    02029           Tag* selected_tag = value.tag;
    02030
    02031           if ((selected_tag == 0) ||
    02032               (selected_tag == Tag::get_default ()))
    02033             {
    02034               cout << " for default tag";
    02035             }
    02036           else
    02037             {
    02038               cout << " for tag '" << selected_tag->name << "'";
    02039             }
    02040
    02041           cout << endl;
    02042         }
    02043     }
    02044
    02045   return (temp);
    02046 }

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

| Reimplemented from ValueBuilder. Definition at line 49 of file cmt_symbol.cxx.
    00051       {
    00052         static const cmt_string empty = "";
    00053         return (empty);
    00054       }

## Member Data Documentation

cmt_string MacroBuilder::temp`[private]`

| Definition at line 57 of file cmt_symbol.cxx.

The documentation for this class was generated from the following file:

- cmt_symbol.cxx