00001 /******************************************************************** 00002 ** Copyright (C) 2000 SOMELib Project 00003 ** 00004 ** This library is free software; you can redistribute it and/or 00005 ** modify it under the terms of the GNU Library General Public 00006 ** License as published by the Free Software Foundation; either 00007 ** version 2 of the License, or (at your option) any later version. 00008 ** 00009 ** This library is distributed in the hope that it will be useful, 00010 ** but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 ** Library General Public License for more details. 00013 ** 00014 ** You should have received a copy of the GNU Library General Public 00015 ** License along with this library; if not, write to the 00016 ** Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00017 ** Boston, MA 02111-1307, USA. 00018 ** 00019 *******************************************************************/ 00020 00021 #ifndef SOME_XPPATH_HEADER 00022 #define SOME_XPPATH_HEADER 00023 00024 #include<string> 00025 #include<list> 00026 00027 #include "PathDriver.h" 00028 namespace SOME 00029 { 00030 00031 //This class represents SOME's cross platform version of a path 00032 //The form for paths follows relative URI form (ie unix notation) 00033 //which can be expanded at a later time to accept fully qualified 00034 //URI's for loading of plugins over any protocol 00035 //NOTE: for this to happen security must be taken into account 00036 class Path 00037 { 00038 public: 00039 typedef std::list< std::string >::iterator iterator; 00040 typedef std::list< std::string >::size_type size_type; 00041 iterator begin(); 00042 iterator end(); 00043 size_type size(); 00044 00045 Path(); 00046 Path( std::string path ); 00047 Path( const char * path ); 00048 00049 bool isFile(); 00050 bool isDir(); 00051 00052 void operator=( std::string path ); 00053 00054 void operator=( const char * path ); 00055 00056 void set( std::string path ); 00057 00058 protected: 00059 00060 std::string parsePath( std::string path ); 00061 std::string delimit; 00062 bool isfile; 00063 bool isdir; 00064 std::list<std::string> file_list; 00065 00066 private: 00067 SOME::PathDriver pdriver; 00068 std::string ppath; 00069 std::string xppath; 00070 }; 00071 00072 } 00073 #endif