/**********************************************************************	FilePath.h **********************************************************************/#ifndef FILEPATH_H#define FILEPATH_H#ifdef STRING_HEADER#include STRING_HEADER#else#include "String.hxx"#endifenum PathError {	kOK = 0,	kBadSyntax,	kNoExists,	kNotSupported};enum PathType {	kNonexistant = 0,	kFile,	kDirectory,	kOtherType};enum PathFormat {	kDefault,			// defined in FilePath::defaultFormat	kCommon,			// common format (Unix)	kNative				// native format (MacOS, DOS, VMS, whatever)};// convert a string from native to common format, or vice versa:String CommonToNative(const String&);String NativeToCommon(const String&);// the FilePath class:class FilePath {  public:	static PathFormat defaultFormat;	FilePath() { SetToCWD(); }	FilePath(const String& pathname) { SetToCWD(); SetTo(pathname); }	FilePath(const char* pathname) { SetToCWD(); SetTo(pathname); }		// set to named path (relative to current path):	PathError SetTo( const String& pathname, const PathFormat format=kDefault );	PathError SetToParent();				// go to parent directory	PathError SetToCWD();					// set to current working directory		// arithmetic short-hand for SetTo	friend FilePath operator+( const FilePath path, const String& pathname )		{ FilePath p=path; p.SetTo(pathname); return p; }	friend FilePath& operator+=( FilePath path, const String& pathname )		{ path.SetTo(pathname); return path; }	operator String() 				// convert to String in default format		const { return ToString(); }	String ToString( const PathFormat format=kDefault )	// convert to String in given format		const 		{ if (format==kCommon || (format==kDefault && defaultFormat==kCommon))			return itsString; else return CommonToNative(itsString); }	PathType FileType() const;		// what does the path point to?	String FilePrefix() const;		// get the path up to (but not including) file name	String FileName() const;		// get the file name (without the path)	int Rename( const String& newname );	// move/rename the file  protected:	String itsString;	// String which encodes the path (in common format)};	#endif
