VirtualBox

Changeset 74714 in vbox for trunk/include/VBox


Ignore:
Timestamp:
Oct 9, 2018 11:50:22 AM (6 years ago)
Author:
vboxsync
Message:

DnD: Cleaned up DnDURIObject API / internal state handling.

File:
1 edited

Legend:

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

    r74577 r74714  
    149149    DnDURIObject(Type type,
    150150                 const RTCString &strSrcPathAbs = "",
    151                  const RTCString &strDstPathAbs = "",
    152                  uint32_t fMode = 0, uint64_t cbSize = 0);
     151                 const RTCString &strDstPathAbs = "");
    153152    virtual ~DnDURIObject(void);
    154153
     
    169168    const RTCString &GetDestPathAbs(void) const { return m_strTgtPathAbs; }
    170169
    171     /**
    172      * Returns the file mode of the object.
    173      *
    174      * Note: Only applies if the object is of type DnDURIObject::Type_File.
    175      *
    176      * @return  File mode.
    177      */
    178     uint32_t GetMode(void) const { AssertReturn(m_Type == Type_File, 0); return u.File.fMode; }
    179 
    180     /**
    181      * Returns the bytes already processed (read / written).
    182      *
    183      * Note: Only applies if the object is of type DnDURIObject::Type_File.
    184      *
    185      * @return  Bytes already processed (read / written).
    186      */
    187     uint64_t GetProcessed(void) const { AssertReturn(m_Type == Type_File, 0); return u.File.cbProcessed; }
    188 
    189     /**
    190      * Returns the file's size (in bytes).
    191      *
    192      * Note: Only applies if the object is of type DnDURIObject::Type_File.
    193      *
    194      * @return  The file's size (in bytes).
    195      */
    196     uint64_t GetSize(void) const { AssertReturn(m_Type == Type_File, 0); return u.File.cbSize; }
     170    RTFMODE GetMode(void) const;
     171
     172    uint64_t GetProcessed(void) const;
     173
     174    uint64_t GetSize(void) const;
    197175
    198176    /**
     
    201179     * @return  The object's type.
    202180     */
    203     Type GetType(void) const { return m_Type; }
    204 
    205 public:
    206 
    207     /**
    208      * Sets the bytes to process by the object.
     181    Type GetType(void) const { return m_enmType; }
     182
     183    /**
     184     * Returns the object's view.
    209185     *
    210      * Note: Only applies if the object is of type DnDURIObject::Type_File.
    211      *
    212      * @return  IPRT return code.
    213      * @param   cbSize          Size (in bytes) to process.
    214      */
    215     int SetSize(uint64_t cbSize) { AssertReturn(m_Type == Type_File, 0); u.File.cbSize = cbSize; return VINF_SUCCESS; }
     186     * @return  The object's view.
     187     */
     188    View GetView(void) const { return m_enmView; }
     189
     190public:
     191
     192    int SetSize(uint64_t cbSize);
    216193
    217194public:
     
    220197    bool IsComplete(void) const;
    221198    bool IsOpen(void) const;
    222     int Open(View enmView, uint64_t fOpen, uint32_t fMode = 0);
    223     int OpenEx(const RTCString &strPath, Type enmType, View enmView, uint64_t fOpen = 0, uint32_t fMode = 0, DNDURIOBJECTFLAGS = DNDURIOBJECT_FLAGS_NONE);
     199    int Open(View enmView, uint64_t fOpen, RTFMODE fMode = 0);
     200    int OpenEx(const RTCString &strPath, View enmView, uint64_t fOpen = 0, RTFMODE fMode = 0, DNDURIOBJECTFLAGS = DNDURIOBJECT_FLAGS_NONE);
     201    int QueryInfo(View enmView);
    224202    int Read(void *pvBuf, size_t cbBuf, uint32_t *pcbRead);
    225203    void Reset(void);
     
    233211
    234212    void closeInternal(void);
     213    int queryInfoInternal(View enmView);
    235214
    236215protected:
    237216
    238217    /** The object's type. */
    239     Type      m_Type;
     218    Type      m_enmType;
     219    /** The object's view. */
     220    View      m_enmView;
    240221    /** Absolute path (base) for the source. */
    241222    RTCString m_strSrcPathAbs;
     
    253234        {
    254235            /** File handle. */
    255             RTFILE   hFile;
    256             /** Used file mode. */
    257             uint32_t fMode;
    258             /** Size (in bytes) to read/write. */
    259             uint64_t cbSize;
     236            RTFILE      hFile;
     237            /** File system object information of this file. */
     238            RTFSOBJINFO objInfo;
     239            /** Bytes to proces for reading/writing. */
     240            uint64_t    cbToProcess;
    260241            /** Bytes processed reading/writing. */
    261             uint64_t cbProcessed;
     242            uint64_t    cbProcessed;
    262243        } File;
     244        struct
     245        {
     246            /** Directory handle. */
     247            RTDIR       hDir;
     248            /** File system object information of this directory. */
     249            RTFSOBJINFO objInfo;
     250        } Dir;
    263251    } u;
    264252};
Note: See TracChangeset for help on using the changeset viewer.

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