Changeset 74526 in vbox for trunk/include/VBox
- Timestamp:
- Sep 28, 2018 3:08:24 PM (6 years ago)
- svn:sync-xref-src-repo-rev:
- 125394
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/GuestHost/DragAndDrop.h
r69753 r74526 5 5 6 6 /* 7 * Copyright (C) 2014-201 7Oracle Corporation7 * Copyright (C) 2014-2018 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 38 38 #include <iprt/cpp/ministring.h> 39 39 40 /** DnDURIDroppedFiles flags. */ 41 typedef uint32_t DNDURIDROPPEDFILEFLAGS; 42 43 /** No flags specified. */ 44 #define DNDURIDROPPEDFILE_FLAGS_NONE 0 45 40 46 /** 41 47 * Class for maintaining a "dropped files" directory … … 52 58 53 59 DnDDroppedFiles(void); 54 DnDDroppedFiles(const char *pszPath, uint32_t fFlags);60 DnDDroppedFiles(const char *pszPath, DNDURIDROPPEDFILEFLAGS fFlags = DNDURIDROPPEDFILE_FLAGS_NONE); 55 61 virtual ~DnDDroppedFiles(void); 56 62 … … 61 67 int Close(void); 62 68 bool IsOpen(void) const; 63 int OpenEx(const char *pszPath, uint32_t fFlags);64 int OpenTemp( uint32_t fFlags);69 int OpenEx(const char *pszPath, DNDURIDROPPEDFILEFLAGS fFlags = DNDURIDROPPEDFILE_FLAGS_NONE); 70 int OpenTemp(DNDURIDROPPEDFILEFLAGS fFlags = DNDURIDROPPEDFILE_FLAGS_NONE); 65 71 const char *GetDirAbs(void) const; 66 72 int Reopen(void); … … 91 97 int DnDPathSanitizeFilename(char *pszPath, size_t cbPath); 92 98 int DnDPathSanitize(char *pszPath, size_t cbPath); 99 100 /** DnDURIObject flags. */ 101 typedef uint32_t DNDURIOBJECTFLAGS; 102 103 /** No flags specified. */ 104 #define DNDURIOBJECT_FLAGS_NONE 0 105 106 class DnDURIObject 107 { 108 public: 109 110 /** 111 * Enumeration for specifying an URI object type. 112 */ 113 enum Type 114 { 115 /** Unknown type, do not use. */ 116 Type_Unknown = 0, 117 /** Object is a file. */ 118 Type_File, 119 /** Object is a directory. */ 120 Type_Directory, 121 /** The usual 32-bit hack. */ 122 Type_32Bit_Hack = 0x7fffffff 123 }; 124 125 /** 126 * Enumeration for specifying an URI object view 127 * represent its data accordingly. 128 */ 129 enum View 130 { 131 /** Unknown view, do not use. */ 132 View_Unknown = 0, 133 /** Handle data from the source point of view. */ 134 View_Source, 135 /** Handle data from the destination point of view. */ 136 View_Target, 137 /** The usual 32-bit hack. */ 138 View_Dest_32Bit_Hack = 0x7fffffff 139 }; 140 141 DnDURIObject(void); 142 DnDURIObject(Type type, 143 const RTCString &strSrcPath = "", 144 const RTCString &strDstPath = "", 145 uint32_t fMode = 0, uint64_t cbSize = 0); 146 virtual ~DnDURIObject(void); 147 148 public: 149 150 const RTCString &GetSourcePath(void) const { return m_strSrcPath; } 151 const RTCString &GetDestPath(void) const { return m_strTgtPath; } 152 uint32_t GetMode(void) const { return m_fMode; } 153 uint64_t GetProcessed(void) const { return m_cbProcessed; } 154 uint64_t GetSize(void) const { return m_cbSize; } 155 Type GetType(void) const { return m_Type; } 156 157 public: 158 159 int SetSize(uint64_t uSize) { m_cbSize = uSize; return VINF_SUCCESS; } 160 161 public: 162 163 void Close(void); 164 bool IsComplete(void) const; 165 bool IsOpen(void) const; 166 int Open(View enmView, uint64_t fOpen, uint32_t fMode = 0); 167 int OpenEx(const RTCString &strPath, Type enmType, View enmView, uint64_t fOpen = 0, uint32_t fMode = 0, DNDURIOBJECTFLAGS = DNDURIOBJECT_FLAGS_NONE); 168 int Read(void *pvBuf, size_t cbBuf, uint32_t *pcbRead); 169 void Reset(void); 170 int Write(const void *pvBuf, size_t cbBuf, uint32_t *pcbWritten); 171 172 public: 173 174 static int RebaseURIPath(RTCString &strPath, const RTCString &strBaseOld = "", const RTCString &strBaseNew = ""); 175 176 protected: 177 178 void closeInternal(void); 179 180 protected: 181 182 Type m_Type; 183 RTCString m_strSrcPath; 184 RTCString m_strTgtPath; 185 /** Whether the object is in "opened" state. */ 186 bool m_fOpen; 187 /** Object (file/directory) mode. */ 188 uint32_t m_fMode; 189 /** Size (in bytes) to read/write. */ 190 uint64_t m_cbSize; 191 /** Bytes processed reading/writing. */ 192 uint64_t m_cbProcessed; 193 194 union 195 { 196 RTFILE m_hFile; 197 } u; 198 }; 199 200 /** DnDURIList flags. */ 201 typedef uint32_t DNDURILISTFLAGS; 93 202 94 203 /** No flags specified. */ … … 105 214 #define DNDURILIST_FLAGS_LAZY RT_BIT(3) 106 215 107 class DnDURIObject108 {109 public:110 111 enum Type112 {113 Unknown = 0,114 File,115 Directory,116 Type_32Bit_Hack = 0x7fffffff117 };118 119 enum Dest120 {121 Source = 0,122 Target,123 Dest_32Bit_Hack = 0x7fffffff124 };125 126 DnDURIObject(void);127 DnDURIObject(Type type,128 const RTCString &strSrcPath = "",129 const RTCString &strDstPath = "",130 uint32_t fMode = 0, uint64_t cbSize = 0);131 virtual ~DnDURIObject(void);132 133 public:134 135 const RTCString &GetSourcePath(void) const { return m_strSrcPath; }136 const RTCString &GetDestPath(void) const { return m_strTgtPath; }137 uint32_t GetMode(void) const { return m_fMode; }138 uint64_t GetProcessed(void) const { return m_cbProcessed; }139 uint64_t GetSize(void) const { return m_cbSize; }140 Type GetType(void) const { return m_Type; }141 142 public:143 144 int SetSize(uint64_t uSize) { m_cbSize = uSize; return VINF_SUCCESS; }145 146 public:147 148 void Close(void);149 bool IsComplete(void) const;150 bool IsOpen(void) const;151 int Open(Dest enmDest, uint64_t fOpen, uint32_t fMode = 0);152 int OpenEx(const RTCString &strPath, Type enmType, Dest enmDest, uint64_t fOpen = 0, uint32_t fMode = 0, uint32_t fFlags = 0);153 int Read(void *pvBuf, size_t cbBuf, uint32_t *pcbRead);154 void Reset(void);155 int Write(const void *pvBuf, size_t cbBuf, uint32_t *pcbWritten);156 157 public:158 159 static int RebaseURIPath(RTCString &strPath, const RTCString &strBaseOld = "", const RTCString &strBaseNew = "");160 161 protected:162 163 void closeInternal(void);164 165 protected:166 167 Type m_Type;168 RTCString m_strSrcPath;169 RTCString m_strTgtPath;170 /** Whether the object is in "opened" state. */171 bool m_fOpen;172 /** Object (file/directory) mode. */173 uint32_t m_fMode;174 /** Size (in bytes) to read/write. */175 uint64_t m_cbSize;176 /** Bytes processed reading/writing. */177 uint64_t m_cbProcessed;178 179 union180 {181 RTFILE m_hFile;182 } u;183 };184 185 216 class DnDURIList 186 217 { … … 192 223 public: 193 224 194 int AppendNativePath(const char *pszPath, uint32_tfFlags);195 int AppendNativePathsFromList(const char *pszNativePaths, size_t cbNativePaths, uint32_tfFlags);196 int AppendNativePathsFromList(const RTCList<RTCString> &lstNativePaths, uint32_tfFlags);197 int AppendURIPath(const char *pszURI, uint32_tfFlags);198 int AppendURIPathsFromList(const char *pszURIPaths, size_t cbURIPaths, uint32_tfFlags);199 int AppendURIPathsFromList(const RTCList<RTCString> &lstURI, uint32_tfFlags);225 int AppendNativePath(const char *pszPath, DNDURILISTFLAGS fFlags); 226 int AppendNativePathsFromList(const char *pszNativePaths, size_t cbNativePaths, DNDURILISTFLAGS fFlags); 227 int AppendNativePathsFromList(const RTCList<RTCString> &lstNativePaths, DNDURILISTFLAGS fFlags); 228 int AppendURIPath(const char *pszURI, DNDURILISTFLAGS fFlags); 229 int AppendURIPathsFromList(const char *pszURIPaths, size_t cbURIPaths, DNDURILISTFLAGS fFlags); 230 int AppendURIPathsFromList(const RTCList<RTCString> &lstURI, DNDURILISTFLAGS fFlags); 200 231 201 232 void Clear(void); … … 203 234 bool IsEmpty(void) const { return m_lstTree.isEmpty(); } 204 235 void RemoveFirst(void); 205 int RootFromURIData(const void *pvData, size_t cbData, uint32_t fFlags); 206 RTCString RootToString(const RTCString &strPathBase = "", const RTCString &strSeparator = "\r\n") const; 207 uint64_t RootCount(void) const { return m_lstRoot.size(); } 208 uint64_t TotalCount(void) const { return m_cTotal; } 209 uint64_t TotalBytes(void) const { return m_cbTotal; } 210 211 protected: 212 213 int addEntry(const char *pcszSource, const char *pcszTarget, uint32_t fFlags); 214 int appendPathRecursive(const char *pcszSrcPath, const char *pcszDstPath, const char *pcszDstBase, size_t cchDstBase, uint32_t fFlags); 236 int SetFromURIData(const void *pvData, size_t cbData, DNDURILISTFLAGS fFlags); 237 238 RTCString GetRootEntries(const RTCString &strPathBase = "", const RTCString &strSeparator = "\r\n") const; 239 uint64_t GetRootCount(void) const { return m_lstRoot.size(); } 240 uint64_t GetTotalCount(void) const { return m_cTotal; } 241 uint64_t GetTotalBytes(void) const { return m_cbTotal; } 242 243 protected: 244 245 int addEntry(const char *pcszSource, const char *pcszTarget, DNDURILISTFLAGS fFlags); 246 int appendPathRecursive(const char *pcszSrcPath, const char *pcszDstPath, const char *pcszDstBase, size_t cchDstBase, DNDURILISTFLAGS fFlags); 215 247 216 248 protected:
Note:
See TracChangeset
for help on using the changeset viewer.