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

# Language Class Reference

`#include <cmt_language.h>`

Collaboration diagram for Language:

[legend]
List of all members.

## Public Types
typedef cmt_vector<Language> | LanguageVector
## Public Methods
| Language ()
| ~Language ()
void | clear ()
void | show ()
void | setup_fragments ()
bool | operator== (const cmt_string& name) const
bool | operator== (const Language& other) const
bool | operator!= (const Language& other) const
## Public Attributes
cmt_string | m_name
cmt_string | fragment_name
cmt_string | linker
cmt_string | output_suffix
bool | prototypes
cmt_string | preprocessor_command
CmtSystem::cmt_string_vector | suffixes
CmtSystem::cmt_string_vector | extra_output_suffixes
FragmentHandle | application
FragmentHandle | library
## Static Public Methods
void | action (const CmtSystem::cmt_string_vector& words)
Language& | find (const cmt_string& name)
Language& | find_with_suffix (const cmt_string& suffix)
Language& | add (const cmt_string& name)
void | show (const cmt_string& name)
void | show_all ()
void | show_names ()
void | setup_all_fragments ()
void | clear_all ()
LanguageVector& | languages ()
Language& | null ()

## Member Typedef Documentation

typedef cmt_vector<Language> Language::LanguageVector

| Definition at line 10 of file cmt_language.h.

## Constructor & Destructor Documentation

Language::Language ( | )

| Definition at line 245 of file cmt_language.cxx.
    00247 {
    00248   clear ();
    00249 }

Language::~Language ( | )

| Definition at line 252 of file cmt_language.cxx.
    00254 {
    00255 }

## Member Function Documentation

void Language::action ( | const CmtSystem::cmt_string_vector & words )`[static]`

| Definition at line 133 of file cmt_language.cxx. Referenced by Cmt::select().
    00135 {
    00136   cmt_string name;
    00137
    00138   int i = 1;
    00139
    00140   name = words[i];
    00141   if (name == "") return;
    00142   i++;
    00143
    00144   Language& language = add (name);
    00145
    00146   for (;i < words.size (); i++)
    00147     {
    00148       cmt_string& w = words[i];
    00149       if (w == "") break;
    00150
    00151       if (w.substr (0, 8) == "-suffix=")
    00152         {
    00153           cmt_string& suffix = language.suffixes.add ();
    00154
    00155           suffix.erase (0);
    00156           w.substr (8, suffix);
    00157         }
    00158       else if (w.substr (0, 8) == "-linker=")
    00159         {
    00160           w.substr (8, language.linker);
    00161         }
    00162       else if (w.substr (0, 11) == "-prototypes")
    00163         {
    00164           language.prototypes = true;
    00165         }
    00166       else if (w.substr (0, 22) == "-preprocessor_command=")
    00167         {
    00168           w.substr (22, language.preprocessor_command);
    00169         }
    00170       else if (w.substr (0, 10) == "-fragment=")
    00171         {
    00172           w.substr (10, language.fragment_name);
    00173         }
    00174       else if (w.substr (0, 15) == "-output_suffix=")
    00175         {
    00176           w.substr (15, language.output_suffix);
    00177         }
    00178       else if (w.substr (0, 21) == "-extra_output_suffix=")
    00179         {
    00180           cmt_string& suffix = language.extra_output_suffixes.add ();
    00181
    00182           suffix.erase (0);
    00183           w.substr (21, suffix);
    00184         }
    00185     }
    00186 }

Language & Language::add ( | const cmt_string & name )`[static]`

| Definition at line 189 of file cmt_language.cxx.
    00191 {
    00192   static LanguageVector& Languages = languages ();
    00193
    00194   if (name == "") return (null ());
    00195
    00196   {
    00197     Language& language = find (name);
    00198     if (language != null ()) return (language);
    00199   }
    00200
    00201   Language& language = Languages.add ();
    00202
    00203   language.clear ();
    00204   language.m_name = name;
    00205   language.fragment_name = name;
    00206
    00207   return (language);
    00208 }

