VirtualBox

Changeset 74526 in vbox for trunk/include/VBox


Ignore:
Timestamp:
Sep 28, 2018 3:08:24 PM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
125394
Message:

DnD: Renaming for DnDURIObject / DnDURIList classes, some typedefs to distinguish flags better. No functional changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/GuestHost/DragAndDrop.h

    r69753 r74526  
    55
    66/*
    7  * Copyright (C) 2014-2017 Oracle Corporation
     7 * Copyright (C) 2014-2018 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    3838#include <iprt/cpp/ministring.h>
    3939
     40/** DnDURIDroppedFiles flags. */
     41typedef uint32_t DNDURIDROPPEDFILEFLAGS;
     42
     43/** No flags specified. */
     44#define DNDURIDROPPEDFILE_FLAGS_NONE                   0
     45
    4046/**
    4147 * Class for maintaining a "dropped files" directory
     
    5258
    5359    DnDDroppedFiles(void);
    54     DnDDroppedFiles(const char *pszPath, uint32_t fFlags);
     60    DnDDroppedFiles(const char *pszPath, DNDURIDROPPEDFILEFLAGS fFlags = DNDURIDROPPEDFILE_FLAGS_NONE);
    5561    virtual ~DnDDroppedFiles(void);
    5662
     
    6167    int Close(void);
    6268    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);
    6571    const char *GetDirAbs(void) const;
    6672    int Reopen(void);
     
    9197int DnDPathSanitizeFilename(char *pszPath, size_t cbPath);
    9298int DnDPathSanitize(char *pszPath, size_t cbPath);
     99
     100/** DnDURIObject flags. */
     101typedef uint32_t DNDURIOBJECTFLAGS;
     102
     103/** No flags specified. */
     104#define DNDURIOBJECT_FLAGS_NONE                   0
     105
     106class DnDURIObject
     107{
     108public:
     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
     148public:
     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
     157public:
     158
     159    int SetSize(uint64_t uSize) { m_cbSize = uSize; return VINF_SUCCESS; }
     160
     161public:
     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
     172public:
     173
     174    static int RebaseURIPath(RTCString &strPath, const RTCString &strBaseOld = "", const RTCString &strBaseNew = "");
     175
     176protected:
     177
     178    void closeInternal(void);
     179
     180protected:
     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. */
     201typedef uint32_t DNDURILISTFLAGS;
    93202
    94203/** No flags specified. */
     
    105214#define DNDURILIST_FLAGS_LAZY                   RT_BIT(3)
    106215
    107 class DnDURIObject
    108 {
    109 public:
    110 
    111     enum Type
    112     {
    113         Unknown = 0,
    114         File,
    115         Directory,
    116         Type_32Bit_Hack = 0x7fffffff
    117     };
    118 
    119     enum Dest
    120     {
    121         Source = 0,
    122         Target,
    123         Dest_32Bit_Hack = 0x7fffffff
    124     };
    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     union
    180     {
    181         RTFILE m_hFile;
    182     } u;
    183 };
    184 
    185216class DnDURIList
    186217{
     
    192223public:
    193224
    194     int AppendNativePath(const char *pszPath, uint32_t fFlags);
    195     int AppendNativePathsFromList(const char *pszNativePaths, size_t cbNativePaths, uint32_t fFlags);
    196     int AppendNativePathsFromList(const RTCList<RTCString> &lstNativePaths, uint32_t fFlags);
    197     int AppendURIPath(const char *pszURI, uint32_t fFlags);
    198     int AppendURIPathsFromList(const char *pszURIPaths, size_t cbURIPaths, uint32_t fFlags);
    199     int AppendURIPathsFromList(const RTCList<RTCString> &lstURI, uint32_t fFlags);
     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);
    200231
    201232    void Clear(void);
     
    203234    bool IsEmpty(void) const { return m_lstTree.isEmpty(); }
    204235    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
     243protected:
     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);
    215247
    216248protected:
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette