HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UT_PathFileInfo.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: UT_PathFileInfo.h ( Utility Library, C++)
7  *
8  * COMMENTS:
9  */
10 
11 #ifndef __UT_PathFileInfo__
12 #define __UT_PathFileInfo__
13 
14 #include "FS_API.h"
15 #include <UT/UT_NonCopyable.h>
16 #include <UT/UT_String.h>
17 
18 class UT_PathFile;
19 
21 {
25 };
26 
28 {
29 public:
31  virtual ~UT_PathFileInfo();
32 
34 
35  UT_PathFile *getOwner() { return myOwner; }
36 
37  // if str is 0, then the myFileFullPath and myFileName are set.
38  void computeFullPath(UT_String *str);
39 
40  // If you know which directory the file is located in then call the
41  // first of the next two. Otherwise call the second one.
42  void deconstructFullPath(int level);
43  int deconstructFullPath();
44 
45  virtual void copy(UT_PathFileInfo *src,
46  UT_PF_CopyReason reason);
47 
48 
49  void setDiskPath(const char *p) { myDiskPath.harden(p); }
50  void setFullPath(const char *);
51  void setFileName(const char *);
52  void setBaseName(const char *);
53  void setExtension(const char *);
54  void setDirIndex(int);
55 
56  // prepareForSave modifies the Dir Index if necessary
57  // until it refers to an appropriate location.
58  // it returns 0 if no such location was found; 1 ow.
59  // The avoid_* flags determine how the location is
60  // found:
61  //
62  // avoid_overwrite means it won't overwrite any
63  // existing files
64  // avoid_hide means it won't be hidden by hide files
65  // avoid_override means it must the topmost file in
66  // the path.
67 
68  int prepareForSave(int avoid_overwrite=0,
69  int avoid_hide=1,
70  int avoid_override=1);
71 
72  void setHideFlag(int o);
73  void setAppendFlag(int o);
74  void setNoSaveFlag(int o);
75  void setFilteredFlag(int o) { myFilteredFlag = o; }
76 
77 
78  const char *getDiskPath() { return myDiskPath; }
79  const char *getFullPath();
80  const char *getDirectory();
81  const char *getFileName();
82  const char *getBaseName();
83  const char *getExtension();
84  int getDirIndex();
85 
86  int getHideFlag();
87  int getAppendFlag();
88  int getNoSaveFlag();
89  int getFilteredFlag() { return myFilteredFlag; }
90 
91 private:
92 
93  void updateHintFlag();
94 
95  UT_String myDiskPath;
96  UT_String myFullPath;
97  UT_String myDirectory;
98  UT_String myFileName;
99  UT_String myBaseName;
100  UT_String myExtension;
101 
102  int myDirIndex;
103 
104  unsigned int myHideFlag:1,
105  myAppendFlag:1,
106  myNoSaveFlag:1,
107  myFilteredFlag:1,
108  myFullPathOKflag:1,
109  myDirIndexOKflag:1,
110  myFileNameOKflag:1,
111  myBaseNameOKflag:1,
112  myExtensionOKflag:1,
113  myHintOKflag:1;
114 
115  UT_PathFile *myOwner;
116 };
117 
118 #endif
119 
OIIO_UTIL_API bool copy(string_view from, string_view to, std::string &err)
GLint level
Definition: glcorearb.h:108
void setDiskPath(const char *p)
void setFilteredFlag(int o)
const char * getDiskPath()
#define UT_NON_COPYABLE(CLASS)
Define deleted copy constructor and assignment operator inside a class.
UT_PF_CopyReason
#define FS_API
Definition: FS_API.h:10
GLenum src
Definition: glcorearb.h:1793