void Language::clear ( | )

| Definition at line 258 of file cmt_language.cxx. Referenced by add(), and clear_all().
    00260 {
    00261   m_name = "";
    00262   linker = "none";
    00263   prototypes = false;
    00264   preprocessor_command = "-I";
    00265   fragment_name = "";
    00266   output_suffix = "";
    00267   suffixes.clear ();
    00268   extra_output_suffixes.clear ();
    00269 }

void Language::clear_all ( | )`[static]`

| Definition at line 212 of file cmt_language.cxx. Referenced by Database::clear().
    00214 {
    00215   static LanguageVector& Languages = languages ();
    00216
    00217   for (int i = 0; i < Languages.size (); i++)
    00218     {
    00219       Language& c = Languages[i];
    00220       c.clear ();
    00221     }
    00222   Languages.clear ();
    00223 }

Language & Language::find ( | const cmt_string & name )`[static]`

| Definition at line 79 of file cmt_language.cxx.
    00081 {
    00082   static LanguageVector& Languages = languages ();
    00083
    00084   int language_index;
    00085
    00086   if (Languages.size () == 0) return (null ());
    00087
    00088   for (language_index = 0;
    00089        language_index < Languages.size ();
    00090        language_index++)
    00091     {
    00092       Language& language = Languages[language_index];
    00093
    00094       if (language.m_name == name)
    00095         {
    00096           return (language);
    00097         }
    00098     }
    00099
    00100   return (null ());
    00101 }

Language & Language::find_with_suffix ( | const cmt_string & suffix )`[static]`

| Definition at line 104 of file cmt_language.cxx. Referenced by MakefileGenerator::analyze_file().
    00106 {
    00107   static LanguageVector& Languages = languages ();
    00108
    00109   int language_index;
    00110
    00111   if (Languages.size () == 0) return (null ());
    00112
    00113   for (language_index = 0;
    00114        language_index < Languages.size ();
    00115        language_index++)
    00116     {
    00117       Language& language = Languages[language_index];
    00118
    00119       for (int suffix_index = 0;
    00120            suffix_index < language.suffixes.size ();
    00121            suffix_index++)
    00122         {
    00123           cmt_string& s = language.suffixes[suffix_index];
    00124
    00125           if (s == suffix) return (language);
    00126         }
    00127     }
    00128
    00129   return (null ());
    00130 }

Language::LanguageVector & Language::languages ( | )`[static]`

| Definition at line 226 of file cmt_language.cxx.
    00228 {
    00229   static Database& db = Database::instance ();
    00230   static LanguageVector& Languages = db.languages ();
    00231
    00232   return (Languages);
    00233 }

Language & Language::null ( | )`[static]`

| Definition at line 236 of file cmt_language.cxx. Referenced by MakefileGenerator::analyze_file(), and MakefileGenerator::module_file_action().
    00238 {
    00239   static Language null_instance;
    00240
    00241   return (null_instance);
    00242 }

bool Language::operator!= ( | const Language & other ) const

| Definition at line 351 of file cmt_language.cxx.
    00353 {
    00354   if (this != &other) return (true);
    00355   return (false);
    00356 }

bool Language::operator== ( | const Language & other ) const

| Definition at line 343 of file cmt_language.cxx.
    00345 {
    00346   if (this == &other) return (true);
    00347   return (false);
    00348 }

bool Language::operator== ( | const cmt_string & name ) const

| Definition at line 335 of file cmt_language.cxx.
    00337 {
    00338   if (m_name == name) return (true);
    00339   return (false);
    00340 }

void Language::setup_all_fragments ( | )`[static]`

| Definition at line 59 of file cmt_language.cxx. Referenced by MakefileGenerator::reset().
    00061 {
    00062   static LanguageVector& Languages = languages ();
    00063
    00064   int language_index;
    00065
    00066   if (Languages.size () == 0) return;
    00067
    00068   for (language_index = 0;
    00069        language_index < Languages.size ();
    00070        language_index++)
    00071     {
    00072       Language& language = Languages[language_index];
    00073
    00074       language.setup_fragments ();
    00075     }
    00076 }

