Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

KwdSetupStrategy Class Reference

Inheritance diagram for KwdSetupStrategy:

Inheritance graph
[legend]
Collaboration diagram for KwdSetupStrategy:

Collaboration graph
[legend]
List of all members.

Public Member Functions

bool decode (const cmt_string &w, cmt_string &strategy, cmt_string &value)
void action (const CmtSystem::cmt_string_vector &words, Use *use, const cmt_string &file_name, int line_number)
void action (const CmtSystem::cmt_string_vector &words, Project *project, const cmt_string &file_name, int line_number)

Member Function Documentation

void KwdSetupStrategy::action const CmtSystem::cmt_string_vector words,
Project project,
const cmt_string file_name,
int  line_number
[inline, virtual]
 

Reimplemented from Kwd.

Definition at line 788 of file cmt_syntax.cxx.

References CmtSystem::cmt_string_vector, decode(), CmtError::set(), Project::set_strategy(), and cmt_vector< T >::size().

00792   {
00793     for (int i = 1; i < words.size (); i++)
00794       {
00795         const cmt_string& w = words[i];
00796 
00797         cmt_string strategy;
00798         cmt_string value;
00799 
00800         bool in_error = false;
00801 
00802         if (decode (w, strategy, value))
00803           {
00804             if (project != 0) project->set_strategy (strategy, value, "");
00805           }
00806         else
00807           {
00808             in_error = true;
00809 
00810             CmtError::set (CmtError::syntax_error, "ParseRequirements> bad strategy keyword");
00811           }
00812       }
00813   }

void KwdSetupStrategy::action const CmtSystem::cmt_string_vector words,
Use use,
const cmt_string file_name,
int  line_number
[inline, virtual]
 

Implements Kwd.

Definition at line 754 of file cmt_syntax.cxx.

References CmtSystem::cmt_string_vector, decode(), Project::find_by_cmtpath(), Use::get_cmtpath_and_offset(), Use::get_package_name(), CmtError::set(), Project::set_strategy(), and cmt_vector< T >::size().

00758   {
00759     cmt_string cmtpath;
00760     cmt_string offset;
00761 
00762     use->get_cmtpath_and_offset (cmtpath, offset);
00763 
00764     Project* p = Project::find_by_cmtpath (cmtpath);
00765 
00766     for (int i = 1; i < words.size (); i++)
00767       {
00768         const cmt_string& w = words[i];
00769 
00770         cmt_string strategy;
00771         cmt_string value;
00772 
00773         bool in_error = false;
00774 
00775         if (decode (w, strategy, value))
00776           {
00777             if (p != 0) p->set_strategy (strategy, value, use->get_package_name ());
00778           }
00779         else
00780           {
00781             in_error = true;
00782 
00783             CmtError::set (CmtError::syntax_error, "ParseRequirements> bad strategy keyword");
00784           }
00785       }
00786   }

bool KwdSetupStrategy::decode const cmt_string w,
cmt_string strategy,
cmt_string value
[inline]
 

Definition at line 716 of file cmt_syntax.cxx.

Referenced by action().

00717   {
00718     bool result = true;
00719 
00720     value = w;
00721 
00722     if (w == "config")
00723       {
00724         strategy = "SetupConfig";
00725       }
00726     else if (w == "no_config")
00727       {
00728         strategy = "SetupConfig";
00729       }
00730     else if (w == "root")
00731       {
00732         strategy = "SetupRoot";
00733       }
00734     else if (w == "no_root")
00735       {
00736         strategy = "SetupRoot";
00737       }
00738     else if (w == "cleanup")
00739       {
00740         strategy = "SetupCleanup";
00741       }
00742     else if (w == "no_cleanup")
00743       {
00744         strategy = "SetupCleanup";
00745       }
00746     else
00747       {
00748         result = false;
00749       }
00750 
00751     return (result);
00752   }


The documentation for this class was generated from the following file:
Generated on Mon May 2 10:25:50 2005 for CMT by doxygen 1.3.5