VirtualBox

Changeset 55523 in vbox


Ignore:
Timestamp:
Apr 29, 2015 2:33:39 PM (10 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
99882
Message:

Main: extend IVetoEvent interface to support approvals too.

Location:
trunk/src/VBox/Main
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r55505 r55523  
    2205522055  <interface
    2205622056    name="IVetoEvent" extends="IEvent"
    22057     uuid="9a1a4130-69fe-472f-ac10-c6fa25d75007"
     22057    uuid="7c5e945f-2354-4267-883f-2f417d216519"
    2205822058    wsmap="managed"
    2205922059    >
     
    2208922089        <desc>
    2209022090          Array of reasons for veto provided by different event handlers.
     22091        </desc>
     22092      </param>
     22093    </method>
     22094
     22095    <method name="addApproval">
     22096      <desc>
     22097        Adds an approval on this event.
     22098      </desc>
     22099      <param name="reason" type="wstring" dir="in">
     22100        <desc>
     22101          Reason for approval, could be null or empty string.
     22102        </desc>
     22103      </param>
     22104    </method>
     22105
     22106    <method name="isApproved">
     22107      <desc>
     22108        If this event was approved.
     22109      </desc>
     22110      <param name="result" type="boolean" dir="return" />
     22111    </method>
     22112
     22113    <method name="getApprovals">
     22114      <desc>
     22115        Current approval reason list, if size is 0 - no approvals.
     22116      </desc>
     22117      <param name="result" type="wstring" dir="return" safearray="yes">
     22118        <desc>
     22119          Array of reasons for approval provided by different event handlers.
    2209122120        </desc>
    2209222121      </param>
  • trunk/src/VBox/Main/idl/comimpl.xsl

    r53917 r55523  
    556556       return mEvent->GetVetos(ComSafeArrayOutArg(aVetos));
    557557    }
     558    STDMETHOD(AddApproval)(IN_BSTR aReason)
     559    {
     560        return mEvent->AddApproval(aReason);
     561    }
     562    STDMETHOD(IsApproved)(BOOL *aResult)
     563    {
     564       return mEvent->IsApproved(aResult);
     565    }
     566    STDMETHOD(GetApprovals)(ComSafeArrayOut(BSTR, aReasons))
     567    {
     568       return mEvent->GetApprovals(ComSafeArrayOutArg(aReasons));
     569    }
    558570private:
    559571    ComObjPtr<VBoxVetoEvent>      mEvent;
  • trunk/src/VBox/Main/include/EventImpl.h

    r52720 r55523  
    7979    HRESULT isVetoed(BOOL *aResult);
    8080    HRESULT getVetos(std::vector<com::Utf8Str> &aResult);
     81    HRESULT addApproval(const com::Utf8Str &aReason);
     82    HRESULT isApproved(BOOL *aResult);
     83    HRESULT getApprovals(std::vector<com::Utf8Str> &aResult);
    8184
    8285    struct Data;
  • trunk/src/VBox/Main/src-all/EventImpl.cpp

    r53160 r55523  
    228228
    229229typedef std::list<Utf8Str> VetoList;
     230typedef std::list<Utf8Str> ApprovalList;
    230231struct VBoxVetoEvent::Data
    231232{
     
    236237    BOOL                    mVetoed;
    237238    VetoList                mVetoList;
     239    ApprovalList            mApprovalList;
    238240};
    239241
     
    272274    m->mVetoed = FALSE;
    273275    m->mVetoList.clear();
     276    m->mApprovalList.clear();
    274277
    275278    /* Confirm a successful initialization */
     
    350353    return S_OK;
    351354
     355}
     356
     357HRESULT VBoxVetoEvent::addApproval(const com::Utf8Str &aReason)
     358{
     359    // AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     360    m->mApprovalList.push_back(aReason);
     361    return S_OK;
     362}
     363
     364HRESULT VBoxVetoEvent::isApproved(BOOL *aResult)
     365{
     366    // AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     367    *aResult = !m->mApprovalList.empty();
     368    return S_OK;
     369}
     370
     371HRESULT VBoxVetoEvent::getApprovals(std::vector<com::Utf8Str> &aResult)
     372{
     373    // AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     374    aResult.resize(m->mApprovalList.size());
     375    size_t i = 0;
     376    for (ApprovalList::const_iterator it = m->mApprovalList.begin(); it != m->mApprovalList.end(); ++it, ++i)
     377        aResult[i] = (*it);
     378    return S_OK;
    352379}
    353380
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