本文整理汇总了C++中RK_ASSERT函数的典型用法代码示例。如果您正苦于以下问题:C++ RK_ASSERT函数的具体用法?C++ RK_ASSERT怎么用?C++ RK_ASSERT使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了RK_ASSERT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RK_TRACE
bool RObject::updateStructure (RData *new_data) {
RK_TRACE (OBJECTS);
if (new_data->getDataLength () == 0) { // can happen, if the object no longer exists
return false;
}
RK_ASSERT (new_data->getDataLength () >= 5);
RK_ASSERT (new_data->getDataType () == RData::StructureVector);
if (!canAccommodateStructure (new_data)) return false;
bool properties_change = false;
properties_change = updateName (new_data->getStructureVector ()[0]);
properties_change = updateType (new_data->getStructureVector ()[1]);
properties_change = updateClasses (new_data->getStructureVector ()[2]);
properties_change = updateMeta (new_data->getStructureVector ()[3]);
properties_change = updateDimensions (new_data->getStructureVector ()[4]);
if (properties_change) RKGlobals::tracker ()->objectMetaChanged (this);
if (type & NeedDataUpdate) updateDataFromR (0);
if (isPending ()) type -= Pending;
return true;
}
示例2: RK_TRACE
bool RObject::updateClasses (RData *new_data) {
RK_TRACE (OBJECTS);
RK_ASSERT (new_data->getDataLength () >= 1); // or can there be classless objects in R?
RK_ASSERT (new_data->getDataType () == RData::StringVector);
bool change = false;
unsigned int new_len = new_data->getDataLength ();
QString *new_classes = new_data->getStringVector ();
new_data->detachData ();
if (numClasses () != new_len) {
change = true;
} else {
for (unsigned int cn=0; cn < numClasses (); ++cn) {
if (classnames[cn] != new_classes[cn]) {
change = true;
break;
}
}
}
num_classes = new_len;
delete [] classnames;
classnames = new_classes;
return change;
}
示例3: RK_ASSERT
bool RKObjectListViewSettings::filterAcceptsRow (int source_row, const QModelIndex& source_parent) const {
// RK_TRACE (APP);
// So I tried to use a KRecursiveFilterProxyModel, but
// a) we don't really want recursion to the full depth. Thus limiting it, here.
// b) While we don't handle insertions / removals of source indices in the presence of a filter, correctly, with KRecursiveFilterProxyModel
// I got crashes on this (arguably with the depth-limit in place)
if (acceptRow (source_row, source_parent)) return true;
RObject *parent = static_cast<RObject*> (source_parent.internalPointer ());
if (!parent) {
RK_ASSERT (parent); // should have been accepted, above
return true;
}
RObject *object = parent->findChildByObjectModelIndex (source_row);
if (!object) {
RK_ASSERT (object); // should have been accepted, above
RK_DEBUG (APP, DL_ERROR, "row %d of %d in %s", source_row, sourceModel ()->rowCount (source_parent), qPrintable (parent->getShortName ()));
return false;
}
if (object->isType (RObject::ToplevelEnv | RObject::Workspace) || ((depth_limit > 0) && parent->isType (RObject::ToplevelEnv | RObject::Workspace))) {
QModelIndex source_index = sourceModel ()->index (source_row, 0, source_parent);
for (int row = 0, rows = sourceModel()->rowCount (source_index); row < rows; ++row) {
if (filterAcceptsRow (row, source_index)) return true;
}
}
return false;
}
示例4: RK_ASSERT
void KHelpDlg::rCommandDone (RCommand *command) {
KURL url;
if (command->getFlags () == HELP_SEARCH) {
resultsList->clear ();
RK_ASSERT ((command->getDataLength () % 3) == 0);
int count = (command->getDataLength () / 3);
for (int i=0; i < count; ++i) {
new QListViewItem (resultsList, command->getStringVector ()[i], command->getStringVector ()[count + i], command->getStringVector ()[2*count + i]);
}
setEnabled(true);
} else if (command->getFlags () == GET_HELP_URL) {
RK_ASSERT (command->getDataLength ());
url.setPath(command->getStringVector ()[0]);
if (QFile::exists (url.path ())) {
RKWardMainWindow::getMain ()->openHTML (url);
return;
} else {
KMessageBox::sorry (this, i18n ("No help found on '%1'. Maybe the corresponding package is not installed/loaded, or maybe you mistyped the command. Try using Help->Search R Help for more options.").arg (command->command ().section ("\"", 1, 1)), i18n ("No help found"));
}
} else if (command->getFlags () == GET_INSTALLED_PACKAGES) {
RK_ASSERT (command->getDataType () == RData::StringVector);
unsigned int count = command->getDataLength ();
for (unsigned int i=0; i < count; ++i) {
packagesList->insertItem (command->getStringVector ()[i]);
}
} else {
RK_ASSERT (false);
}
}
示例5: RK_TRACE
QVariant RKObjectListModel::data (const QModelIndex& index, int role) const {
RK_TRACE (OBJECTS);
int col = index.column ();
RObject *object = static_cast<RObject*> (index.internalPointer ());
if ((!object) || (col >= ColumnCount)) {
RK_ASSERT (false);
return QVariant ();
}
if (role == Qt::DisplayRole) {
if (col == NameColumn) return object->getShortName ();
if (col == LabelColumn) return object->getLabel ();
if (col == TypeColumn) {
if (object->isVariable ()) return RObject::typeToText (object->getDataType ());
return QVariant ();
}
if (col == ClassColumn) return object->makeClassString ("; ");
RK_ASSERT (false);
} else if (role == Qt::DecorationRole) {
if (col == NameColumn) return RKStandardIcons::iconForObject (object);
} else if (role == Qt::ToolTipRole) {
return object->getObjectDescription ();
}
return QVariant ();
}
示例6: RK_TRACE
void RObjectList::rCommandDone (RCommand *command) {
RK_TRACE (OBJECTS);
if (command->getFlags () == ROBJECTLIST_UPDATE_ENVIRONMENTS_COMMAND) {
RK_ASSERT (command->getDataType () == RData::StructureVector);
const RData::RDataStorage & data = command->structureVector ();
RK_ASSERT (data.size () == 2);
QStringList new_environments = data[0]->stringVector ();
RK_ASSERT (new_environments.size () >= 2);
updateEnvironments (new_environments, true);
updateNamespaces (data[1]->stringVector ());
RKGlobals::rInterface ()->issueCommand (QString (), RCommand::App | RCommand::Sync | RCommand::EmptyCommand, QString (), this, ROBJECTLIST_UPDATE_COMPLETE_COMMAND, update_chain);
} else if (command->getFlags () == ROBJECTLIST_UPDATE_COMPLETE_COMMAND) {
RK_ASSERT (update_chain);
RKGlobals::rInterface ()->closeChain (update_chain);
update_chain = 0;
RK_DEBUG (OBJECTS, DL_DEBUG, "object list update complete");
emit (updateComplete ());
} else {
RK_ASSERT (false);
}
}
示例7: RK_TRACE
void RKWorkplace::attachWindow (RKMDIWindow *window) {
RK_TRACE (APP);
RK_ASSERT (windows.contains (window)); // This should not happen for now.
if (!window->isAttached ()) {
QWidget *old_parent = window->parentWidget ();
window->prepareToBeAttached ();
if (old_parent && qobject_cast<DetachedWindowContainer*> (old_parent)) {
old_parent->deleteLater ();
}
}
// all the rest is done, even if the window was previously "Attached", as this may also mean it was freshly created
window->state = RKMDIWindow::Attached;
if (window->isToolWindow ()) {
window->tool_window_bar->reclaimDetached (window);
} else {
view ()->addWindow (window);
view ()->topLevelWidget ()->raise ();
view ()->topLevelWidget ()->activateWindow ();
}
RK_ASSERT (window->getPart ());
RKWardMainWindow::getMain ()->partManager ()->addPart (window->getPart ());
}
示例8: RK_TRACE
void RKVariable::setLength (int len) {
RK_TRACE (OBJECTS);
RK_ASSERT (!getLength ()); // should only be called once
RK_ASSERT (dimensions);
dimensions[0] = len;
}
示例9: RK_TRACE
bool RKVarEditModel::setData (const QModelIndex& index, const QVariant& value, int role) {
RK_TRACE (EDITOR);
if (!index.isValid ()) return false;
int row = index.row ();
int col = index.column ();
if (edit_blocks || (role != Qt::EditRole) || (col >= apparentCols ()) || (row >= apparentRows ())) {
RK_ASSERT (false);
return false;
}
if (col >= objects.size ()) { // trailing col
// somebody should add a column for us
doInsertColumns (objects.size (), 1);
if (col >= objects.size ()) {
// apparently, no column has been added in the above signal
return false;
}
}
if (row >= objects[0]->getLength ()) { // trailing row
insertRows (objects[0]->getLength (), 1);
}
// edit of normal cells
RKVariable* var = objects[col];
RK_ASSERT (var);
var->setText (row, value.toString ());
return true;
}
示例10: RK_ASSERT
QModelIndex RCommandStackModel::index (int row, int column, const QModelIndex& parent) const {
RK_ASSERT (listeners > 0);
RK_TRACE (RBACKEND);
RCommandBase* index_data = 0;
if (!parent.isValid ()) {
index_data = RCommandStack::regular_stack;
} else {
RCommandBase* parent_index = static_cast<RCommandBase*> (parent.internalPointer ());
RK_ASSERT (parent_index);
// parent is a command -> this must be a substack
if (parent_index->commandPointer ()) {
RK_ASSERT (parent.row () == 0);
index_data = RCommandStack::stackForCommand (parent_index->commandPointer ())->sub_stack;
RK_ASSERT (index_data);
} else {
// parent is a chain or stack
RCommandChain *chain = parent_index->chainPointer ();
if (chain->commands.size () <= row) {
RK_ASSERT (false);
return QModelIndex ();
}
index_data = chain->commands[row];
}
}
return (createIndex (row, column, index_data));
}
示例11: signal_proxy
void signal_proxy (int signum) {
rk_sighandler_t r_handler = r_sigsegv_handler;
rk_sighandler_t default_handler = default_sigsegv_handler;
#else
void signal_proxy (int signum, siginfo_t *info, void *context) {
struct sigaction r_handler = r_sigsegv_handler;
struct sigaction default_handler = default_sigsegv_handler;
#endif
if (signum == SIGILL) {
r_handler = r_sigill_handler;
default_handler = default_sigill_handler;
} else if (signum == SIGABRT) {
r_handler = r_sigabrt_handler;
default_handler = default_sigabrt_handler;
} else {
RK_ASSERT (signum == SIGSEGV);
}
RKRBackend::tryToDoEmergencySave ();
// if we are not in the R thread, handling the signal in R does more harm than good.
if (RKRBackendProtocolBackend::inRThread ()) {
#ifdef Q_WS_WIN
if (r_handler) {
r_handler (signum);
return;
}
#else
if (r_handler.sa_sigaction) {
r_handler.sa_sigaction (signum, info, context);
return;
} else if (r_handler.sa_handler) {
r_handler.sa_handler (signum);
return;
}
#endif
}
#ifdef Q_WS_WIN
if (default_handler) {
default_handler (signum);
return;
}
#else
// this might be a Qt/KDE override or default handling
if (default_handler.sa_sigaction) {
default_handler.sa_sigaction (signum, info, context);
return;
} else if (default_handler.sa_handler) {
default_handler.sa_handler (signum);
return;
}
#endif
RK_ASSERT (false); // had not handler? Could conceivably happen, but should not.
signal (signum, SIG_DFL);
raise (signum);
}
}
示例12: RK_TRACE
void RKGraphicsDeviceFrontendTransmitter::setupServer () {
RK_TRACE (GRAPHICS_DEVICE);
RK_ASSERT (!local_server);
local_server = new QLocalServer ();
RK_ASSERT (local_server->listen ("rkd" + KRandom::randomString (8)));
connect (local_server, SIGNAL (newConnection ()), this, SLOT (newConnection()));
server_name = local_server->fullServerName ();
}
示例13: QThread
RThread::RThread () : QThread (), REmbedInternal () {
RK_TRACE (RBACKEND);
current_command = 0;
RK_ASSERT (this_pointer == 0);
this_pointer = this;
RK_ASSERT (this_pointer);
current_output = 0;
out_buf_len = 0;
output_paused = false;
}
示例14: RK_TRACE
void RKWorkplace::attachWindow (RKMDIWindow *window) {
RK_TRACE (APP);
RK_ASSERT (windows.find (window) != windows.end ()); // This should not happen for now.
window->prepareToBeAttached ();
window->state = RKMDIWindow::Attached;
view ()->addPage (window);
RK_ASSERT (window->getPart ());
RKWardMainWindow::getMain ()->partManager ()->addPart (window->getPart ());
}
示例15: QThread
RKGraphicsDeviceBackendTransmitter::RKGraphicsDeviceBackendTransmitter (QIODevice* _connection, bool is_q_local_socket) : QThread () {
RK_TRACE (GRAPHICS_DEVICE);
RK_ASSERT (!connection);
RK_ASSERT (_connection);
connection = _connection;
streamer.setIODevice (connection);
alive = true;
is_local_socket = is_q_local_socket;
start ();
}