Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   Related Pages  

CommandPathList.h

00001 // -*- C++ -*-
00002 /*****************************************************************************
00003  *
00004  *   |_|_|_  |_|_    |_    |_|_|_  |_                C O M M U N I C A T I O N
00005  * |_        |_  |_  |_  |_        |_                          N E T W O R K S
00006  * |_        |_  |_  |_  |_        |_                                C L A S S
00007  *   |_|_|_  |_    |_|_    |_|_|_  |_|_|_|_                      L I B R A R Y
00008  *
00009  * $Id: CommandPathList.h,v 1.3 2002/01/14 11:25:34 spee Exp $
00010  *
00011  * Class: CNPathList --- ...
00012  *
00013  *****************************************************************************
00014  * Copyright (C) 1992-2002   Communication Networks
00015  *                           Aachen University of Technology
00016  *                           D-52056 Aachen
00017  *                           Germany
00018  *                           Email: cncl-adm@comnets.rwth-aachen.de
00019  *****************************************************************************
00020  * This file is part of the CN class library. All files marked with
00021  * this header are free software; you can redistribute it and/or modify
00022  * it under the terms of the GNU Library General Public License as
00023  * published by the Free Software Foundation; either version 2 of the
00024  * License, or (at your option) any later version.  This library is
00025  * distributed in the hope that it will be useful, but WITHOUT ANY
00026  * WARRANTY; without even the implied warranty of MERCHANTABILITY or
00027  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00028  * License for more details.  You should have received a copy of the GNU
00029  * Library General Public License along with this library; if not, write
00030  * to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139,
00031  * USA.
00032  * 
00033  * As an exception to this rule you may use this template to generate
00034  * your own classes. This does not cause these classes to be covered by
00035  * the GNU Library General Public License. This exception does not
00036  * however invalidate any other reasons why the resulting program must be
00037  * covered by the GNU Library General Public License. 
00038  *****************************************************************************/
00039 
00040 #ifndef __CNPathList_h
00041 #define __CNPathList_h
00042 
00043 
00044 class CNString;
00045 
00046 #include <CNCL/DLList.h>                // Base class
00047 
00048 extern CNClassDesc CN_PATHLIST; // Class CNPathList description
00049 
00053 class CNPathList : public CNDLList
00054 {
00055   public:       /***** Constructors ******************************************/
00057     CNPathList(void) : CNDLList() {}
00058 
00060     CNPathList(const CNString& pathList);
00061     
00063     CNPathList(const CNPathList& pathList);
00064     
00067     CNPathList(CNParam *) {}
00068 
00070     ~CNPathList(void);
00071     
00072   public:       /***** Public interface **************************************/
00074     void add(const CNString& path);
00076     void add_environment_list( const CNString& env_variable);
00077 
00080     bool has_valid_command_path(const CNString& filename,
00081                                 CNString& command_path);
00082 
00085     void ensure_command_path(const CNString& path);
00087     bool has_entry(const CNString& path);
00088 
00089   private:      /***** Internal private members ******************************/
00090 
00091   public:       /****** Member functions required by CNCL *********************/
00092     // CNClass description
00093     virtual CNClassDesc class_desc() const      
00094     { return CN_PATHLIST; }
00095             
00097     virtual bool is_a(CNClassDesc desc) const   // Type checking
00098     { return desc == CN_PATHLIST ? TRUE : CNDLList::is_a(desc); }
00099         
00101     static CNPathList *cast_from_object(CNObject *obj) 
00102     {
00103 #   ifdef NO_TYPE_CHECK
00104         return (CNPathList *)obj;
00105 #   else
00106         return (CNPathList *)( !obj || obj->is_a(CN_PATHLIST)
00107                ? obj : fatal_type(obj->class_desc(), CN_PATHLIST) );
00108 #   endif
00109     }
00110     
00111     //
00113     static CNObject *new_object(CNParam *param = NIL) 
00114     { return param ? new CNPathList(param) : new CNPathList; }
00115     
00116     // Print/debug output
00117     virtual void print(ostream &strm = cout) const;
00118     //
00119     virtual void dump (ostream &strm = cout) const;
00120 };
00121 
00122 ostream &operator << (ostream &strm, const CNPathList &obj);
00123 ostream &operator << (ostream &strm, const CNPathList *obj);
00124 
00125 #endif 

Generated on Fri Feb 1 19:53:45 2002 for CNCL by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001