本文整理汇总了C++中com::Utf8Str::length方法的典型用法代码示例。如果您正苦于以下问题:C++ Utf8Str::length方法的具体用法?C++ Utf8Str::length怎么用?C++ Utf8Str::length使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com::Utf8Str
的用法示例。
在下文中一共展示了Utf8Str::length方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createSession
// implementation of public methods
/////////////////////////////////////////////////////////////////////////////
HRESULT Guest::createSession(const com::Utf8Str &aUser, const com::Utf8Str &aPassword, const com::Utf8Str &aDomain,
const com::Utf8Str &aSessionName, ComPtr<IGuestSession> &aGuestSession)
{
#ifndef VBOX_WITH_GUEST_CONTROL
ReturnComNotImplemented();
#else /* VBOX_WITH_GUEST_CONTROL */
LogFlowFuncEnter();
/* Do not allow anonymous sessions (with system rights) with public API. */
if (RT_UNLIKELY(!aUser.length()))
return setError(E_INVALIDARG, tr("No user name specified"));
GuestSessionStartupInfo startupInfo;
startupInfo.mName = aSessionName;
GuestCredentials guestCreds;
guestCreds.mUser = aUser;
guestCreds.mPassword = aPassword;
guestCreds.mDomain = aDomain;
ComObjPtr<GuestSession> pSession;
int rc = i_sessionCreate(startupInfo, guestCreds, pSession);
if (RT_SUCCESS(rc))
{
/* Return guest session to the caller. */
HRESULT hr2 = pSession.queryInterfaceTo(aGuestSession.asOutParam());
if (FAILED(hr2))
rc = VERR_COM_OBJECT_NOT_FOUND;
}
if (RT_SUCCESS(rc))
/* Start (fork) the session asynchronously
* on the guest. */
rc = pSession->i_startSessionAsync();
HRESULT hr = S_OK;
if (RT_FAILURE(rc))
{
switch (rc)
{
case VERR_MAX_PROCS_REACHED:
hr = setError(VBOX_E_IPRT_ERROR, tr("Maximum number of concurrent guest sessions (%ld) reached"),
VBOX_GUESTCTRL_MAX_SESSIONS);
break;
/** @todo Add more errors here. */
default:
hr = setError(VBOX_E_IPRT_ERROR, tr("Could not create guest session: %Rrc"), rc);
break;
}
}
LogFlowThisFunc(("Returning rc=%Rhrc\n", hr));
return hr;
#endif /* VBOX_WITH_GUEST_CONTROL */
}
示例2: addVeto
HRESULT VBoxVetoEvent::addVeto(const com::Utf8Str &aReason)
{
// AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
if (aReason.length())
m->mVetoList.push_back(aReason);
m->mVetoed = TRUE;
return S_OK;
}
示例3: dumpGuestCore
HRESULT MachineDebugger::dumpGuestCore(const com::Utf8Str &aFilename, const com::Utf8Str &aCompression)
{
if (aCompression.length())
return setError(E_INVALIDARG, tr("The compression parameter must be empty"));
AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
Console::SafeVMPtr ptrVM(mParent);
HRESULT hrc = ptrVM.rc();
if (SUCCEEDED(hrc))
{
int vrc = DBGFR3CoreWrite(ptrVM.rawUVM(), aFilename.c_str(), false /*fReplaceFile*/);
if (RT_SUCCESS(vrc))
hrc = S_OK;
else
hrc = setError(E_FAIL, tr("DBGFR3CoreWrite failed with %Rrc"), vrc);
}
return hrc;
}
示例4: drop
HRESULT GuestDnDSource::drop(const com::Utf8Str &aFormat,
DnDAction_T aAction, ComPtr<IProgress> &aProgress)
{
#if !defined(VBOX_WITH_DRAG_AND_DROP) || !defined(VBOX_WITH_DRAG_AND_DROP_GH)
ReturnComNotImplemented();
#else /* VBOX_WITH_DRAG_AND_DROP */
/* Input validation. */
if (RT_UNLIKELY((aFormat.c_str()) == NULL || *(aFormat.c_str()) == '\0'))
return setError(E_INVALIDARG, tr("No drop format specified"));
AutoCaller autoCaller(this);
if (FAILED(autoCaller.rc())) return autoCaller.rc();
uint32_t uAction = GuestDnD::toHGCMAction(aAction);
/* If there is no usable action, ignore this request. */
if (isDnDIgnoreAction(uAction))
return S_OK;
HRESULT hr = S_OK;
const char *pcszFormat = aFormat.c_str();
bool fNeedsDropDir = DnDMIMENeedsDropDir(pcszFormat, strlen(pcszFormat));
LogFlowFunc(("strFormat=%s, uAction=0x%x, fNeedsDropDir=%RTbool\n",
pcszFormat, uAction, fNeedsDropDir));
GuestDnDResponse *pResp = GuestDnDInst()->response();
if (pResp)
{
/* Reset any old data. */
pResp->reset();
pResp->resetProgress(m_pGuest);
/* Set the format we are going to retrieve to have it around
* when retrieving the data later. */
pResp->setFormat(aFormat);
if (fNeedsDropDir)
{
char szDropDir[RTPATH_MAX];
int rc = DnDDirCreateDroppedFiles(szDropDir, sizeof(szDropDir));
LogFlowFunc(("rc=%Rrc, szDropDir=%s\n", rc, szDropDir));
if (RT_FAILURE(rc))
return setError(VBOX_E_IPRT_ERROR,
tr("Unable to create the temporary drag and drop directory \"%s\" (%Rrc)\n"),
szDropDir, rc);
pResp->setDropDir(szDropDir);
}
VBOXHGCMSVCPARM paParms[4];
int i = 0;
paParms[i++].setPointer((void*)aFormat.c_str(), (uint32_t)aFormat.length() + 1);
paParms[i++].setUInt32((uint32_t)aFormat.length() + 1);
paParms[i++].setUInt32(uAction);
int rc = GuestDnDInst()->hostCall(DragAndDropSvc::HOST_DND_GH_EVT_DROPPED,
i, paParms);
if (RT_SUCCESS(rc))
{
/* Query the progress object to the caller. */
pResp->queryProgressTo(aProgress.asOutParam());
}
else
hr = setError(VBOX_E_IPRT_ERROR,
tr("Error signalling to drop data (%Rrc)\n"), rc);
}
LogFlowFunc(("Returning hr=%Rhrc\n", hr));
return hr;
#endif /* VBOX_WITH_DRAG_AND_DROP */
}