VirtualBox

Ignore:
Timestamp:
May 6, 2019 1:49:30 PM (6 years ago)
Author:
vboxsync
Message:

Shared Clipboard/URI: Updated GuestHost (common) code.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/GuestHost/SharedClipboard/ClipboardURIObject.cpp

    r78307 r78390  
    11/* $Id$ */
    22/** @file
    3  * DnD - URI object class. For handling creation/reading/writing to files and directories on host or guest side.
     3 * Shared Clipboard - URI object class. For handling creation/reading/writing to files and directories on host or guest side.
    44 */
    55
    66/*
    7  * Copyright (C) 2014-2019 Oracle Corporation
     7 * Copyright (C) 2019 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    2020*   Header Files                                                                                                                 *
    2121*********************************************************************************************************************************/
    22 #define LOG_GROUP LOG_GROUP_GUEST_DND
    23 #include <VBox/GuestHost/DragAndDrop.h>
     22#define LOG_GROUP LOG_GROUP_SHARED_CLIPBOARD
     23#include <VBox/GuestHost/SharedClipboard-uri.h>
    2424
    2525#include <iprt/dir.h>
     
    3333
    3434
    35 DnDURIObject::DnDURIObject(void)
     35SharedClipboardURIObject::SharedClipboardURIObject(void)
    3636    : m_enmType(Type_Unknown)
    3737    , m_enmView(View_Unknown)
     
    4040}
    4141
    42 DnDURIObject::DnDURIObject(Type enmType,
    43                            const RTCString &strSrcPathAbs /* = 0 */,
    44                            const RTCString &strDstPathAbs /* = 0 */)
     42SharedClipboardURIObject::SharedClipboardURIObject(Type enmType,
     43                                                   const RTCString &strSrcPathAbs /* = 0 */,
     44                                                   const RTCString &strDstPathAbs /* = 0 */)
    4545    : m_enmType(enmType)
    4646    , m_enmView(View_Unknown)
     
    6969}
    7070
    71 DnDURIObject::~DnDURIObject(void)
     71SharedClipboardURIObject::~SharedClipboardURIObject(void)
    7272{
    7373    closeInternal();
     
    7878 *
    7979 */
    80 void DnDURIObject::closeInternal(void)
     80void SharedClipboardURIObject::closeInternal(void)
    8181{
    8282    LogFlowThisFuncEnter();
     
    109109 * This also closes the internal handles associated with the object (to files / ...).
    110110 */
    111 void DnDURIObject::Close(void)
     111void SharedClipboardURIObject::Close(void)
    112112{
    113113    closeInternal();
     
    119119 * @return  File / directory mode.
    120120 */
    121 RTFMODE DnDURIObject::GetMode(void) const
     121RTFMODE SharedClipboardURIObject::GetMode(void) const
    122122{
    123123    switch (m_enmType)
     
    140140 * Returns the bytes already processed (read / written).
    141141 *
    142  * Note: Only applies if the object is of type DnDURIObject::Type_File.
     142 * Note: Only applies if the object is of type SharedClipboardURIObject::Type_File.
    143143 *
    144144 * @return  Bytes already processed (read / written).
    145145 */
    146 uint64_t DnDURIObject::GetProcessed(void) const
     146uint64_t SharedClipboardURIObject::GetProcessed(void) const
    147147{
    148148    if (m_enmType == Type_File)
     
    155155 * Returns the file's logical size (in bytes).
    156156 *
    157  * Note: Only applies if the object is of type DnDURIObject::Type_File.
     157 * Note: Only applies if the object is of type SharedClipboardURIObject::Type_File.
    158158 *
    159159 * @return  The file's logical size (in bytes).
    160160 */
    161 uint64_t DnDURIObject::GetSize(void) const
     161uint64_t SharedClipboardURIObject::GetSize(void) const
    162162{
    163163    if (m_enmType == Type_File)
     
    173173 * @return  True if complete, False if not.
    174174 */
    175 bool DnDURIObject::IsComplete(void) const
     175bool SharedClipboardURIObject::IsComplete(void) const
    176176{
    177177    bool fComplete;
     
    199199 * Returns whether the object is in an open state or not.
    200200 */
    201 bool DnDURIObject::IsOpen(void) const
     201bool SharedClipboardURIObject::IsOpen(void) const
    202202{
    203203    switch (m_enmType)
     
    219219 * @param   fMode               File mode to use.
    220220 */
    221 int DnDURIObject::Open(View enmView, uint64_t fOpen /* = 0 */, RTFMODE fMode /* = 0 */)
     221int SharedClipboardURIObject::Open(View enmView, uint64_t fOpen /* = 0 */, RTFMODE fMode /* = 0 */)
    222222{
    223223    return OpenEx(  enmView == View_Source
    224224                  ? m_strSrcPathAbs : m_strTgtPathAbs
    225                   , enmView, fOpen, fMode, DNDURIOBJECT_FLAGS_NONE);
     225                  , enmView, fOpen, fMode, SHAREDCLIPBOARDURIOBJECT_FLAGS_NONE);
    226226}
    227227
     
    234234 * @param   fOpen               Open mode to use; only valid for file objects.
    235235 * @param   fMode               File mode to use; only valid for file objects.
    236  * @param   fFlags              Additional DnD URI object flags.
    237  */
    238 int DnDURIObject::OpenEx(const RTCString &strPathAbs, View enmView,
    239                          uint64_t fOpen /* = 0 */, RTFMODE fMode /* = 0 */, DNDURIOBJECTFLAGS fFlags /* = DNDURIOBJECT_FLAGS_NONE */)
    240 {
    241     AssertReturn(!(fFlags & ~DNDURIOBJECT_FLAGS_VALID_MASK), VERR_INVALID_FLAGS);
     236 * @param   fFlags              Additional Shared Clipboard URI object flags.
     237 */
     238int SharedClipboardURIObject::OpenEx(const RTCString &strPathAbs, View enmView,
     239                                     uint64_t fOpen /* = 0 */, RTFMODE fMode /* = 0 */, SHAREDCLIPBOARDURIOBJECTFLAGS fFlags /* = SHAREDCLIPBOARDURIOBJECT_FLAGS_NONE */)
     240{
     241    AssertReturn(!(fFlags & ~SHAREDCLIPBOARDURIOBJECT_FLAGS_VALID_MASK), VERR_INVALID_FLAGS);
    242242    RT_NOREF1(fFlags);
    243243
     
    328328 * @param   enmView             View to use for querying information. Currently ignored.
    329329 */
    330 int DnDURIObject::queryInfoInternal(View enmView)
     330int SharedClipboardURIObject::queryInfoInternal(View enmView)
    331331{
    332332    RT_NOREF(enmView);
     
    360360 * @param   enmView             View to use for querying information.
    361361 */
    362 int DnDURIObject::QueryInfo(View enmView)
     362int SharedClipboardURIObject::QueryInfo(View enmView)
    363363{
    364364    return queryInfoInternal(enmView);
     
    374374 * @param   strBaseNew          New base path to rebase to.
    375375 *
    376  ** @todo Put this into an own class like DnDURIPath : public RTCString?
     376 ** @todo Put this into an own class like SharedClipboardURIPath : public RTCString?
    377377 */
    378378/* static */
    379 int DnDURIObject::RebaseURIPath(RTCString &strPathAbs,
     379int SharedClipboardURIObject::RebaseURIPath(RTCString &strPathAbs,
    380380                                const RTCString &strBaseOld /* = "" */,
    381381                                const RTCString &strBaseNew /* = "" */)
     
    439439 * @param   pcbRead             Pointer where to store how many bytes were read. Optional.
    440440 */
    441 int DnDURIObject::Read(void *pvBuf, size_t cbBuf, uint32_t *pcbRead)
     441int SharedClipboardURIObject::Read(void *pvBuf, size_t cbBuf, uint32_t *pcbRead)
    442442{
    443443    AssertPtrReturn(pvBuf, VERR_INVALID_POINTER);
     
    495495 * Resets the object's state and closes all related handles.
    496496 */
    497 void DnDURIObject::Reset(void)
     497void SharedClipboardURIObject::Reset(void)
    498498{
    499499    LogFlowThisFuncEnter();
     
    512512 * Sets the bytes to process by the object.
    513513 *
    514  * Note: Only applies if the object is of type DnDURIObject::Type_File.
     514 * Note: Only applies if the object is of type SharedClipboardURIObject::Type_File.
    515515 *
    516516 * @return  IPRT return code.
    517517 * @param   cbSize          Size (in bytes) to process.
    518518 */
    519 int DnDURIObject::SetSize(uint64_t cbSize)
     519int SharedClipboardURIObject::SetSize(uint64_t cbSize)
    520520{
    521521    AssertReturn(m_enmType == Type_File, VERR_INVALID_PARAMETER);
     
    535535 * @param   pcbWritten          Pointer where to store how many bytes were written. Optional.
    536536 */
    537 int DnDURIObject::Write(const void *pvBuf, size_t cbBuf, uint32_t *pcbWritten)
     537int SharedClipboardURIObject::Write(const void *pvBuf, size_t cbBuf, uint32_t *pcbWritten)
    538538{
    539539    AssertPtrReturn(pvBuf, VERR_INVALID_POINTER);
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