本文整理汇总了C++中ToArray函数的典型用法代码示例。如果您正苦于以下问题:C++ ToArray函数的具体用法?C++ ToArray怎么用?C++ ToArray使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ToArray函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: lock
GMPErr
GMPStorageChild::Write(GMPRecordImpl* aRecord,
const uint8_t* aData,
uint32_t aDataSize)
{
if (aDataSize > GMP_MAX_RECORD_SIZE) {
return GMPQuotaExceededErr;
}
MonitorAutoLock lock(mMonitor);
if (mShutdown) {
NS_WARNING("GMPStorage used after it's been shutdown!");
return GMPClosedErr;
}
if (!HasRecord(aRecord->Name())) {
// Record not opened.
return GMPClosedErr;
}
CALL_ON_GMP_THREAD(SendWrite, aRecord->Name(), ToArray(aData, aDataSize));
return GMPNoErr;
}
示例2: PDF_EncodeText
int CPDF_FormField::InsertOption(CFX_WideString csOptLabel,
int index,
FX_BOOL bNotify) {
if (csOptLabel.IsEmpty())
return -1;
if (bNotify && !NotifyListOrComboBoxBeforeChange(csOptLabel))
return -1;
CFX_ByteString csStr =
PDF_EncodeText(csOptLabel.c_str(), csOptLabel.GetLength());
CPDF_Object* pValue = FPDF_GetFieldAttr(m_pDict, "Opt");
CPDF_Array* pOpt = ToArray(pValue);
if (!pOpt) {
pOpt = new CPDF_Array;
m_pDict->SetAt("Opt", pOpt);
}
int iCount = (int)pOpt->GetCount();
if (index < 0 || index >= iCount) {
pOpt->AddString(csStr);
index = iCount;
} else {
CPDF_String* pString = new CPDF_String(csStr, FALSE);
pOpt->InsertAt(index, pString);
}
if (bNotify)
NotifyListOrComboBoxAfterChange();
return index;
}
示例3: StopAllListener
// Stop all listener in Cedar
void StopAllListener(CEDAR *c)
{
LISTENER **array;
UINT i, num;
// Validate arguments
if (c == NULL)
{
return;
}
LockList(c->ListenerList);
{
array = ToArray(c->ListenerList);
num = LIST_NUM(c->ListenerList);
DeleteAll(c->ListenerList);
}
UnlockList(c->ListenerList);
for (i = 0;i < num;i++)
{
StopListener(array[i]);
ReleaseListener(array[i]);
}
Free(array);
}
示例4: PDF_EncodeText
int CPDF_FormField::InsertOption(CFX_WideString csOptLabel,
int index,
bool bNotify) {
if (csOptLabel.IsEmpty())
return -1;
if (bNotify && !NotifyListOrComboBoxBeforeChange(csOptLabel))
return -1;
CFX_ByteString csStr =
PDF_EncodeText(csOptLabel.c_str(), csOptLabel.GetLength());
CPDF_Array* pOpt = ToArray(FPDF_GetFieldAttr(m_pDict, "Opt"));
if (!pOpt)
pOpt = m_pDict->SetNewFor<CPDF_Array>("Opt");
int iCount = pdfium::base::checked_cast<int>(pOpt->GetCount());
if (index >= iCount) {
pOpt->AddNew<CPDF_String>(csStr, false);
index = iCount;
} else {
pOpt->InsertNewAt<CPDF_String>(index, csStr, false);
}
if (bNotify)
NotifyListOrComboBoxAfterChange();
return index;
}
示例5: StopAllHub
// Stop all hubs in Cedar
void StopAllHub(CEDAR *c)
{
HUB **hubs;
UINT i, num;
// Validate arguments
if (c == NULL)
{
return;
}
LockHubList(c);
{
hubs = ToArray(c->HubList);
num = LIST_NUM(c->HubList);
DeleteAll(c->HubList);
}
UnlockHubList(c);
for (i = 0;i < num;i++)
{
StopHub(hubs[i]);
ReleaseHub(hubs[i]);
}
Free(hubs);
}
示例6: FreeTable
// Release the table
void FreeTable()
{
UINT i, num;
TABLE **tables;
if (TableList == NULL)
{
return;
}
TrackingDisable();
num = LIST_NUM(TableList);
tables = ToArray(TableList);
for (i = 0;i < num;i++)
{
TABLE *t = tables[i];
Free(t->name);
Free(t->str);
Free(t->unistr);
Free(t);
}
ReleaseList(TableList);
TableList = NULL;
Free(tables);
Zero(old_table_name, sizeof(old_table_name));
TrackingEnable();
}
示例7: ASSERT
void CPDFSDK_ActionHandler::DoAction_GoTo(CPDFSDK_Document* pDocument,
const CPDF_Action& action) {
ASSERT(action);
CPDF_Document* pPDFDocument = pDocument->GetPDFDocument();
ASSERT(pPDFDocument);
CPDF_Dest MyDest = action.GetDest(pPDFDocument);
int nPageIndex = MyDest.GetPageIndex(pPDFDocument);
int nFitType = MyDest.GetZoomMode();
const CPDF_Array* pMyArray = ToArray(MyDest.GetObject());
float* pPosAry = nullptr;
int sizeOfAry = 0;
if (pMyArray) {
pPosAry = new float[pMyArray->GetCount()];
int j = 0;
for (int i = 2; i < (int)pMyArray->GetCount(); i++) {
pPosAry[j++] = pMyArray->GetFloat(i);
}
sizeOfAry = j;
}
CPDFDoc_Environment* pApp = pDocument->GetEnv();
pApp->FFI_DoGoToAction(nPageIndex, nFitType, pPosAry, sizeOfAry);
delete[] pPosAry;
}
示例8: StopAllLink
// Stop all links
void StopAllLink(HUB *h)
{
LINK **link_list;
UINT num_link;
UINT i;
// Validate arguments
if (h == NULL)
{
return;
}
LockList(h->LinkList);
{
link_list = ToArray(h->LinkList);
num_link = LIST_NUM(h->LinkList);
for (i = 0;i < num_link;i++)
{
AddRef(link_list[i]->ref);
}
}
UnlockList(h->LinkList);
for (i = 0;i < num_link;i++)
{
StopLink(link_list[i]);
ReleaseLink(link_list[i]);
}
Free(link_list);
}
示例9: ReleaseAllLink
// Release all links
void ReleaseAllLink(HUB *h)
{
LINK **kk;
UINT num, i;
// Validate arguments
if (h == NULL)
{
return;
}
LockList(h->LinkList);
{
num = LIST_NUM(h->LinkList);
kk = ToArray(h->LinkList);
DeleteAll(h->LinkList);
}
UnlockList(h->LinkList);
for (i = 0;i < num;i++)
{
LINK *k = kk[i];
ReleaseLink(k);
}
Free(kk);
}
示例10: StopAllConnection
// Stop all connections
void StopAllConnection(CEDAR *c)
{
UINT num;
UINT i;
CONNECTION **connections;
// Validate arguments
if (c == NULL)
{
return;
}
LockList(c->ConnectionList);
{
connections = ToArray(c->ConnectionList);
num = LIST_NUM(c->ConnectionList);
DeleteAll(c->ConnectionList);
}
UnlockList(c->ConnectionList);
for (i = 0;i < num;i++)
{
StopConnection(connections[i], false);
ReleaseConnection(connections[i]);
}
Free(connections);
}
示例11: ASSERT
FX_BOOL CPDF_FormField::CheckControl(int iControlIndex,
bool bChecked,
bool bNotify) {
ASSERT(GetType() == CheckBox || GetType() == RadioButton);
CPDF_FormControl* pControl = GetControl(iControlIndex);
if (!pControl) {
return FALSE;
}
if (!bChecked && pControl->IsChecked() == bChecked) {
return FALSE;
}
CFX_WideString csWExport = pControl->GetExportValue();
CFX_ByteString csBExport = PDF_EncodeText(csWExport);
int iCount = CountControls();
bool bUnison = PDF_FormField_IsUnison(this);
for (int i = 0; i < iCount; i++) {
CPDF_FormControl* pCtrl = GetControl(i);
if (bUnison) {
CFX_WideString csEValue = pCtrl->GetExportValue();
if (csEValue == csWExport) {
if (pCtrl->GetOnStateName() == pControl->GetOnStateName()) {
pCtrl->CheckControl(bChecked);
} else if (bChecked) {
pCtrl->CheckControl(FALSE);
}
} else if (bChecked) {
pCtrl->CheckControl(FALSE);
}
} else {
if (i == iControlIndex) {
pCtrl->CheckControl(bChecked);
} else if (bChecked) {
pCtrl->CheckControl(FALSE);
}
}
}
CPDF_Object* pOpt = FPDF_GetFieldAttr(m_pDict, "Opt");
if (!ToArray(pOpt)) {
if (bChecked) {
m_pDict->SetAtName("V", csBExport);
} else {
CFX_ByteString csV;
CPDF_Object* pV = FPDF_GetFieldAttr(m_pDict, "V");
if (pV) {
csV = pV->GetString();
}
if (csV == csBExport) {
m_pDict->SetAtName("V", "Off");
}
}
} else if (bChecked) {
CFX_ByteString csIndex;
csIndex.Format("%d", iControlIndex);
m_pDict->SetAtName("V", csIndex);
}
if (bNotify && m_pForm->m_pFormNotify)
m_pForm->m_pFormNotify->AfterCheckedStatusChange(this);
return TRUE;
}
示例12: ElStopListener
// Listener stop
void ElStopListener(EL *e)
{
UINT i;
THREAD **threads;
SOCK **socks;
UINT num_threads, num_socks;
// Validate arguments
if (e == NULL)
{
return;
}
StopAllListener(e->Cedar);
LockList(e->AdminThreadList);
{
threads = ToArray(e->AdminThreadList);
num_threads = LIST_NUM(e->AdminThreadList);
DeleteAll(e->AdminThreadList);
socks = ToArray(e->AdminSockList);
num_socks = LIST_NUM(e->AdminSockList);
DeleteAll(e->AdminSockList);
}
UnlockList(e->AdminThreadList);
for (i = 0;i < num_socks;i++)
{
Disconnect(socks[i]);
ReleaseSock(socks[i]);
}
for (i = 0;i < num_threads;i++)
{
WaitThread(threads[i], INFINITE);
ReleaseThread(threads[i]);
}
Free(threads);
Free(socks);
ReleaseList(e->AdminSockList);
ReleaseList(e->AdminThreadList);
ReleaseListener(e->Listener);
}
示例13: getCmd
Cmd getCmd(char *cmd,char *del ){
Cmd c;
Array *arr=split(cmd,del);
c.argc =ToArray(arr,&c.argv);
c.parent=NULL;
c.prev=NULL;
c.next=NULL;
return c;
}
示例14: ToArray
int CPDF_FormField::GetSelectedOptionIndex(int index) const {
CPDF_Array* pArray = ToArray(FPDF_GetFieldAttr(m_pDict, "I"));
if (!pArray)
return -1;
int iCount = pArray->GetCount();
if (iCount < 0 || index >= iCount)
return -1;
return pArray->GetIntegerAt(index);
}
示例15: ToArray
bool CPDF_FormField::IsOptionSelected(int iOptIndex) const {
CPDF_Array* pArray = ToArray(FPDF_GetFieldAttr(m_pDict, "I"));
if (!pArray)
return false;
for (const auto& pObj : *pArray) {
if (pObj->GetInteger() == iOptIndex)
return true;
}
return false;
}