本文整理汇总了C++中AccessibleWrap::AddRef方法的典型用法代码示例。如果您正苦于以下问题:C++ AccessibleWrap::AddRef方法的具体用法?C++ AccessibleWrap::AddRef怎么用?C++ AccessibleWrap::AddRef使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AccessibleWrap
的用法示例。
在下文中一共展示了AccessibleWrap::AddRef方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
STDMETHODIMP
ia2Accessible::get_selectionRanges(IA2Range** aRanges,
long *aNRanges)
{
if (!aRanges || !aNRanges)
return E_INVALIDARG;
*aNRanges = 0;
AccessibleWrap* acc = static_cast<AccessibleWrap*>(this);
if (acc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
AutoTArray<TextRange, 1> ranges;
acc->Document()->SelectionRanges(&ranges);
uint32_t len = ranges.Length();
for (uint32_t idx = 0; idx < len; idx++) {
if (!ranges[idx].Crop(acc)) {
ranges.RemoveElementAt(idx);
}
}
*aNRanges = ranges.Length();
*aRanges = static_cast<IA2Range*>(
::CoTaskMemAlloc(sizeof(IA2Range) * *aNRanges));
if (!*aRanges)
return E_OUTOFMEMORY;
for (uint32_t idx = 0; idx < static_cast<uint32_t>(*aNRanges); idx++) {
AccessibleWrap* anchor =
static_cast<AccessibleWrap*>(ranges[idx].StartContainer());
(*aRanges)[idx].anchor = static_cast<IAccessible2*>(anchor);
anchor->AddRef();
(*aRanges)[idx].anchorOffset = ranges[idx].StartOffset();
AccessibleWrap* active =
static_cast<AccessibleWrap*>(ranges[idx].EndContainer());
(*aRanges)[idx].active = static_cast<IAccessible2*>(active);
active->AddRef();
(*aRanges)[idx].activeOffset = ranges[idx].EndOffset();
}
return S_OK;
}
示例2: DocProxyAccessibleWrap
void
a11y::ProxyCreated(ProxyAccessible* aProxy, uint32_t aInterfaces)
{
AccessibleWrap* wrapper = nullptr;
if (aProxy->IsDoc()) {
wrapper = new DocProxyAccessibleWrap(aProxy->AsDoc());
} else {
wrapper = new ProxyAccessibleWrap(aProxy);
}
wrapper->AddRef();
aProxy->SetWrapper(reinterpret_cast<uintptr_t>(wrapper));
}
示例3: DocProxyAccessibleWrap
void
a11y::ProxyCreated(ProxyAccessible* aProxy, uint32_t aInterfaces)
{
AccessibleWrap* wrapper = nullptr;
if (aInterfaces & Interfaces::DOCUMENT) {
wrapper = new DocProxyAccessibleWrap(aProxy);
} else if (aInterfaces & Interfaces::HYPERTEXT) {
wrapper = new HyperTextProxyAccessibleWrap(aProxy);
} else {
wrapper = new ProxyAccessibleWrap(aProxy);
}
wrapper->SetProxyInterfaces(aInterfaces);
wrapper->AddRef();
aProxy->SetWrapper(reinterpret_cast<uintptr_t>(wrapper));
}
示例4:
STDMETHODIMP
ia2AccessibleValue::QueryInterface(REFIID iid, void** ppv)
{
*ppv = NULL;
if (IID_IAccessibleValue == iid) {
AccessibleWrap* valueAcc = static_cast<AccessibleWrap*>(this);
if (valueAcc->HasNumericValue()) {
*ppv = static_cast<IAccessibleValue*>(this);
valueAcc->AddRef();
return S_OK;
}
return E_NOINTERFACE;
}
return E_NOINTERFACE;
}