本文整理汇总了C++中KVI_ASSERT函数的典型用法代码示例。如果您正苦于以下问题:C++ KVI_ASSERT函数的具体用法?C++ KVI_ASSERT怎么用?C++ KVI_ASSERT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了KVI_ASSERT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: resetInternalStatus
KviHttpRequest::~KviHttpRequest()
{
resetInternalStatus();
KVI_ASSERT(!(m_p->pSocket));
KVI_ASSERT(!(m_p->pFile));
if(m_p->pBuffer)
delete m_p->pBuffer;
delete m_p;
}
示例2: KVI_ASSERT
void PopupEditorWidget::getUniquePopupName(MenuTreeWidgetItem * item, QString & buffer)
{
KVI_ASSERT(m_bOneTimeSetupDone);
if(buffer.isEmpty())
buffer = __tr2qs_ctx("unnamed", "editor");
QString newName = buffer;
bool bFound = true;
int idx = 1;
int topcount = m_pTreeWidget->topLevelItemCount();
while(bFound)
{
bFound = false;
for(int i = 0; i < topcount; i++)
{
MenuTreeWidgetItem * ch = (MenuTreeWidgetItem *)m_pTreeWidget->topLevelItem(i);
if(KviQString::equalCI(newName, ch->m_pPopup->popupName()) && (ch != item))
{
bFound = true;
newName = QString("%1.%2").arg(buffer).arg(idx);
idx++;
break;
}
}
}
buffer = newName;
}
示例3: KVI_ASSERT
void RawEditorWidget::getUniqueHandlerName(RawTreeWidgetItem *it,QString &buffer)
{
KVI_ASSERT(m_bOneTimeSetupDone);
QString newName = buffer;
if(newName.isEmpty())newName = __tr2qs_ctx("unnamed","editor");
bool bFound = true;
int idx = 1;
while(bFound)
{
bFound = false;
for (int i=0;i<it->childCount();i++)
{
RawHandlerTreeWidgetItem * ch =(RawHandlerTreeWidgetItem *) it->child(i);
if(KviQString::equalCI(newName,ch->text(0)))
{
bFound = true;
newName = QString("%1_%2").arg(buffer).arg(idx);
idx++;
break;
}
}
}
buffer = newName;
}
示例4: KVI_ASSERT
void EventEditor::getUniqueHandlerName(EventEditorEventTreeWidgetItem *it,QString &buffer)
{
KVI_ASSERT(m_bOneTimeSetupDone);
QString newName = buffer;
if(newName.isEmpty())newName = __tr2qs_ctx("unnamed","editor");
bool bFound = true;
int idx = 1;
while(bFound)
{
bFound = false;
for(int i=0;i<it->childCount();i++)
//for(EventEditorHandlerTreeWidgetItem * ch = (EventEditorHandlerTreeWidgetItem *)(it->firstChild());ch;ch = (EventEditorHandlerTreeWidgetItem *)ch->nextSibling())
{
if(KviQString::equalCI(newName,((EventEditorHandlerTreeWidgetItem *)it->child(i))->m_szName))
{
bFound = true;
newName = QString("%1_%2").arg(buffer).arg(idx);
idx++;
break;
}
}
}
buffer = newName;
}
示例5: KVI_ASSERT
void KviHttpRequest::slotSocketReadDataReady()
{
KVI_ASSERT(m_p->pSocket);
int iBytes = m_p->pSocket->bytesAvailable();
if(iBytes <= 0)
{
// assume connection closed ?
slotSocketDisconnected();
return;
}
// FIXME: Avoid double-buffering here!
KviDataBuffer oBuffer(iBytes);
int iRead = m_p->pSocket->read((char *)(oBuffer.data()),iBytes);
if(iRead < iBytes)
{
// hum.... what here ?
if(iRead < 1)
{
slotSocketDisconnected();
return;
}
// FIXME
// well... otherwise just wait.
// FIXME ?
oBuffer.resize(iRead);
}
processData(&oBuffer);
}
示例6: KVI_ASSERT
void KviMdiChild::setClient(QWidget * w)
{
KVI_ASSERT(!m_pClient);
KVI_ASSERT(w);
m_pClient = w;
setWidget(w);
QString tmp1;
if(w->inherits("KviWindow"))
{
KviIrcConnection * pConnection=((KviWindow*)w)->connection();
if(pConnection)
tmp1.append(pConnection->target()->network()->name()+"_");
}
KviCString tmp(KviCString::Format,"mdi_child_%s%s",tmp1.toUtf8().data(),w->objectName().toUtf8().data());
setObjectName(tmp.ptr());
}
示例7: KVI_ASSERT
KviQueryWindow * KviIrcContext::findDeadQuery(const QString & name)
{
for(auto & q : m_DeadQueries)
{
KVI_ASSERT(q->isDeadQuery());
if(KviQString::equalCI(name, q->windowName()))
return q;
}
return nullptr;
}
示例8: url_compare_helper
static inline bool url_compare_helper(const kvi_wchar_t * pData1, const kvi_wchar_t * pData2, int iData2Len)
{
KVI_ASSERT(pData1);
KVI_ASSERT(pData2);
// pData1 is null-terminated and may be shorter than pData2
// pData2 is NOT null terminated and is lower case
const kvi_wchar_t * pData2End = pData2 + iData2Len;
while(pData2 < pData2End)
{
if(!*pData1)
return false; // not equal
if(QChar::toLower(*pData1) != *pData2)
return false; // not equal
pData1++;
pData2++;
}
return true; // all equal up to iData2Len
}
示例9: KVI_ASSERT
bool KviIrcView::event(QEvent *e)
{
if(e->type() == QEvent::User)
{
KVI_ASSERT(m_bPostedPaintEventPending);
if(m_iUnprocessedPaintEventRequests)
repaint();
// else we just had a pointEvent that did the job
m_bPostedPaintEventPending = false;
return true;
}
return QWidget::event(e);
}
示例10: KVI_ASSERT
void KviKvsObjectController::deleteClass(KviKvsObjectClass * pClass)
{
KVI_ASSERT(pClass);
pClass->clearDirtyFlag(); // don't flush it to disk
QString szPath;
QString szFileName = pClass->name().toLower();
szFileName += ".kvs";
szFileName.replace("::","--");
g_pApp->getLocalKvircDirectory(szPath,KviApplication::Classes,szFileName);
KviFileUtils::removeFile(szPath);
delete pClass;
}
示例11: cfg
void KviRegisteredChannelDataBase::save(const QString &filename)
{
KviConfigurationFile cfg(filename,KviConfigurationFile::Write);
cfg.clear();
cfg.preserveEmptyGroups(true);
for(QHash<QString,KviRegisteredChannelList *>::Iterator it = m_pChannelDict->begin();it != m_pChannelDict->end();++it)
{
KviRegisteredChannelList * l = it.value();
KVI_ASSERT(l);
for(KviRegisteredChannel * c = l->first();c;c = l->next())
{
QString szGroup = QString::fromUtf8("%[email protected]%2").arg(c->name(),c->netMask());
cfg.setGroup(szGroup);
QHash<QString,QString> * pPropertyDict = c->propertyDict();
KVI_ASSERT(pPropertyDict);
for(QHash<QString,QString>::Iterator it2 = pPropertyDict->begin();it2 != pPropertyDict->end();++it2)
cfg.writeEntry(it2.key(),it2.value());
}
}
}
示例12: kvi_appendWCharToQStringWithLength
void kvi_appendWCharToQStringWithLength(QString * qstrptr, const kvi_wchar_t * ptr, kvi_wslen_t len)
{
KVI_ASSERT(qstrptr);
kvi_wslen_t oldLen = qstrptr->length();
qstrptr->resize(oldLen + len);
#ifdef WSTRINGCONFIG_SAFE_TO_MEMCPY_QCHAR
KviMemory::copy((void *)(qstrptr->unicode() + oldLen), ptr, sizeof(kvi_wchar_t) * len);
#else // !WSTRINGCONFIG_SAFE_TO_MEMCPY_QCHAR
QChar * c = (QChar *)(qstrptr->unicode() + oldLen);
while(*ptr)
{
c->unicode() = *ptr;
ptr++;
c++;
}
#endif // !WSTRINGCONFIG_SAFE_TO_MEMCPY_QCHAR
}
示例13: findExact
void KviRegisteredChannelDataBase::add(KviRegisteredChannel * c)
{
KviRegisteredChannel * old = findExact(c->name(),c->netMask());
if(old)
{
// merge properties
QHash<QString,QString> * pPropertyDict = old->propertyDict();
KVI_ASSERT(pPropertyDict);
for(QHash<QString,QString>::Iterator it = pPropertyDict->begin();it != pPropertyDict->end();++it)
{
if(!c->property(it.key()).isEmpty())
c->setProperty(it.key(),it.value());
}
remove(old);
}
KviRegisteredChannelList * l = m_pChannelDict->value(c->name());
if(!l)
{
l = new KviRegisteredChannelList();
l->setAutoDelete(true);
m_pChannelDict->insert(c->name(),l);
}
// insert where there are less wildcards
int o = c->netMask().count(QChar('*'));
int idx = 0;
for(KviRegisteredChannel * rc = l->first();rc;rc = l->next())
{
if(rc->netMask().count(QChar('*')) > o)
{
// the existing has more wildcards, insert here!
l->insert(idx,c);
return;
}
idx++;
}
l->append(c);
}
示例14: KVI_ASSERT
void EventEditor::itemPressed(QTreeWidgetItem * it, const QPoint & pnt)
{
KVI_ASSERT(m_bOneTimeSetupDone);
if(it)
{
m_pContextPopup->clear();
if(it->parent())
{
QString tmp;
if(!(((EventEditorHandlerTreeWidgetItem *)it)->m_bEnabled))
m_pContextPopup->addAction(
*(g_pIconManager->getSmallIcon(KviIconManager::Handler)),
__tr2qs_ctx("&Enable Handler", "editor"), this, SLOT(toggleCurrentHandlerEnabled()));
else
m_pContextPopup->addAction(
*(g_pIconManager->getSmallIcon(KviIconManager::HandlerDisabled)),
__tr2qs_ctx("&Disable Handler", "editor"), this, SLOT(toggleCurrentHandlerEnabled()));
m_pContextPopup->addAction(
*(g_pIconManager->getSmallIcon(KviIconManager::Discard)),
__tr2qs_ctx("Re&move Handler", "editor"),
this, SLOT(removeCurrentHandler()));
m_pContextPopup->addAction(
*(g_pIconManager->getSmallIcon(KviIconManager::Save)),
__tr2qs_ctx("&Export Handler to...", "editor"),
this, SLOT(exportCurrentHandler()));
}
else
{
m_pContextPopup->addAction(
*(g_pIconManager->getSmallIcon(KviIconManager::Handler)),
__tr2qs_ctx("&New Handler", "editor"),
this, SLOT(addHandlerForCurrentEvent()));
}
m_pContextPopup->popup(pnt);
}
}
示例15: KVI_ASSERT
void KviStupidNotifyListManager::sendIsOn()
{
m_szLastIsOnMsg = "";
QString * nick = m_pNickList->at(m_iNextNickToCheck);
KVI_ASSERT(nick);
int i = 0;
while(nick && ((nick->length() + 5 + m_szLastIsOnMsg.length()) < 510))
{
KviQString::appendFormatted(m_szLastIsOnMsg, " %Q", nick);
nick = m_pNickList->next();
i++;
}
if(_OUTPUT_PARANOIC)
m_pConsole->output(KVI_OUT_SYSTEMMESSAGE, __tr2qs("Notify list: Checking for: %Q"), &m_szLastIsOnMsg);
QByteArray dat = m_pConnection->encodeText(m_szLastIsOnMsg);
m_pConnection->sendFmtData("ISON%s", dat.data());
if(m_pConnection->lagMeter())
m_pConnection->lagMeter()->lagCheckRegister("@notify_naive", 20);
m_iNextNickToCheck += i;
}