メインページ   クラス階層   構成   ファイル一覧   構成メンバ   ファイルメンバ  

pathsearch.h

解説を見る。
00001 /*
00002 
00003 Copyright (C) 1996, 1997 John W. Eaton
00004 
00005 This file is part of Octave.
00006 
00007 Octave is free software; you can redistribute it and/or modify it
00008 under the terms of the GNU General Public License as published by the
00009 Free Software Foundation; either version 2, or (at your option) any
00010 later version.
00011 
00012 Octave is distributed in the hope that it will be useful, but WITHOUT
00013 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00014 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00015 for more details.
00016 
00017 You should have received a copy of the GNU General Public License
00018 along with Octave; see the file COPYING.  If not, write to the Free
00019 Software Foundation, 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00020 
00021 */
00022 
00023 #if !defined (octave_pathsearch_h)
00024 #define octave_pathsearch_h 1
00025 
00026 #include <string>
00027 
00028 #include "str-vec.h"
00029 
00030 class
00031 dir_path
00032 {
00033 public:
00034 
00035   dir_path (const std::string& s = std::string (),
00036             const std::string& d = std::string ())
00037     : p_orig (s), p_default (d), initialized (false)
00038     {
00039       if (! p_orig.empty ())
00040         init ();
00041     }
00042 
00043   dir_path (const dir_path& dp)
00044     : p_orig (dp.p_orig), p_default (dp.p_default),
00045       initialized (dp.initialized), p (dp.p), pv (dp.pv)
00046   { }
00047 
00048   dir_path& operator = (const dir_path& dp)
00049     {
00050       p_orig = dp.p_orig;
00051       p_default = dp.p_default;
00052       initialized = dp.initialized;
00053       p = dp.p;
00054       pv = dp.pv;
00055       return *this;
00056     }
00057 
00058   ~dir_path (void) { }
00059 
00060   void set (const std::string& s)
00061     {
00062       initialized = false;
00063       p_orig = s;
00064       init ();
00065     }
00066 
00067   string_vector elements (void);
00068   string_vector all_directories (void);
00069 
00070   std::string find_first (const std::string&);
00071   std::string find (const std::string& nm) { return find_first (nm); }
00072 
00073   string_vector find_all (const std::string&);
00074 
00075   std::string find_first_of (const string_vector& names);
00076   string_vector find_all_first_of (const string_vector& names);
00077 
00078   void rehash (void)
00079     {
00080       initialized = false;
00081       init ();
00082     }
00083 
00084 private:
00085 
00086   // The colon separated list that we were given.
00087   std::string p_orig;
00088 
00089   // The default path.  If specified, replaces leading, trailing, or
00090   // doubled colons in p_orig.
00091   std::string p_default;
00092 
00093   // TRUE means we've unpacked p.
00094   bool initialized;
00095 
00096   // A version of the colon separate list on which we have performed
00097   // tilde, variable, and possibly default path expansion.
00098   std::string p;
00099 
00100   // The elements of the list.
00101   string_vector pv;
00102 
00103   void init (void);
00104 };
00105 
00106 #endif
00107 
00108 /*
00109 ;;; Local Variables: ***
00110 ;;; mode: C++ ***
00111 ;;; End: ***
00112 */

Wed Dec 29 11:52:16 2004に生成されました。 doxygen1.2.18
SEO [PR] 爆速!無料ブログ 無料ホームページ開設 無料ライブ放送