VirtualBox

Changeset 74575 in vbox for trunk/include/VBox


Ignore:
Timestamp:
Oct 2, 2018 9:40:00 AM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
125445
Message:

DnD/DnDObject: Documentation, a bit of cleaning / re-structuring. No functional changes (forgot to commit that file).

File:
1 edited

Legend:

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

    r74526 r74575  
    104104#define DNDURIOBJECT_FLAGS_NONE                   0
    105105
     106/** Mask of all valid DnD URI object flags. */
     107#define DNDURIOBJECT_FLAGS_VALID_MASK             UINT32_C(0x0)
     108
     109/**
     110 * Class for handling DnD URI objects.
     111 * This class abstracts the access and handling objects when performing DnD actions.
     112 */
    106113class DnDURIObject
    107114{
     
    125132    /**
    126133     * Enumeration for specifying an URI object view
    127      * represent its data accordingly.
     134     * for representing its data accordingly.
    128135     */
    129136    enum View
     
    141148    DnDURIObject(void);
    142149    DnDURIObject(Type type,
    143                  const RTCString &strSrcPath = "",
    144                  const RTCString &strDstPath = "",
     150                 const RTCString &strSrcPathAbs = "",
     151                 const RTCString &strDstPathAbs = "",
    145152                 uint32_t fMode = 0, uint64_t cbSize = 0);
    146153    virtual ~DnDURIObject(void);
     
    148155public:
    149156
    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; }
     157    /**
     158     * Returns the given absolute source path of the object.
     159     *
     160     * @return  Absolute source path of the object.
     161     */
     162    const RTCString &GetSourcePathAbs(void) const { return m_strSrcPathAbs; }
     163
     164    /**
     165     * Returns the given, absolute destination path of the object.
     166     *
     167     * @return  Absolute destination path of the object.
     168     */
     169    const RTCString &GetDestPathAbs(void) const { return m_strTgtPathAbs; }
     170
     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; }
     197
     198    /**
     199     * Returns the object's type.
     200     *
     201     * @return  The object's type.
     202     */
    155203    Type GetType(void) const { return m_Type; }
    156204
    157205public:
    158206
    159     int SetSize(uint64_t uSize) { m_cbSize = uSize; return VINF_SUCCESS; }
     207    /**
     208     * Sets the bytes to process by the object.
     209     *
     210     * Note: Only applies if the object is of type DnDURIObject::Type_File.
     211     *
     212     * @return  IPRT return code.
     213     * @param   uSize           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; }
    160216
    161217public:
     
    180236protected:
    181237
     238    /** The object's type. */
    182239    Type      m_Type;
    183     RTCString m_strSrcPath;
    184     RTCString m_strTgtPath;
     240    /** Absolute path (base) for the source. */
     241    RTCString m_strSrcPathAbs;
     242    /** Absolute path (base) for the target. */
     243    RTCString m_strTgtPathAbs;
    185244    /** 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 
     245    bool      m_fIsOpen;
     246
     247    /** Union containing data depending on the object's type. */
    194248    union
    195249    {
    196         RTFILE m_hFile;
     250        /** Structure containing members for objects that
     251         *  are files. */
     252        struct
     253        {
     254            /** File handle. */
     255            RTFILE   hFile;
     256            /** Used file mode. */
     257            uint32_t fMode;
     258            /** Size (in bytes) to read/write. */
     259            uint64_t cbSize;
     260            /** Bytes processed reading/writing. */
     261            uint64_t cbProcessed;
     262        } File;
    197263    } u;
    198264};
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