libUTL++
Symlink.h
1 #pragma once
2 
4 
5 #if UTL_HOST_OS != UTL_OS_MINGW
6 
8 
9 #include <libutl/FSobject.h>
10 
12 
13 UTL_NS_BEGIN;
14 
16 
28 
30 class Symlink : public FSobject
31 {
34 
35 public:
42  Symlink(const String& srcPath, const String& dstPath, const Directory* dir = nullptr)
43  : FSobject(srcPath, dir)
44  {
45  _dstPath = dstPath;
46  }
47 
48  virtual int compare(const Object& rhs) const;
49 
50  virtual void copy(const Object& rhs);
51 
52  virtual void serialize(Stream& stream, uint_t io, uint_t mode = ser_default);
53 
54  virtual String
55  toString() const
56  {
57  return path() + " -> " + _dstPath;
58  }
59 
61  Pathname getDestPath() const;
62 
64  void
65  setDestPath(const String& dstPath)
66  {
67  _dstPath = dstPath;
68  }
69 
71  void make(uint_t mode = uint_t_max) const;
72 
79  void
80  set(const String& srcPath, const String& dstPath, const Directory* dir = nullptr)
81  {
82  setPath(srcPath);
83  _dstPath = dstPath;
84  setDirectory(dir);
85  }
86 
87 private:
88  Pathname _dstPath;
89 };
90 
92 
93 UTL_NS_END;
94 
96 
97 #endif
#define UTL_CLASS_DEFID
Default init() and deInit() (which are merely place-holders).
Definition: macros.h:532
void serialize(bool &b, Stream &stream, uint_t io, uint_t mode=ser_default)
Serialize a boolean.
Filesystem pathname.
Definition: Pathname.h:32
default representation (via getSerializeMode())
Definition: util.h:75
#define UTL_CLASS_DECL(DC, BC)
Declaration of standard UTL++ functionality for a non-template class.
Definition: macros.h:688
Character string.
Definition: String.h:31
void copy(T *dest, const T *src, size_t len)
Copy one array of objects to another.
Definition: util_inl.h:690
Filesystem object.
Definition: FSobject.h:35
unsigned int uint_t
Unsigned integer.
Definition: types.h:59
Directory filesystem object.
Definition: Directory.h:75
const uint_t uint_t_max
Maximum uint_t value.
Stream I/O abstraction.
Definition: Stream.h:68
Root of UTL++ class hierarchy.
Definition: Object.h:52
int compare(bool lhs, bool rhs)
Compare two boolean values.