proj home

Files   Classes   Functions   Hierarchy  

pathstuff.h

Go to the documentation of this file.
00001 #ifndef PATHSTUFF_H
00002 #define PATHSTUFF_H
00003 
00004 #include <string>
00005 #include <vector>
00006 using namespace std;
00007 
00008 #include <rpn.h>
00009 
00010 
00011 
00012 /* Process path queries. */
00013 class pathstuff
00014 {
00015 public:
00016 
00017   static string const root;
00018   static string const fwdsep;
00019   static string const parent;
00020 
00021   /* Convert a path between string and a vector of strings. */
00022   void convert(string& s, vector<string> const & path) const;
00023   void convert(vector<string>& v, string const & path) const;
00024   /* Convert a path between program and a vector of strings. */
00025   void convert(rpnprogram& p, vector<string> const & path) const;
00026   void convert(vector<string>& path, rpnprogram const & p) const;
00027 
00028   /* Does the path contain the targ string? */
00029   void contains(bool& res, vector<string> const & path, string const & targ);
00030 
00031   /* Search for a program relative to the current directory. */
00032   void findrelativetree
00033   (
00034     bool& found,
00035     rpnprogram*& prog,
00036     rpnprogram* const current,
00037     vector<string> const & pathtree
00038   );
00039 
00040   /* Search for a program relative to the current directory. 
00041    * The programs path - that is each of its parents in in an ordered list.
00042    * This is used for scoping in cd, where each program is pushed onto the stack. */
00043   void findrelativetree
00044   (
00045     bool& found,
00046     deque<rpnprogram*>& programlist,
00047     rpnprogram* const current,
00048     vector<string> const & pathtree
00049   );
00050 
00051 
00052   /* String maipulation: .. resolved, ~/.. is illegal. */
00053   void resolveparent
00054   ( 
00055     bool& valid, 
00056     vector<string>& path, 
00057     vector<string> const & path0
00058   );
00059 
00060   /* Current directory. */
00061   void pwd(vector<string>& v);
00062 
00063   /* Searches for the program described by the path. */
00064   void findpath
00065   (
00066     bool& found,
00067     rpnprogram*& prog,
00068     vector<string> const & path
00069   );
00070 
00071   void findpath
00072   (
00073     bool& found,
00074     deque<rpnprogram*>& programlist,
00075     vector<string> const & path
00076   );
00077 
00078   /* Gets the absolute path. eg .. realized and path from ~ . */
00079   void absolute
00080   (
00081     bool& found,
00082     vector<string>& pathfromhome,
00083     vector<string> const & path
00084   );
00085 
00086   /* No root or parent nodes. */
00087   bool const ispurerelative( vector<string> const & path );
00088 
00089 };
00090 
00091 
00092 
00093 
00094 
00095 #endif
00096 
00097 

Generated on Fri Mar 4 00:49:30 2011 for Chelton Evans Source by  doxygen 1.5.8