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

CMTPathManager Class Reference

Collaboration diagram for CMTPathManager:

Collaboration graph
[legend]
List of all members.

Static Public Member Functions

CMTPathManagerinstance ()
void reset ()
void add_cmt_path (const cmt_string &path, const cmt_string &path_source, IProjectFactory &factory)

Private Member Functions

 CMTPathManager ()
void do_reset ()
void do_add_cmt_path (const cmt_string &path, const cmt_string &path_source, IProjectFactory &factory)

Private Attributes

Projectm_project

Constructor & Destructor Documentation

CMTPathManager::CMTPathManager  )  [inline, private]
 

Definition at line 1250 of file cmt_system.cxx.

References m_project.

01250                     : m_project (0)
01251   {
01252   }


Member Function Documentation

void CMTPathManager::add_cmt_path const cmt_string path,
const cmt_string path_source,
IProjectFactory factory
[static]
 

Definition at line 1335 of file cmt_system.cxx.

References do_add_cmt_path(), and instance().

Referenced by add_cmt_paths_from_text(), and CmtSystem::get_cmt_paths().

01338 {
01339   static CMTPathManager& me = instance ();
01340   me.do_add_cmt_path (path, path_source, factory);
01341 }

void CMTPathManager::do_add_cmt_path const cmt_string path,
const cmt_string path_source,
IProjectFactory factory
[inline, private]
 

Definition at line 1259 of file cmt_system.cxx.

References CmtSystem::absolute_path(), CmtSystem::compress_path(), IProjectFactory::create_project(), cmt_string::erase(), CmtSystem::file_separator(), m_project, CmtSystem::pwd(), cmt_string::replace_all(), CmtError::set(), cmt_string::size(), and CmtSystem::test_directory().

Referenced by add_cmt_path().

01262   {
01263     cmt_string npath = path;
01264 
01265     if (npath == "") return;
01266 
01267 #ifdef WIN32
01268     if (npath.size () == 2)
01269       {
01270         if (npath[1] == ':')
01271           {
01272             npath += CmtSystem::file_separator ();
01273           }
01274       }
01275 #endif
01276 
01277     npath.replace_all ("\\", CmtSystem::file_separator ());
01278     npath.replace_all ("/", CmtSystem::file_separator ());
01279 
01280     if (!CmtSystem::absolute_path (npath))
01281       {
01282         cmt_string h = CmtSystem::pwd ();
01283         h += CmtSystem::file_separator ();
01284         h += npath;
01285         npath = h;
01286       }
01287     
01288     CmtSystem::compress_path (npath);
01289 
01290     //cerr << "adding npath=" << npath << endl;
01291 
01292     while (npath[npath.size ()-1] == CmtSystem::file_separator ())
01293       {
01294         npath.erase (npath.size ()-1);
01295       }
01296     
01297     //cerr << "adding npath=[" << npath << "]" << endl;
01298     
01299     if (npath != "")
01300       {
01301         if (!CmtSystem::test_directory (npath))
01302           {
01303             CmtError::set (CmtError::path_not_found, npath);
01304             return;
01305           }
01306 
01307         cmt_string project_name;
01308 
01309         if ((path_source == "CMTUSERCONTEXT") ||
01310             (path_source == "CMTHOME"))
01311           {
01312             project_name = path_source;
01313           }
01314 
01315         m_project = factory.create_project (project_name, npath, path_source, m_project);
01316       }
01317   }

void CMTPathManager::do_reset  )  [inline, private]
 

Definition at line 1254 of file cmt_system.cxx.

References m_project.

Referenced by reset().

01255   {
01256     m_project = 0;
01257   }

CMTPathManager & CMTPathManager::instance  )  [static]
 

Definition at line 1322 of file cmt_system.cxx.

Referenced by add_cmt_path(), and reset().

01323 {
01324   static CMTPathManager me;
01325   
01326   return (me);
01327 }

void CMTPathManager::reset  )  [static]
 

Definition at line 1329 of file cmt_system.cxx.

References do_reset(), and instance().

Referenced by CmtSystem::get_cmt_paths().

01330 {
01331   static CMTPathManager& me = instance ();
01332   me.do_reset ();
01333 }


Member Data Documentation

Project* CMTPathManager::m_project [private]
 

Definition at line 1319 of file cmt_system.cxx.

Referenced by CMTPathManager(), do_add_cmt_path(), and do_reset().


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