void Language::setup_fragments ( | )

| Definition at line 322 of file cmt_language.cxx. Referenced by setup_all_fragments().
    00324 {
    00325   cmt_string n = fragment_name;
    00326
    00327   application.set (n);
    00328
    00329   n += "_library";
    00330
    00331   library.set (n);
    00332 }

void Language::show ( | )

| Definition at line 272 of file cmt_language.cxx. Referenced by Cmt::do_show_language(), show(), and show_all().
    00274 {
    00275   cout << "language " << m_name;
    00276
    00277   int i;
    00278
    00279   for (i = 0; i < (suffixes.size ()); i++)
    00280     {
    00281       cmt_string& suffix = suffixes[i];
    00282
    00283       cout << " -suffix=" << suffix;
    00284     }
    00285
    00286   if (linker != "")
    00287     {
    00288       cout << " -linker=" << linker;
    00289     }
    00290
    00291   if (prototypes)
    00292     {
    00293       cout << " -prototypes";
    00294     }
    00295
    00296   if (preprocessor_command != "-I")
    00297     {
    00298       cout << " -preprocessor_command=" << preprocessor_command;
    00299     }
    00300
    00301   if (fragment_name != m_name)
    00302     {
    00303       cout << " -fragment=" << fragment_name;
    00304     }
    00305
    00306   if (output_suffix != "")
    00307     {
    00308       cout << " -output_suffix=" << output_suffix;
    00309     }
    00310
    00311   for (i = 0; i < extra_output_suffixes.size (); i++)
    00312     {
    00313       cmt_string& suffix = extra_output_suffixes[i];
    00314
    00315       cout << " -extra_output_suffix=" << suffix;
    00316     }
    00317
    00318   cout << endl;
    00319 }

void Language::show ( | const cmt_string & name )`[static]`

| Definition at line 17 of file cmt_language.cxx.
    00019 {
    00020   Language& language = find (name);
    00021
    00022   if (language == null ()) return;
    00023
    00024   language.show ();
    00025 }

void Language::show_all ( | )`[static]`

| Definition at line 28 of file cmt_language.cxx. Referenced by Cmt::do_show_languages().
    00030 {
    00031   static LanguageVector& Languages = languages ();
    00032
    00033   int number;
    00034
    00035   for (number = 0; number < Languages.size (); number++)
    00036     {
    00037       Language& language = Languages[number];
    00038
    00039       language.show ();
    00040     }
    00041 }

void Language::show_names ( | )`[static]`

| Definition at line 44 of file cmt_language.cxx.
    00046 {
    00047   static LanguageVector& Languages = languages ();
    00048
    00049   int number;
    00050
    00051   for (number = 0; number < Languages.size (); number++)
    00052     {
    00053       Language& language = Languages[number];
    00054       cout << language.m_name << endl;
    00055     }
    00056 }

## Member Data Documentation

FragmentHandle Language::application

| Definition at line 42 of file cmt_language.h.

CmtSystem::cmt_string_vector Language::extra_output_suffixes

| Definition at line 40 of file cmt_language.h.

cmt_string Language::fragment_name

| Definition at line 34 of file cmt_language.h.

FragmentHandle Language::library

| Definition at line 43 of file cmt_language.h.

cmt_string Language::linker

| Definition at line 35 of file cmt_language.h.

cmt_string Language::m_name

| Definition at line 33 of file cmt_language.h.

cmt_string Language::output_suffix

| Definition at line 36 of file cmt_language.h.

cmt_string Language::preprocessor_command

| Definition at line 38 of file cmt_language.h.

bool Language::prototypes

| Definition at line 37 of file cmt_language.h.

CmtSystem::cmt_string_vector Language::suffixes

| Definition at line 39 of file cmt_language.h.

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

- cmt_language.h
- cmt_language.cxx