00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef __UT_PathFileInfo__
00020 #define __UT_PathFileInfo__
00021
00022 #include "FS_API.h"
00023 class UT_PathFile;
00024
00025 #include <UT/UT_String.h>
00026
00027 enum UT_PF_CopyReason
00028 {
00029 UT_PFCR_DUPLICATE,
00030 UT_PFCR_CREATE_ORIGINAL,
00031 UT_PFCR_STASH
00032 };
00033
00034 class FS_API UT_PathFileInfo
00035 {
00036 public:
00037 UT_PathFileInfo(UT_PathFile *owner);
00038 virtual ~UT_PathFileInfo();
00039
00040 UT_PathFile *getOwner() { return myOwner; }
00041
00042
00043 void computeFullPath(UT_String *str);
00044
00045
00046
00047 void deconstructFullPath(int level);
00048 int deconstructFullPath();
00049
00050 virtual void copy(UT_PathFileInfo *src,
00051 UT_PF_CopyReason reason);
00052
00053
00054 void setDiskPath(const char *p) { myDiskPath.harden(p); }
00055 void setFullPath(const char *);
00056 void setFileName(const char *);
00057 void setBaseName(const char *);
00058 void setExtension(const char *);
00059 void setDirIndex(int);
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073 int prepareForSave(int avoid_overwrite=0,
00074 int avoid_hide=1,
00075 int avoid_override=1);
00076
00077 void setHideFlag(int o);
00078 void setAppendFlag(int o);
00079 void setNoSaveFlag(int o);
00080 void setFilteredFlag(int o) { myFilteredFlag = o; }
00081
00082
00083 const char *getDiskPath() { return myDiskPath; }
00084 const char *getFullPath();
00085 const char *getDirectory();
00086 const char *getFileName();
00087 const char *getBaseName();
00088 const char *getExtension();
00089 int getDirIndex();
00090
00091 int getHideFlag();
00092 int getAppendFlag();
00093 int getNoSaveFlag();
00094 int getFilteredFlag() { return myFilteredFlag; }
00095
00096 private:
00097
00098 UT_PathFileInfo &operator =(const UT_PathFileInfo&);
00099
00100 private:
00101
00102 void updateHintFlag();
00103
00104 UT_String myDiskPath;
00105 UT_String myFullPath;
00106 UT_String myDirectory;
00107 UT_String myFileName;
00108 UT_String myBaseName;
00109 UT_String myExtension;
00110
00111 int myDirIndex;
00112
00113 unsigned int myHideFlag:1,
00114 myAppendFlag:1,
00115 myNoSaveFlag:1,
00116 myFilteredFlag:1,
00117 myFullPathOKflag:1,
00118 myDirIndexOKflag:1,
00119 myFileNameOKflag:1,
00120 myBaseNameOKflag:1,
00121 myExtensionOKflag:1,
00122 myHintOKflag:1;
00123
00124 UT_PathFile *myOwner;
00125 };
00126
00127 #endif
00128