OpendTect-6_4  6.4
filepath.h
Go to the documentation of this file.
1 #ifndef filepath_h
2 #define filepath_h
3 
4 /*+
5 ________________________________________________________________________
6 
7  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
8  Author: A.H.Bril
9  Date: Mar 2004
10  RCS: $Id$
11 ________________________________________________________________________
12 
13 -*/
14 
15 #include "basicmod.h"
16 #include "bufstringset.h"
17 
18 
35 {
36 public:
37  enum Style { Local, Unix, Windows };
38 
39  FilePath(const char* fullinp=0);
40  FilePath(const char* p1,const char* p2,const char* p3=0,
41  const char* p4=0,const char* p5=0);
42  FilePath( const FilePath& fp ) { *this = fp; }
43  FilePath(const FilePath&,const char* p2,
44  const char* p3=0,const char* p4=0,
45  const char* p5=0);
46 
47  FilePath& operator =(const FilePath&);
48  FilePath& operator =(const char* fullinp);
49  bool operator ==(const FilePath&) const;
50  bool operator ==(const char* fnm) const;
51  bool operator !=(const FilePath&) const;
52  bool operator !=(const char* fnm) const;
53  bool isEmpty() const;
54 
55  FilePath& set(const char* fullinp);
56  FilePath& add(const char*);
57  FilePath& insert(const char*);
58  void setFileName(const char*);
59  void setPath(const char*);
60  void setExtension(const char*,bool replace=true);
62  bool exists() const;
63 
64  bool isAbsolute() const;
65  bool isSubDirOf(const FilePath&,FilePath* reldir = 0) const;
68  bool makeRelativeTo(const FilePath&);
69  bool makeCanonical();
70 
71  BufferString fullPath(Style s=Local,bool cleanup=true) const;
72  const char* prefix() const;
73  int nrLevels() const;
74  const char* extension() const;
75 
76  const OD::String& fileName() const;
77  BufferString baseName() const;
78  BufferString pathOnly() const;
79  BufferString winDrive() const;
80 
81  const OD::String& dir(int nr=-1) const;
83  BufferString dirUpTo(int) const;
85 
86  static BufferString getTempDir();
87  static BufferString getTempName(const char* ext=0);
88  static BufferString mkCleanPath(const char* path, Style fmt);
89  static BufferString getTimeStampFileName(const char*ext=0);
90 
91  static const char* dirSep(Style);
92  static const char* sPrefSep;
93 
94 protected:
95 
96  bool isabs_;
99 
100  void addPart(const char*);
101  void compress(int sl=0);
102  void trueDirIfLink();
103 };
104 
105 
106 #endif
#define mExpClass(module)
Definition: commondefs.h:160
BufferString prefix_
Definition: filepath.h:97
bool operator==(const ArrayNDInfo &a1, const ArrayNDInfo &a2)
Definition: arrayndinfo.h:53
bool isabs_
Definition: filepath.h:96
Style
Definition: filepath.h:37
Set of BufferString objects.
Definition: bufstringset.h:28
encapsulates the read-access-only part of strings in OD.
Definition: odstring.h:31
bool operator!=(const ArrayNDInfo &a1, const ArrayNDInfo &a2)
Definition: arrayndinfo.h:62
static const char * sPrefSep
Definition: filepath.h:92
File pathname tools.
Definition: filepath.h:34
OD::String with its own variable length buffer. The buffer has a guaranteed minimum size...
Definition: bufstring.h:40
BufferStringSet lvls_
Definition: filepath.h:98
bool isEmpty(const NLAModel *mdl)
bool exists(const char *)
FilePath(const FilePath &fp)
Definition: filepath.h:42

Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B. V. 2019