#1260 Replaced assert() with CAF_ASSERT() in AppFwk

This commit is contained in:
Magne Sjaastad 2017-03-08 08:19:51 +01:00
parent a16a0a3bb5
commit 6791600d03
63 changed files with 198 additions and 220 deletions

View File

@ -38,7 +38,6 @@
#pragma once
#include <QString>
#include <assert.h>
namespace caf
{

View File

@ -39,8 +39,6 @@
#include "cafCmdExecCommandManager.h"
#include "cafCmdFeatureManager.h"
#include <assert.h>
#include <QAction>

View File

@ -46,8 +46,6 @@
#include <QAction>
#include <assert.h>
namespace caf
{
@ -129,7 +127,7 @@ std::pair<CmdFeature*, size_t> CmdFeatureManager::createFeature(const std::strin
}
CmdFeature* feature = CommandFeatureFactory::instance()->create(commandId);
assert(feature); // The command ID is not known in the factory
CAF_ASSERT(feature); // The command ID is not known in the factory
feature->setParent(this);
size_t index = m_commandFeatures.size();

View File

@ -87,7 +87,7 @@ void CmdFieldChangeExec::redo()
PdmFieldHandle* field = PdmReferenceHelper::fieldFromReference(m_commandData->m_rootObject, m_commandData->m_pathToField);
if (!field)
{
assert(false);
CAF_ASSERT(false);
return;
}
@ -140,7 +140,7 @@ void CmdFieldChangeExec::undo()
PdmFieldHandle* field = PdmReferenceHelper::fieldFromReference(m_commandData->m_rootObject, m_commandData->m_pathToField);
if (!field)
{
assert(false);
CAF_ASSERT(false);
return;
}

View File

@ -121,7 +121,7 @@ void CmdUiCommandSystemImpl::fieldChangedCommand(PdmFieldHandle* editorField, co
QString reference = PdmReferenceHelper::referenceFromRootToField(rootObjHandle, field);
if (reference.isEmpty())
{
assert(false);
CAF_ASSERT(false);
return;
}

View File

@ -37,6 +37,7 @@
#include "cafCmdAddItemFeature.h"
#include "cafAssert.h"
#include "cafCmdAddItemExec.h"
#include "cafCmdAddItemExecData.h"
#include "cafCmdFeatureManager.h"
@ -107,7 +108,7 @@ void CmdAddItemFeature::onActionTriggered(bool isChecked)
}
else
{
assert(0);
CAF_ASSERT(0);
}
}
}

View File

@ -89,7 +89,7 @@ CmdExecuteCommand* CmdDeleteItemFeature::createExecuteCommand()
}
// Did not find currently selected pdm object in the current list field
assert(indexAfter != -1);
CAF_ASSERT(indexAfter != -1);
CmdDeleteItemExec* executeCmd = new CmdDeleteItemExec(SelectionManager::instance()->notificationCenter());
@ -129,7 +129,7 @@ void CmdDeleteItemFeature::onActionTriggered(bool isChecked)
}
else
{
assert(0);
CAF_ASSERT(0);
}
}
}

View File

@ -37,7 +37,8 @@
#pragma once
#include <assert.h>
#include "cafAssert.h"
#include <map>
#include <vector>
#include <cstddef>
@ -112,8 +113,8 @@ namespace caf
}
else
{
assert(key != entryIt->first); // classNameKeyword has already been used
assert(false); // To be sure ..
CAF_ASSERT(key != entryIt->first); // classNameKeyword has already been used
CAF_ASSERT(false); // To be sure ..
return false;
}
}

View File

@ -37,7 +37,8 @@
#pragma once
#include "cvfAssert.h"
#include "cafAssert.h"
namespace caf
{
@ -57,8 +58,8 @@ public:
FixedArray<T, size>& operator=(const T* ptr) { for (size_t i = 0; i < size ; ++i) m_array[i] = ptr[i]; return *this;}
template<typename IndexType> T& operator[](const IndexType& index) { CVF_TIGHT_ASSERT(static_cast<size_t>(index) < size); return m_array[index]; }
template<typename IndexType> const T& operator[](const IndexType& index) const { CVF_TIGHT_ASSERT(static_cast<size_t>(index) < size); return m_array[index]; }
template<typename IndexType> T& operator[](const IndexType& index) { CAF_ASSERT(static_cast<size_t>(index) < size); return m_array[index]; }
template<typename IndexType> const T& operator[](const IndexType& index) const { CAF_ASSERT(static_cast<size_t>(index) < size); return m_array[index]; }
};
typedef FixedArray<int, 3> IntArray3;

View File

@ -194,7 +194,7 @@ private:
}
else
{
// assert(m_mapping.size());
// CAF_ASSERT(m_mapping.size());
return m_mapping[0].m_enumVal;
}
}

View File

@ -18,9 +18,10 @@
#include "cafNotificationCenter.h"
#include "cafAssert.h"
#include <QtGlobal>
#include <assert.h>
#include <algorithm>
@ -42,7 +43,7 @@ NotificationCenter::NotificationCenter()
//--------------------------------------------------------------------------------------------------
NotificationCenter::~NotificationCenter()
{
assert(m_observers.size() == 0);
CAF_ASSERT(m_observers.size() == 0);
}
@ -78,7 +79,7 @@ void NotificationCenter::removeObserver(DataModelObserver* observer)
//--------------------------------------------------------------------------------------------------
void NotificationCenter::notifyObserversOfDataChange(caf::PdmObjectHandle* itemThatChanged)
{
assert(itemThatChanged);
CAF_ASSERT(itemThatChanged);
foreach(DataModelObserver* o, m_observers)
{

View File

@ -1,10 +1,11 @@
#pragma once
#include "cafPdmPtrArrayFieldHandle.h"
#include "cafAssert.h"
#include "cafPdmFieldHandle.h"
#include "cafPdmPointer.h"
#include <assert.h>
#include "cafPdmPtrArrayFieldHandle.h"
namespace caf
{
@ -39,7 +40,7 @@ class PdmChildArrayField : public PdmFieldHandle
public:
PdmChildArrayField()
{
bool doNotUsePdmPointersFieldForAnythingButPointersToPdmObject = false; assert(doNotUsePdmPointersFieldForAnythingButPointersToPdmObject);
bool doNotUsePdmPointersFieldForAnythingButPointersToPdmObject = false; CAF_ASSERT(doNotUsePdmPointersFieldForAnythingButPointersToPdmObject);
}
};

View File

@ -33,7 +33,7 @@ DataType* PdmChildArrayField<DataType*>::operator[](size_t index) const
template<typename DataType>
void PdmChildArrayField<DataType*>::push_back(DataType* pointer)
{
assert(isInitializedByInitFieldMacro());
CAF_ASSERT(isInitializedByInitFieldMacro());
m_pointers.push_back(pointer);
if (pointer) pointer->setAsParentField(this);
@ -46,7 +46,7 @@ void PdmChildArrayField<DataType*>::push_back(DataType* pointer)
template<typename DataType>
void PdmChildArrayField<DataType*>::set(size_t index, DataType* pointer)
{
assert(isInitializedByInitFieldMacro());
CAF_ASSERT(isInitializedByInitFieldMacro());
if (m_pointers[index]) m_pointers[index]->removeAsParentField(this);
m_pointers[index] = pointer;
@ -60,7 +60,7 @@ void PdmChildArrayField<DataType*>::set(size_t index, DataType* pointer)
template<typename DataType>
void PdmChildArrayField<DataType*>::insert(size_t index, DataType* pointer)
{
assert(isInitializedByInitFieldMacro());
CAF_ASSERT(isInitializedByInitFieldMacro());
m_pointers.insert(m_pointers.begin()+index, pointer);
@ -75,7 +75,7 @@ void PdmChildArrayField<DataType*>::insert(size_t index, DataType* pointer)
template<typename DataType>
void PdmChildArrayField<DataType*>::insert(size_t index, const std::vector<PdmPointer<DataType> >& objects)
{
assert(isInitializedByInitFieldMacro());
CAF_ASSERT(isInitializedByInitFieldMacro());
m_pointers.insert(m_pointers.begin()+index, objects.begin(), objects.end());
@ -115,7 +115,7 @@ size_t PdmChildArrayField<DataType*>::count(const DataType* pointer) const
template<typename DataType>
void PdmChildArrayField<DataType*>::clear()
{
assert(isInitializedByInitFieldMacro());
CAF_ASSERT(isInitializedByInitFieldMacro());
this->removeThisAsParentField();
m_pointers.clear();
@ -127,7 +127,7 @@ void PdmChildArrayField<DataType*>::clear()
template<typename DataType>
void PdmChildArrayField<DataType*>::deleteAllChildObjects()
{
assert(isInitializedByInitFieldMacro());
CAF_ASSERT(isInitializedByInitFieldMacro());
size_t index;
for (index = 0; index < m_pointers.size(); ++index)
@ -146,7 +146,7 @@ void PdmChildArrayField<DataType*>::deleteAllChildObjects()
template<typename DataType>
void PdmChildArrayField<DataType*>::erase(size_t index)
{
assert(isInitializedByInitFieldMacro());
CAF_ASSERT(isInitializedByInitFieldMacro());
if (m_pointers[index].rawPtr())
{
@ -181,7 +181,7 @@ size_t PdmChildArrayField<DataType*>::index(DataType* pointer)
template<typename DataType>
void PdmChildArrayField<DataType*>::removeChildObject(PdmObjectHandle* object)
{
assert(isInitializedByInitFieldMacro());
CAF_ASSERT(isInitializedByInitFieldMacro());
std::vector< PdmPointer<DataType> > tempPointers;
@ -224,7 +224,7 @@ void PdmChildArrayField<DataType*>::childObjects(std::vector<PdmObjectHandle*>*
template<typename DataType>
void PdmChildArrayField<DataType*>::insertAt(int indexAfter, PdmObjectHandle* obj)
{
assert(isInitializedByInitFieldMacro());
CAF_ASSERT(isInitializedByInitFieldMacro());
// This method should assert if obj to insert is not castable to the container type, but since this
// is a virtual method, its implementation is always created and that makes a dyn_cast add the need for

View File

@ -1,9 +1,9 @@
#pragma once
#include "cafPdmPointer.h"
#include "cafPdmFieldHandle.h"
#include <assert.h>
#include "cafAssert.h"
#include "cafPdmPointer.h"
namespace caf
{
@ -22,7 +22,7 @@ class PdmChildField : public PdmFieldHandle
public:
PdmChildField()
{
bool doNotUsePdmPtrFieldForAnythingButPointersToPdmObject = false; assert(doNotUsePdmPtrFieldForAnythingButPointersToPdmObject);
bool doNotUsePdmPtrFieldForAnythingButPointersToPdmObject = false; CAF_ASSERT(doNotUsePdmPtrFieldForAnythingButPointersToPdmObject);
}
};

View File

@ -1,7 +1,7 @@
#include <vector>
#include <iostream>
#include <assert.h>
namespace caf
{
@ -11,7 +11,7 @@ namespace caf
template<typename DataType >
void caf::PdmChildField<DataType*>::childObjects(std::vector<PdmObjectHandle*>* objects)
{
assert(objects);
CAF_ASSERT(objects);
PdmObjectHandle* obj = m_fieldValue.rawPtr();
if (obj)
{
@ -62,7 +62,7 @@ caf::PdmChildField<DataType*>::~PdmChildField()
template<typename DataType >
caf::PdmChildField<DataType*>& PdmChildField<DataType*>::operator=(const DataTypePtr & fieldValue)
{
assert(isInitializedByInitFieldMacro());
CAF_ASSERT(isInitializedByInitFieldMacro());
if (m_fieldValue) m_fieldValue->removeAsParentField(this);
m_fieldValue = fieldValue;

View File

@ -39,13 +39,13 @@
#include "cafPdmValueField.h"
#include "cafAssert.h"
#include "cafInternalPdmValueFieldSpecializations.h"
#include "cafPdmUiFieldHandleInterface.h"
#include <QVariant>
#include <vector>
#include <assert.h>
namespace caf
@ -70,19 +70,19 @@ public:
// Assignment
PdmDataValueField& operator= (const PdmDataValueField& other) { assert(isInitializedByInitFieldMacro()); m_fieldValue = other.m_fieldValue; return *this; }
PdmDataValueField& operator= (const DataType& fieldValue) { assert(isInitializedByInitFieldMacro()); m_fieldValue = fieldValue; return *this; }
PdmDataValueField& operator= (const PdmDataValueField& other) { CAF_ASSERT(isInitializedByInitFieldMacro()); m_fieldValue = other.m_fieldValue; return *this; }
PdmDataValueField& operator= (const DataType& fieldValue) { CAF_ASSERT(isInitializedByInitFieldMacro()); m_fieldValue = fieldValue; return *this; }
// Basic access
DataType value() const { return m_fieldValue; }
void setValue(const DataType& fieldValue) { assert(isInitializedByInitFieldMacro()); m_fieldValue = fieldValue; }
void setValue(const DataType& fieldValue) { CAF_ASSERT(isInitializedByInitFieldMacro()); m_fieldValue = fieldValue; }
void setValueWithFieldChanged(const DataType& fieldValue);
// Implementation of PdmValueField interface
virtual QVariant toQVariant() const { assert(isInitializedByInitFieldMacro()); return PdmValueFieldSpecialization<DataType>::convert(m_fieldValue); }
virtual void setFromQVariant(const QVariant& variant) { assert(isInitializedByInitFieldMacro()); PdmValueFieldSpecialization<DataType>::setFromVariant(variant, m_fieldValue); }
virtual QVariant toQVariant() const { CAF_ASSERT(isInitializedByInitFieldMacro()); return PdmValueFieldSpecialization<DataType>::convert(m_fieldValue); }
virtual void setFromQVariant(const QVariant& variant) { CAF_ASSERT(isInitializedByInitFieldMacro()); PdmValueFieldSpecialization<DataType>::setFromVariant(variant, m_fieldValue); }
virtual bool isReadOnly() const { return false; }
// Access operators
@ -117,7 +117,7 @@ protected:
template<typename DataType >
void caf::PdmDataValueField<DataType>::setValueWithFieldChanged(const DataType& fieldValue)
{
assert(isInitializedByInitFieldMacro());
CAF_ASSERT(isInitializedByInitFieldMacro());
PdmUiFieldHandleInterface* uiFieldHandleInterface = capability<PdmUiFieldHandleInterface>();
if (uiFieldHandleInterface)

View File

@ -2,7 +2,6 @@
#include "cafPdmFieldCapability.h"
#include <assert.h>
namespace caf
{

View File

@ -1,11 +1,10 @@
#include "cafPdmObjectHandle.h"
#include "cafAssert.h"
#include "cafPdmFieldHandle.h"
#include "cafPdmObjectCapability.h"
#include <assert.h>
namespace caf
{
@ -42,7 +41,7 @@ void PdmObjectHandle::fields(std::vector<PdmFieldHandle*>& fields) const
//--------------------------------------------------------------------------------------------------
void PdmObjectHandle::setAsParentField(PdmFieldHandle* parentField)
{
assert(m_parentField == NULL);
CAF_ASSERT(m_parentField == NULL);
m_parentField = parentField;
}
@ -52,7 +51,7 @@ void PdmObjectHandle::setAsParentField(PdmFieldHandle* parentField)
//--------------------------------------------------------------------------------------------------
void PdmObjectHandle::removeAsParentField(PdmFieldHandle* parentField)
{
assert(m_parentField == parentField);
CAF_ASSERT(m_parentField == parentField);
m_parentField = NULL;
}
@ -110,8 +109,8 @@ void PdmObjectHandle::addField(PdmFieldHandle* field, const QString& keyword)
{
field->m_ownerObject = this;
assert(!keyword.isEmpty());
assert(this->findField(keyword) == NULL);
CAF_ASSERT(!keyword.isEmpty());
CAF_ASSERT(this->findField(keyword) == NULL);
field->setKeyword(keyword);
m_fields.push_back(field);

View File

@ -1,10 +1,10 @@
#pragma once
#include "cafAssert.h"
#include "cafPdmBase.h"
class QString;
#include <assert.h>
#include <set>
#include <vector>
@ -169,7 +169,7 @@ void PdmObjectHandle::firstAncestorOrThisOfTypeAsserted(T*& ancestor) const
{
firstAncestorOrThisOfType(ancestor);
assert(ancestor);
CAF_ASSERT(ancestor);
}
//--------------------------------------------------------------------------------------------------

View File

@ -1,14 +1,13 @@
#pragma once
#include "cafAssert.h"
#include "cafInternalPdmValueFieldSpecializations.h"
#include "cafPdmFieldHandle.h"
#include "cafPdmPointer.h"
#include "cafPdmValueField.h"
#include "cafInternalPdmValueFieldSpecializations.h"
#include <QVariant>
#include <assert.h>
namespace caf
{
@ -32,8 +31,8 @@ public:
// Basic access
void setValue(const DataType& fieldValue) { assert(isInitializedByInitFieldMacro()); if (m_valueSetter) m_valueSetter->setValue(fieldValue); }
DataType value() const { assert(m_valueGetter); return m_valueGetter->getValue(); }
void setValue(const DataType& fieldValue) { CAF_ASSERT(isInitializedByInitFieldMacro()); if (m_valueSetter) m_valueSetter->setValue(fieldValue); }
DataType value() const { CAF_ASSERT(m_valueGetter); return m_valueGetter->getValue(); }
// Implementation of PdmValueField interface

View File

@ -2,7 +2,6 @@
#include "cafPdmFieldHandle.h"
#include "cafPdmPointer.h"
#include <assert.h>
#include "cafPdmPtrArrayFieldHandle.h"
namespace caf
@ -23,7 +22,7 @@ class PdmPtrArrayField : public PdmFieldHandle
public:
PdmPtrArrayField()
{
bool doNotUsePdmPtrArrayFieldForAnythingButPointersToPdmObject = false; assert(doNotUsePdmPtrArrayFieldForAnythingButPointersToPdmObject);
bool doNotUsePdmPtrArrayFieldForAnythingButPointersToPdmObject = false; CAF_ASSERT(doNotUsePdmPtrArrayFieldForAnythingButPointersToPdmObject);
}
};

View File

@ -54,7 +54,7 @@ DataType* PdmPtrArrayField<DataType*>::operator[](size_t index) const
template<typename DataType>
void PdmPtrArrayField<DataType*>::push_back(DataType* pointer)
{
assert(isInitializedByInitFieldMacro());
CAF_ASSERT(isInitializedByInitFieldMacro());
m_pointers.push_back(pointer);
if(pointer) pointer->addReferencingPtrField(this);
@ -67,7 +67,7 @@ void PdmPtrArrayField<DataType*>::push_back(DataType* pointer)
template<typename DataType>
void PdmPtrArrayField<DataType*>::set(size_t index, DataType* pointer)
{
assert(isInitializedByInitFieldMacro());
CAF_ASSERT(isInitializedByInitFieldMacro());
if(m_pointers[index]) m_pointers[index]->removeReferencingPtrField(this);
m_pointers[index] = pointer;
@ -81,7 +81,7 @@ void PdmPtrArrayField<DataType*>::set(size_t index, DataType* pointer)
template<typename DataType>
void PdmPtrArrayField<DataType*>::insert(size_t index, DataType* pointer)
{
assert(isInitializedByInitFieldMacro());
CAF_ASSERT(isInitializedByInitFieldMacro());
m_pointers.insert(m_pointers.begin()+index, pointer);
@ -96,7 +96,7 @@ void PdmPtrArrayField<DataType*>::insert(size_t index, DataType* pointer)
template<typename DataType>
void PdmPtrArrayField<DataType*>::insert(size_t index, const std::vector<PdmPointer<DataType> >& objects)
{
assert(isInitializedByInitFieldMacro());
CAF_ASSERT(isInitializedByInitFieldMacro());
m_pointers.insert(m_pointers.begin()+index, objects.begin(), objects.end());
@ -136,7 +136,7 @@ size_t PdmPtrArrayField<DataType*>::count(const DataType* pointer) const
template<typename DataType>
void PdmPtrArrayField<DataType*>::clear()
{
assert(isInitializedByInitFieldMacro());
CAF_ASSERT(isInitializedByInitFieldMacro());
this->removeThisAsReferencingPtrField();
m_pointers.clear();
@ -151,7 +151,7 @@ void PdmPtrArrayField<DataType*>::clear()
template<typename DataType>
void PdmPtrArrayField<DataType*>::erase(size_t index)
{
assert(isInitializedByInitFieldMacro());
CAF_ASSERT(isInitializedByInitFieldMacro());
if(m_pointers[index].rawPtr())
{
@ -186,7 +186,7 @@ size_t PdmPtrArrayField<DataType*>::index(DataType* pointer)
template<typename DataType>
void PdmPtrArrayField<DataType*>::removePtr(PdmObjectHandle* object)
{
assert(isInitializedByInitFieldMacro());
CAF_ASSERT(isInitializedByInitFieldMacro());
std::vector< PdmPointer<DataType> > tempPointers;
@ -229,9 +229,9 @@ void PdmPtrArrayField<DataType*>::ptrReferencedObjects(std::vector<PdmObjectHand
template<typename DataType>
void PdmPtrArrayField<DataType*>::insertAt(int indexAfter, PdmObjectHandle* obj)
{
assert(isInitializedByInitFieldMacro());
CAF_ASSERT(isInitializedByInitFieldMacro());
// This method should assert if obj to insert is not castable to the container type, but since this
// This method should CAF_ASSERT( if obj to insert is not castable to the container type, but since this
// is a virtual method, its implementation is always created and that makes a dyn_cast add the need for
// #include of the header file "everywhere"
typename std::vector< PdmPointer<DataType> >::iterator it;

View File

@ -1,9 +1,9 @@
#pragma once
#include "cafAssert.h"
#include "cafPdmPointer.h"
#include "cafPdmFieldHandle.h"
#include <assert.h>
namespace caf
{
@ -26,7 +26,7 @@ class PdmPtrField : public PdmFieldHandle
public:
PdmPtrField()
{
bool doNotUsePdmPtrFieldForAnythingButPointersToPdmObject = false; assert(doNotUsePdmPtrFieldForAnythingButPointersToPdmObject);
bool doNotUsePdmPtrFieldForAnythingButPointersToPdmObject = false; CAF_ASSERT(doNotUsePdmPtrFieldForAnythingButPointersToPdmObject);
}
};

View File

@ -29,7 +29,7 @@ caf::PdmPtrField<DataType*>::~PdmPtrField()
template<typename DataType >
void PdmPtrField<DataType*>::setValue(const DataTypePtr& fieldValue)
{
assert(isInitializedByInitFieldMacro());
CAF_ASSERT(isInitializedByInitFieldMacro());
if (m_fieldValue) m_fieldValue->removeReferencingPtrField(this);
m_fieldValue = fieldValue;
@ -42,7 +42,7 @@ void PdmPtrField<DataType*>::setValue(const DataTypePtr& fieldValue)
template<typename DataType >
void PdmPtrField<DataType*>::setRawPtr(PdmObjectHandle* obj)
{
assert(isInitializedByInitFieldMacro());
CAF_ASSERT(isInitializedByInitFieldMacro());
if (m_fieldValue.notNull()) m_fieldValue.rawPtr()->removeReferencingPtrField(this);
m_fieldValue.setRawPtr(obj);
@ -56,7 +56,7 @@ void PdmPtrField<DataType*>::setRawPtr(PdmObjectHandle* obj)
template<typename DataType >
caf::PdmPtrField<DataType*>& PdmPtrField<DataType*>::operator=(const DataTypePtr & fieldValue)
{
assert(isInitializedByInitFieldMacro());
CAF_ASSERT(isInitializedByInitFieldMacro());
if (m_fieldValue) m_fieldValue->removeReferencingPtrField(this);
m_fieldValue = fieldValue;
@ -72,7 +72,7 @@ caf::PdmPtrField<DataType*>& PdmPtrField<DataType*>::operator=(const DataTypePtr
template<typename DataType >
caf::PdmPtrField<DataType*>& PdmPtrField<DataType*>::operator=(const FieldDataType & fieldValue)
{
assert(isInitializedByInitFieldMacro());
CAF_ASSERT(isInitializedByInitFieldMacro());
if (m_fieldValue) m_fieldValue->removeReferencingPtrField(this);
m_fieldValue = fieldValue;

View File

@ -37,11 +37,11 @@
#include "cafPdmReferenceHelper.h"
#include "cafAssert.h"
#include "cafPdmFieldHandle.h"
#include <QStringList>
#include <assert.h>
#include <algorithm>
@ -323,8 +323,8 @@ PdmObjectHandle* PdmReferenceHelper::objectFromFieldReference(PdmFieldHandle* fr
QStringList decodedReference = reference.split(QRegExp("\\s+"), QString::SkipEmptyParts);
PdmObjectHandle* lastCommonAnchestor = fromField->ownerObject();
assert(lastCommonAnchestor);
assert(decodedReference.size());
CAF_ASSERT(lastCommonAnchestor);
CAF_ASSERT(decodedReference.size());
while (decodedReference.front() == "..")
{
@ -336,7 +336,7 @@ PdmObjectHandle* PdmReferenceHelper::objectFromFieldReference(PdmFieldHandle* fr
}
lastCommonAnchestor = parentField->ownerObject();
assert(lastCommonAnchestor);
CAF_ASSERT(lastCommonAnchestor);
decodedReference.pop_front();
}

View File

@ -57,7 +57,7 @@ public:
// class PdmProxyValueField : public PdmValueField
// {
// DataType value() const { assert(m_valueGetter); return m_valueGetter->getValue(); }
// DataType value() const { CAF_ASSERT(m_valueGetter); return m_valueGetter->getValue(); }
// void setValue(const DataType& fieldValue) { if (m_valueSetter) m_valueSetter->setValue(fieldValue); }
// }

View File

@ -44,7 +44,6 @@
#include "cafPdmPointer.h"
#include <set>
#include <assert.h>
class QXmlStreamReader;
class QXmlStreamWriter;

View File

@ -58,7 +58,7 @@ void PdmObjectGroup::createCopyByType(std::vector<PdmPointer<T> >* copyOfTypedOb
PdmObjectHandle* objectCopy = PdmXmlObjectHandle::readUnknownObjectFromXmlString(xml, PdmDefaultObjectFactory::instance());
T* typedObject = dynamic_cast<T*>(objectCopy);
assert(typedObject);
CAF_ASSERT(typedObject);
copyOfTypedObjects->push_back(typedObject);
}

View File

@ -27,7 +27,7 @@ void caf::PdmFieldUiCap<FieldType>::setValueFromUiEditor(const QVariant& uiValue
if (uiValue.type() == QVariant::UInt)
{
uint optionIndex = uiValue.toUInt();
assert(optionIndex < static_cast<unsigned int>(m_optionEntryCache.size()));
CAF_ASSERT(optionIndex < static_cast<unsigned int>(m_optionEntryCache.size()));
QVariant optionVariantValue = m_optionEntryCache[optionIndex].value;
@ -66,7 +66,7 @@ void caf::PdmFieldUiCap<FieldType>::setValueFromUiEditor(const QVariant& uiValue
{
// We are not getting indexes as expected from the UI. For now assert, to catch this condition
// but it should possibly be handled as setting the values explicitly. The code for that is below the assert
assert(false);
CAF_ASSERT(false);
typename FieldType::FieldDataType value;
PdmUiFieldSpecialization<typename FieldType::FieldDataType>::setFromVariant(uiValue, value);
m_field->setValue(value);
@ -79,7 +79,7 @@ void caf::PdmFieldUiCap<FieldType>::setValueFromUiEditor(const QVariant& uiValue
{
// We are not getting indexes as expected from the UI. For now assert, to catch this condition
// but it should possibly be handled as setting the values explicitly. The code for that is below the assert
assert(false);
CAF_ASSERT(false);
typename FieldType::FieldDataType value;
PdmUiFieldSpecialization<typename FieldType::FieldDataType>::setFromVariant(uiValue, value);
m_field->setValue(value);
@ -128,7 +128,7 @@ QVariant caf::PdmFieldUiCap<FieldType>::uiValue() const
{
if (isAutoAddingOptionFromValue() && indexesToFoundOptions.size() != static_cast<size_t>(uiBasedQVariant.toList().size()))
{
assert(false); // Did not find all the field values among the options available, even though we should.
CAF_ASSERT(false); // Did not find all the field values among the options available, even though we should.
// Reasons might be:
// The "core" data type in the field is probably not supported by QVariant::toString()
// You forgot to call valueOptions() before the call to uiValue().
@ -149,7 +149,7 @@ QVariant caf::PdmFieldUiCap<FieldType>::uiValue() const
else return QVariant(-1); // Return -1 if not found instead of assert. Should result in clearing the selection
}
assert(false);
CAF_ASSERT(false);
return uiBasedQVariant;
}
else

View File

@ -1,10 +1,10 @@
#include "cafPdmUiFieldHandle.h"
#include "cafAssert.h"
#include "cafPdmFieldHandle.h"
#include "cafPdmUiObjectHandle.h"
#include <assert.h>
namespace caf
{
@ -27,7 +27,7 @@ void PdmUiFieldHandle::notifyFieldChanged(const QVariant& oldFieldValue, const Q
if (oldFieldValue != newFieldValue)
{
PdmFieldHandle* fieldHandle = this->fieldHandle();
assert(fieldHandle && fieldHandle->ownerObject());
CAF_ASSERT(fieldHandle && fieldHandle->ownerObject());
PdmUiObjectHandle* uiObjHandle = uiObj(fieldHandle->ownerObject());
if (uiObjHandle)
@ -47,7 +47,7 @@ void PdmUiFieldHandle::notifyFieldChanged(const QVariant& oldFieldValue, const Q
PdmUiFieldHandle* PdmFieldHandle::uiCapability()
{
PdmUiFieldHandle* uiField = capability<PdmUiFieldHandle>();
assert(uiField);
CAF_ASSERT(uiField);
return uiField;
}

View File

@ -1,13 +1,12 @@
#include "cafPdmUiObjectHandle.h"
#include "cafAssert.h"
#include "cafPdmFieldHandle.h"
#include "cafPdmObjectHandle.h"
#include "cafPdmUiFieldHandle.h"
#include "cafPdmUiOrdering.h"
#include "cafPdmUiTreeOrdering.h"
#include <assert.h>
namespace caf
{
@ -28,7 +27,7 @@ PdmUiObjectHandle* uiObj(PdmObjectHandle* obj)
{
if (!obj) return NULL;
PdmUiObjectHandle* uiObject = obj->capability<PdmUiObjectHandle>();
assert(uiObject);
CAF_ASSERT(uiObject);
return uiObject;
}
@ -84,7 +83,7 @@ void PdmUiObjectHandle::objectEditorAttribute(QString uiConfigName, PdmUiEditorA
//--------------------------------------------------------------------------------------------------
PdmUiTreeOrdering* PdmUiObjectHandle::uiTreeOrdering(QString uiConfigName /*= ""*/)
{
assert(this); // This method actually is possible to call on a NULL ptr without getting a crash, so we assert instead.
CAF_ASSERT(this); // This method actually is possible to call on a NULL ptr without getting a crash, so we assert instead.
PdmUiTreeOrdering* uiTreeOrdering = new PdmUiTreeOrdering(NULL, m_owner);
@ -231,7 +230,7 @@ void PdmUiObjectHandle::updateUiIconFromToggleField()
PdmUiObjectHandle* PdmObjectHandle::uiCapability() const
{
PdmUiObjectHandle* uiField = capability<PdmUiObjectHandle>();
assert(uiField);
CAF_ASSERT(uiField);
return uiField;
}

View File

@ -41,7 +41,6 @@
#include "cafPdmUiFieldHandle.h"
#include "cafPdmUiObjectHandle.h"
#include <assert.h>
namespace caf
{
@ -94,8 +93,8 @@ bool PdmUiOrdering::contains(const PdmUiItem* item) const
void PdmUiOrdering::add(const PdmFieldHandle* field)
{
PdmUiFieldHandle* uiItem = const_cast<PdmFieldHandle*>(field)->uiCapability();
assert(uiItem);
assert(!this->contains(uiItem));
CAF_ASSERT(uiItem);
CAF_ASSERT(!this->contains(uiItem));
m_ordering.push_back(uiItem);
}
@ -106,8 +105,8 @@ void PdmUiOrdering::add(const PdmFieldHandle* field)
void PdmUiOrdering::add(const PdmObjectHandle* obj)
{
PdmUiObjectHandle* uiItem = uiObj(const_cast<PdmObjectHandle*>(obj));
assert(uiItem);
assert(!this->contains(uiItem));
CAF_ASSERT(uiItem);
CAF_ASSERT(!this->contains(uiItem));
m_ordering.push_back(uiItem);
}

View File

@ -37,13 +37,13 @@
#include "cafPdmUiTreeOrdering.h"
#include "cafAssert.h"
#include "cafPdmDataValueField.h"
#include "cafPdmObjectHandle.h"
#include "cafPdmUiEditorHandle.h"
#include "cafPdmUiFieldHandle.h"
#include "cafPdmUiObjectHandle.h"
#include <assert.h>
#include <iostream>
namespace caf
@ -54,7 +54,7 @@ namespace caf
//--------------------------------------------------------------------------------------------------
void PdmUiTreeOrdering::add(PdmFieldHandle* field, QString uiConfigName)
{
assert(field);
CAF_ASSERT(field);
if (field->uiCapability()->isUiTreeHidden(uiConfigName))
{
@ -80,7 +80,7 @@ void PdmUiTreeOrdering::add(PdmFieldHandle* field, QString uiConfigName)
//--------------------------------------------------------------------------------------------------
void PdmUiTreeOrdering::add(PdmObjectHandle* object)
{
assert(object);
CAF_ASSERT(object);
new PdmUiTreeOrdering(this, object);
}
@ -91,7 +91,7 @@ void PdmUiTreeOrdering::add(PdmObjectHandle* object)
PdmUiTreeOrdering* PdmUiTreeOrdering::add(const QString & title, const QString& iconResourceName)
{
PdmUiTreeOrdering* child = new PdmUiTreeOrdering(title, iconResourceName);
assert(child->isValid());
CAF_ASSERT(child->isValid());
this->appendChild(child);
return child;
@ -102,7 +102,7 @@ PdmUiTreeOrdering* PdmUiTreeOrdering::add(const QString & title, const QString&
//--------------------------------------------------------------------------------------------------
bool PdmUiTreeOrdering::containsField(const PdmFieldHandle* field)
{
assert (field);
CAF_ASSERT(field);
for (int cIdx = 0; cIdx < this->childCount(); ++cIdx)
{
PdmUiTreeOrdering* child = dynamic_cast<PdmUiTreeOrdering*>(this->child(cIdx)); // What ???
@ -121,7 +121,7 @@ bool PdmUiTreeOrdering::containsField(const PdmFieldHandle* field)
//--------------------------------------------------------------------------------------------------
bool PdmUiTreeOrdering::containsObject(const PdmObjectHandle* object)
{
assert (object);
CAF_ASSERT(object);
for (int cIdx = 0; cIdx < this->childCount(); ++cIdx)
{
PdmUiTreeOrdering* child = this->child(cIdx);
@ -247,7 +247,7 @@ PdmUiTreeOrdering::~PdmUiTreeOrdering()
//--------------------------------------------------------------------------------------------------
PdmObjectHandle* PdmUiTreeOrdering::object() const
{
assert(isRepresentingObject()); return m_object;
CAF_ASSERT(isRepresentingObject()); return m_object;
}
//--------------------------------------------------------------------------------------------------
@ -255,7 +255,7 @@ PdmObjectHandle* PdmUiTreeOrdering::object() const
//--------------------------------------------------------------------------------------------------
PdmFieldHandle* PdmUiTreeOrdering::field() const
{
assert(isRepresentingField()); return m_field;
CAF_ASSERT(isRepresentingField()); return m_field;
}
//--------------------------------------------------------------------------------------------------
@ -263,7 +263,7 @@ PdmFieldHandle* PdmUiTreeOrdering::field() const
//--------------------------------------------------------------------------------------------------
PdmUiItem* PdmUiTreeOrdering::uiItem() const
{
assert(isDisplayItemOnly()); return m_uiItem;
CAF_ASSERT(isDisplayItemOnly()); return m_uiItem;
}
//--------------------------------------------------------------------------------------------------
@ -328,7 +328,7 @@ void PdmUiTreeOrdering::debugDump(int level) const
//--------------------------------------------------------------------------------------------------
PdmUiTreeOrdering* PdmUiTreeOrdering::child(int index) const
{
assert(index < m_childItems.size());
CAF_ASSERT(index < m_childItems.size());
return m_childItems.value(index);
}

View File

@ -39,7 +39,6 @@
//#include <QAbstractItemModel>
#include <QList>
#include <assert.h>
#include <iostream>
namespace caf
@ -73,7 +72,7 @@ public:
UiTreeItem* child(int row) const
{
assert(row < m_childItems.size());
CAF_ASSERT(row < m_childItems.size());
return m_childItems.value(row);
}

View File

@ -1,3 +1,5 @@
#include "cafAssert.h"
#include "cafInternalPdmFieldIoHelper.h"
#include "cafPdmObjectFactory.h"
#include "cafPdmXmlObjectHandle.h"
@ -201,7 +203,7 @@ void caf::PdmFieldXmlCap< caf::PdmChildField<DataType*> >::readFieldData(QXmlStr
// Create an object if needed
if (m_field->value() == NULL)
{
assert(objectFactory);
CAF_ASSERT(objectFactory);
obj = objectFactory->create(className);
if (obj == NULL)
@ -217,7 +219,7 @@ void caf::PdmFieldXmlCap< caf::PdmChildField<DataType*> >::readFieldData(QXmlStr
PdmXmlObjectHandle* xmlObject = xmlObj(obj);
if (!xmlObject || xmlObject->classKeyword() != className)
{
assert(false); // Inconsistency in the factory. It creates objects of wrong type from the ClassKeyword
CAF_ASSERT(false); // Inconsistency in the factory. It creates objects of wrong type from the ClassKeyword
xmlStream.skipCurrentElement(); // Skip to the endelement of the object we was supposed to read
xmlStream.skipCurrentElement(); // Skip to the endelement of this field
@ -319,7 +321,7 @@ void caf::PdmFieldXmlCap< caf::PdmChildArrayField<DataType*> >::readFieldData(QX
{
QString className = xmlStream.name().toString();
assert(objectFactory);
CAF_ASSERT(objectFactory);
PdmObjectHandle * obj = objectFactory->create(className);
if (obj == NULL)
@ -343,7 +345,7 @@ void caf::PdmFieldXmlCap< caf::PdmChildArrayField<DataType*> >::readFieldData(QX
PdmXmlObjectHandle* xmlObject = xmlObj(obj);
if (!xmlObject || xmlObject->classKeyword() != className)
{
assert(false); // There is an inconsistency in the factory. It creates objects of type not matching the ClassKeyword
CAF_ASSERT(false); // There is an inconsistency in the factory. It creates objects of type not matching the ClassKeyword
// Skip to EndElement of the object
xmlStream.skipCurrentElement();

View File

@ -8,7 +8,6 @@
#include "cafPdmReferenceHelper.h"
#include "cafInternalPdmFieldIoHelper.h"
#include <assert.h>
namespace caf
@ -79,7 +78,7 @@ struct PdmFieldWriter< PdmPointer<DataType> >
{
QString dataString;
assert(referenceHelper);
CAF_ASSERT(referenceHelper);
if (fieldValue.isNull())
{
@ -111,7 +110,7 @@ struct PdmFieldReader< PdmPointer<DataType> >
if (dataString != "NULL")
{
assert(referenceHelper);
CAF_ASSERT(referenceHelper);
PdmObjectHandle* objHandle = referenceHelper->objectFromReference(dataString);
fieldValue.setRawPtr(objHandle);

View File

@ -39,9 +39,10 @@
#include "cafPdmObjectFactory.h"
#include "cafAssert.h"
#include <QString>
#include <assert.h>
#include <map>
namespace caf
@ -77,8 +78,8 @@ public:
}
else
{
assert(classNameKeyword != entryIt->first); // classNameKeyword has already been used
assert(false); // To be sure ..
CAF_ASSERT(classNameKeyword != entryIt->first); // classNameKeyword has already been used
CAF_ASSERT(false); // To be sure ..
return false; // never hit;
}
}

View File

@ -40,7 +40,6 @@
#include "cafPdmField.h"
#include "cafPdmXmlObjectHandle.h"
#include <assert.h>
namespace caf
@ -85,7 +84,7 @@ void PdmSettings::readFieldsFromApplicationStore(caf::PdmObjectHandle* object, c
QVariant val = settings.value(key);
caf::PdmValueField* valueField = dynamic_cast<caf::PdmValueField*>(fieldHandle);
assert(valueField);
CAF_ASSERT(valueField);
valueField->setFromQVariant(val);
}
}
@ -97,7 +96,7 @@ void PdmSettings::readFieldsFromApplicationStore(caf::PdmObjectHandle* object, c
//--------------------------------------------------------------------------------------------------
void PdmSettings::writeFieldsToApplicationStore(caf::PdmObjectHandle* object, const QString context)
{
assert(object);
CAF_ASSERT(object);
// Qt doc :
//
@ -133,7 +132,7 @@ void PdmSettings::writeFieldsToApplicationStore(caf::PdmObjectHandle* object, co
if (children.size() == 0)
{
caf::PdmValueField* valueField = dynamic_cast<caf::PdmValueField*>(fieldHandle);
assert(valueField);
CAF_ASSERT(valueField);
settings.setValue(context + fieldHandle->keyword(), valueField->toQVariant());
}
}

View File

@ -1,5 +1,6 @@
#include "cafPdmXmlFieldHandle.h"
#include "cafAssert.h"
#include "cafPdmFieldHandle.h"
#include "cafPdmXmlObjectHandle.h"
@ -55,7 +56,7 @@ QString PdmXmlFieldHandle::childClassKeyword()
PdmXmlFieldHandle* PdmFieldHandle::xmlCapability()
{
PdmXmlFieldHandle* xmlField = capability<PdmXmlFieldHandle>();
assert(xmlField);
CAF_ASSERT(xmlField);
return xmlField;
}

View File

@ -1,5 +1,6 @@
#include "cafPdmXmlObjectHandle.h"
#include "cafAssert.h"
#include "cafPdmObjectHandle.h"
#include "cafPdmXmlFieldHandle.h"
@ -9,7 +10,6 @@
#include <QXmlStreamWriter>
#include <iostream>
#include <assert.h>
namespace caf
{
@ -30,7 +30,7 @@ PdmXmlObjectHandle* xmlObj(PdmObjectHandle* obj)
{
if (!obj) return NULL;
PdmXmlObjectHandle* xmlObject = obj->capability<PdmXmlObjectHandle>();
assert(xmlObject);
CAF_ASSERT(xmlObject);
return xmlObject;
}
@ -118,7 +118,7 @@ void PdmXmlObjectHandle::writeFields(QXmlStreamWriter& xmlStream) const
if (field && field->isIOWritable())
{
QString keyword = field->fieldHandle()->keyword();
assert(PdmXmlObjectHandle::isValidXmlElementName(keyword));
CAF_ASSERT(PdmXmlObjectHandle::isValidXmlElementName(keyword));
xmlStream.writeStartElement("", keyword);
field->writeFieldData(xmlStream);
@ -147,7 +147,7 @@ void PdmXmlObjectHandle::readObjectFromXmlString(const QString& xmlString, PdmO
tt = inputStream.readNext(); // Start of document
tt = inputStream.readNext();
QString classKeyword = inputStream.name().toString();
assert(classKeyword == this->classKeyword());
CAF_ASSERT(classKeyword == this->classKeyword());
this->readFields(inputStream, objectFactory);
}
@ -340,7 +340,7 @@ void PdmXmlObjectHandle::setupBeforeSaveRecursively(PdmObjectHandle* object)
PdmXmlObjectHandle* PdmObjectHandle::xmlCapability() const
{
PdmXmlObjectHandle* xmlField = capability<PdmXmlObjectHandle>();
assert(xmlField);
CAF_ASSERT(xmlField);
return xmlField;
}

View File

@ -36,13 +36,13 @@
#include "cafAboutDialog.h"
#include "cafAssert.h"
#include <QtCore/QVariant>
#include <QtGui/QVBoxLayout>
#include <QtGui/QLabel>
#include <QtGui/QPushButton>
#include <QtOpenGL/QGLFormat>
#include <assert.h>
namespace caf {
@ -80,7 +80,7 @@ AboutDialog::AboutDialog(QWidget* parent)
//--------------------------------------------------------------------------------------------------
void AboutDialog::setApplicationName(const QString& appName)
{
assert(!m_isCreated);
CAF_ASSERT(!m_isCreated);
m_appName = appName;
}
@ -90,7 +90,7 @@ void AboutDialog::setApplicationName(const QString& appName)
//--------------------------------------------------------------------------------------------------
void AboutDialog::setApplicationVersion(const QString& ver)
{
assert(!m_isCreated);
CAF_ASSERT(!m_isCreated);
m_appVersion = ver;
}
@ -100,7 +100,7 @@ void AboutDialog::setApplicationVersion(const QString& ver)
//--------------------------------------------------------------------------------------------------
void AboutDialog::setCopyright(const QString& copyright)
{
assert(!m_isCreated);
CAF_ASSERT(!m_isCreated);
m_appCopyright = copyright;
}
@ -110,7 +110,7 @@ void AboutDialog::setCopyright(const QString& copyright)
//--------------------------------------------------------------------------------------------------
void AboutDialog::showQtVersion(bool show)
{
assert(!m_isCreated);
CAF_ASSERT(!m_isCreated);
m_showQtVersion = show;
}
@ -120,12 +120,12 @@ void AboutDialog::showQtVersion(bool show)
//--------------------------------------------------------------------------------------------------
void AboutDialog::addVersionEntry(const QString& verLabel, const QString& verText)
{
assert(!m_isCreated);
CAF_ASSERT(!m_isCreated);
m_verLabels.push_back(verLabel);
m_verTexts.push_back(verText);
assert(m_verLabels.size() == m_verTexts.size());
CAF_ASSERT(m_verLabels.size() == m_verTexts.size());
}
@ -134,7 +134,7 @@ void AboutDialog::addVersionEntry(const QString& verLabel, const QString& verTex
//--------------------------------------------------------------------------------------------------
void AboutDialog::setIsDebugBuild(bool isDebugBuild)
{
assert(!m_isCreated);
CAF_ASSERT(!m_isCreated);
m_isDebugBuild = isDebugBuild;
}
@ -145,7 +145,7 @@ void AboutDialog::setIsDebugBuild(bool isDebugBuild)
void AboutDialog::create()
{
// Only allowed to call once
assert(!m_isCreated);
CAF_ASSERT(!m_isCreated);
// Only show app info if app name is non-empty
bool showAppInfo = !m_appName.isEmpty();
@ -180,7 +180,7 @@ void AboutDialog::create()
appInfoLayout->setSpacing(3);
// Always do app name
assert(!m_appName.isEmpty());
CAF_ASSERT(!m_appName.isEmpty());
QLabel* appNameLabel = new QLabel(this);
QFont appNameFont(appNameLabel->font());
@ -245,7 +245,7 @@ void AboutDialog::create()
// Custom specified labels
if (m_verLabels.size() > 0)
{
assert(m_verLabels.size() == m_verTexts.size());
CAF_ASSERT(m_verLabels.size() == m_verTexts.size());
int i;
for (i = 0; i < m_verLabels.size(); i++)

View File

@ -46,7 +46,6 @@
#include "cafFactory.h"
#include <assert.h>
namespace caf
@ -60,8 +59,8 @@ CAF_PDM_UI_FIELD_EDITOR_SOURCE_INIT(PdmUiCheckBoxEditor);
//--------------------------------------------------------------------------------------------------
void PdmUiCheckBoxEditor::configureAndUpdateUi(const QString& uiConfigName)
{
assert(!m_checkBox.isNull());
assert(!m_label.isNull());
CAF_ASSERT(!m_checkBox.isNull());
CAF_ASSERT(!m_label.isNull());
PdmUiCheckBoxEditorAttribute attributes;
caf::PdmUiObjectHandle* uiObject = uiObj(field()->fieldHandle()->ownerObject());

View File

@ -12,7 +12,6 @@
#include "cafFactory.h"
#include "cafTristate.h"
#include <assert.h>
namespace caf
@ -26,8 +25,8 @@ CAF_PDM_UI_FIELD_EDITOR_SOURCE_INIT(PdmUiCheckBoxTristateEditor);
//--------------------------------------------------------------------------------------------------
void PdmUiCheckBoxTristateEditor::configureAndUpdateUi(const QString& uiConfigName)
{
assert(!m_checkBox.isNull());
assert(!m_label.isNull());
CAF_ASSERT(!m_checkBox.isNull());
CAF_ASSERT(!m_label.isNull());
{
QIcon ic = field()->uiIcon(uiConfigName);

View File

@ -53,8 +53,6 @@
#include <QToolButton>
#include <QColorDialog>
#include <assert.h>
namespace caf
{
@ -75,7 +73,7 @@ PdmUiColorEditor::PdmUiColorEditor()
//--------------------------------------------------------------------------------------------------
void PdmUiColorEditor::configureAndUpdateUi(const QString& uiConfigName)
{
assert(!m_label.isNull());
CAF_ASSERT(!m_label.isNull());
QIcon ic = field()->uiIcon(uiConfigName);
if (!ic.isNull())

View File

@ -46,8 +46,6 @@
#include <QComboBox>
#include <QLabel>
#include <assert.h>
namespace caf
{
@ -79,7 +77,7 @@ void PdmUiComboBoxEditor::configureAndUpdateUi(const QString& uiConfigName)
bool fromMenuOnly = true;
QList<PdmOptionItemInfo> options = field()->valueOptions(&fromMenuOnly);
assert(fromMenuOnly); // Not supported
CAF_ASSERT(fromMenuOnly); // Not supported
m_comboBox->blockSignals(true);
m_comboBox->clear();

View File

@ -50,8 +50,6 @@
#include <QGridLayout>
#include <QWidget>
#include <assert.h>
namespace caf
@ -86,7 +84,7 @@ PdmUiDefaultObjectEditor::~PdmUiDefaultObjectEditor()
{
// If there are field editor present, the usage of this editor has not cleared correctly
// The intended usage is to call the method setPdmObject(NULL) before closing the dialog
assert(m_fieldViews.size() == 0);
CAF_ASSERT(m_fieldViews.size() == 0);
}
//--------------------------------------------------------------------------------------------------
@ -235,10 +233,10 @@ void PdmUiDefaultObjectEditor::recursiveSetupFieldsAndGroups(const std::vector<P
else
{
groupBox = it->second;
assert(groupBox);
CAF_ASSERT(groupBox);
groupBoxLayout = dynamic_cast<QGridLayout*>(groupBox->layout());
assert(groupBoxLayout);
CAF_ASSERT(groupBoxLayout);
m_newGroupBoxes[groupBoxKey] = groupBox;
}
@ -278,7 +276,7 @@ void PdmUiDefaultObjectEditor::recursiveSetupFieldsAndGroups(const std::vector<P
// This assert will trigger for PdmChildArrayField and PdmChildField
// Consider to exclude assert or add editors for these types if the assert is reintroduced
//assert(false);
//CAF_ASSERT(false);
}
}
else
@ -377,7 +375,7 @@ void PdmUiDefaultObjectEditor::recursiveVerifyUniqueNames(const std::vector<PdmU
if (groupNames->find(groupBoxKey) != groupNames->end())
{
// It is not supported to have two groups with identical names
assert(false);
CAF_ASSERT(false);
}
else
{
@ -394,7 +392,7 @@ void PdmUiDefaultObjectEditor::recursiveVerifyUniqueNames(const std::vector<PdmU
if (fieldKeywordNames->find(fieldKeyword) != fieldKeywordNames->end())
{
// It is not supported to have two fields with identical names
assert(false);
CAF_ASSERT(false);
}
else
{
@ -435,7 +433,7 @@ caf::PdmUiFieldEditorHandle* PdmUiFieldEditorHelper::fieldEditorForField(PdmUiFi
bool useOptionsOnly = true;
QList<PdmOptionItemInfo> options = field->valueOptions(&useOptionsOnly);
assert(useOptionsOnly); // Not supported
CAF_ASSERT(useOptionsOnly); // Not supported
if (!options.empty())
{

View File

@ -93,7 +93,7 @@ CAF_PDM_UI_FIELD_EDITOR_SOURCE_INIT(PdmUiDoubleSliderEditor);
//--------------------------------------------------------------------------------------------------
void PdmUiDoubleSliderEditor::configureAndUpdateUi(const QString& uiConfigName)
{
assert(!m_lineEdit.isNull());
CAF_ASSERT(!m_lineEdit.isNull());
QIcon ic = field()->uiIcon(uiConfigName);
if (!ic.isNull())

View File

@ -49,7 +49,6 @@
#include <QLabel>
#include <QIntValidator>
#include <assert.h>
#include "cafFactory.h"
#include "qboxlayout.h"
#include "qtoolbutton.h"
@ -67,8 +66,8 @@ CAF_PDM_UI_FIELD_EDITOR_SOURCE_INIT(PdmUiFilePathEditor);
//--------------------------------------------------------------------------------------------------
void PdmUiFilePathEditor::configureAndUpdateUi(const QString& uiConfigName)
{
assert(!m_lineEdit.isNull());
assert(!m_label.isNull());
CAF_ASSERT(!m_lineEdit.isNull());
CAF_ASSERT(!m_label.isNull());
QIcon ic = field()->uiIcon(uiConfigName);
if (!ic.isNull())

View File

@ -55,7 +55,6 @@
#include <QStatusBar>
#include <QString>
#include <assert.h>
@ -231,7 +230,7 @@ void PdmUiLineEditor::configureAndUpdateUi(const QString& uiConfigName)
bool fromMenuOnly = true;
QList<PdmOptionItemInfo> enumNames = field()->valueOptions(&fromMenuOnly);
assert(fromMenuOnly); // Not supported
CAF_ASSERT(fromMenuOnly); // Not supported
if (!enumNames.isEmpty() && fromMenuOnly == true)
{

View File

@ -57,7 +57,6 @@
#include <QStringListModel>
#include <assert.h>
//==================================================================================================
@ -117,13 +116,13 @@ PdmUiListEditor::~PdmUiListEditor()
//--------------------------------------------------------------------------------------------------
void PdmUiListEditor::configureAndUpdateUi(const QString& uiConfigName)
{
// TODO: Fix assert here when undoing in testapp
// TODO: Fix CAF_ASSERT( here when undoing in testapp
// See PdmUiComboBoxEditor for pattern
// This might also apply to other editors
assert(!m_listView.isNull());
assert(!m_label.isNull());
assert(m_listView->selectionModel());
CAF_ASSERT(!m_listView.isNull());
CAF_ASSERT(!m_label.isNull());
CAF_ASSERT(m_listView->selectionModel());
QIcon ic = field()->uiIcon(uiConfigName);
if (!ic.isNull())
@ -156,12 +155,12 @@ void PdmUiListEditor::configureAndUpdateUi(const QString& uiConfigName)
MyStringListModel* strListModel = dynamic_cast<MyStringListModel*>(m_model.data());
assert(strListModel);
CAF_ASSERT(strListModel);
m_options = field()->valueOptions(&m_optionsOnly);
if (!m_options.isEmpty())
{
assert(m_optionsOnly); // Handling Additions on the fly not implemented
CAF_ASSERT(m_optionsOnly); // Handling Additions on the fly not implemented
strListModel->setItemsEditable(false);
QModelIndex currentItem = m_listView->selectionModel()->currentIndex();
@ -326,7 +325,7 @@ void PdmUiListEditor::slotSelectionChanged(const QItemSelection & selected, cons
void PdmUiListEditor::slotListItemEdited(const QModelIndex&, const QModelIndex&)
{
if (m_optionsOnly) return;
assert(m_options.isEmpty()); // Not supported yet
CAF_ASSERT(m_options.isEmpty()); // Not supported yet
QStringList uiList = m_model->stringList();
@ -376,7 +375,7 @@ bool PdmUiListEditor::eventFilter(QObject * listView, QEvent * event)
if (listView == m_listView && event->type() == QEvent::KeyPress)
{
if (m_optionsOnly) return false;
assert(m_options.isEmpty()); // Not supported yet
CAF_ASSERT(m_options.isEmpty()); // Not supported yet
QKeyEvent* keyEv = static_cast<QKeyEvent*>(event);
if (keyEv->key() == Qt::Key_Delete || keyEv->key() == Qt::Key_Backspace )

View File

@ -82,7 +82,7 @@ PdmUiListView::~PdmUiListView()
//--------------------------------------------------------------------------------------------------
void PdmUiListView::setPdmObject(caf::PdmObjectCollection* object)
{
assert(m_listViewEditor);
CAF_ASSERT(m_listViewEditor);
m_listViewEditor->setPdmObject(object);
}

View File

@ -46,7 +46,6 @@
#include <QTableView>
#include <QWidget>
#include <assert.h>
@ -229,7 +228,7 @@ PdmUiListViewEditor::~PdmUiListViewEditor()
//--------------------------------------------------------------------------------------------------
QWidget* PdmUiListViewEditor::createWidget(QWidget* parent)
{
assert(parent);
CAF_ASSERT(parent);
QWidget* mainWidget = new QWidget(parent);
QVBoxLayout* layout = new QVBoxLayout();

View File

@ -146,7 +146,7 @@ void PdmUiPropertyView::showProperties( PdmObjectHandle* object)
// Create widget to handle this
QWidget* propertyWidget = m_currentObjectView->getOrCreateWidget(m_placeholder);
assert(propertyWidget);
CAF_ASSERT(propertyWidget);
this->m_placeHolderLayout->insertWidget(0, propertyWidget);

View File

@ -46,7 +46,6 @@
#include "cafFactory.h"
#include <assert.h>
namespace caf
@ -60,8 +59,8 @@ CAF_PDM_UI_FIELD_EDITOR_SOURCE_INIT(PdmUiPushButtonEditor);
//--------------------------------------------------------------------------------------------------
void PdmUiPushButtonEditor::configureAndUpdateUi(const QString& uiConfigName)
{
assert(!m_pushButton.isNull());
assert(!m_label.isNull());
CAF_ASSERT(!m_pushButton.isNull());
CAF_ASSERT(!m_label.isNull());
QIcon ic = field()->uiIcon(uiConfigName);
if (!ic.isNull())

View File

@ -49,7 +49,6 @@
#include <QHBoxLayout>
#include <QIntValidator>
#include <assert.h>
namespace caf
@ -62,7 +61,7 @@ CAF_PDM_UI_FIELD_EDITOR_SOURCE_INIT(PdmUiSliderEditor);
//--------------------------------------------------------------------------------------------------
void PdmUiSliderEditor::configureAndUpdateUi(const QString& uiConfigName)
{
assert(!m_spinBox.isNull());
CAF_ASSERT(!m_spinBox.isNull());
QIcon ic = field()->uiIcon(uiConfigName);
if (!ic.isNull())

View File

@ -78,7 +78,7 @@ PdmUiTableView::~PdmUiTableView()
//--------------------------------------------------------------------------------------------------
void PdmUiTableView::setListField(PdmChildArrayFieldHandle* listField)
{
assert(m_listViewEditor);
CAF_ASSERT(m_listViewEditor);
m_listViewEditor->setListField(listField);
@ -106,7 +106,7 @@ void PdmUiTableView::setUiConfigurationName(QString uiConfigName)
//--------------------------------------------------------------------------------------------------
QTableView* PdmUiTableView::tableView()
{
assert(m_listViewEditor);
CAF_ASSERT(m_listViewEditor);
return m_listViewEditor->tableView();
}

View File

@ -39,7 +39,6 @@
#include "cafPdmUiFieldEditorHandle.h"
#include "cafPdmUiTableViewModel.h"
#include <assert.h>
namespace caf
@ -68,7 +67,7 @@ PdmUiTableViewDelegate::~PdmUiTableViewDelegate()
//--------------------------------------------------------------------------------------------------
QWidget * PdmUiTableViewDelegate::createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const
{
assert(m_model);
CAF_ASSERT(m_model);
QWidget* editorWidget = m_model->getEditorWidgetAndTransferOwnership(parent, index);
connect( editorWidget, SIGNAL(destroyed(QObject*)), SLOT(slotEditorDestroyed(QObject*)));

View File

@ -219,7 +219,7 @@ QVariant PdmUiTableViewModel::data(const QModelIndex &index, int role /*= Qt::Di
QList<PdmOptionItemInfo> options;
bool useOptionsOnly = true;
options = uiFieldHandle->valueOptions(&useOptionsOnly);
assert(useOptionsOnly); // Not supported
CAF_ASSERT(useOptionsOnly); // Not supported
for (QVariant v : valuesSelectedInField)
{
@ -241,7 +241,7 @@ QVariant PdmUiTableViewModel::data(const QModelIndex &index, int role /*= Qt::Di
bool useOptionsOnly = true;
QList<PdmOptionItemInfo> valueOptions = uiFieldHandle->valueOptions(&useOptionsOnly);
assert(useOptionsOnly); // Not supported
CAF_ASSERT(useOptionsOnly); // Not supported
if (!valueOptions.isEmpty())
{
@ -286,7 +286,7 @@ QVariant PdmUiTableViewModel::data(const QModelIndex &index, int role /*= Qt::Di
}
else
{
assert(false);
CAF_ASSERT(false);
}
}
else if (role == Qt::CheckStateRole)
@ -451,7 +451,7 @@ PdmFieldHandle* PdmUiTableViewModel::getField(const QModelIndex &index) const
}
else
{
assert(false);
CAF_ASSERT(false);
}
}
}

View File

@ -48,7 +48,6 @@
#include <QIntValidator>
#include <QVBoxLayout>
#include <assert.h>
@ -82,8 +81,8 @@ void TextEdit::focusOutEvent(QFocusEvent *e)
//--------------------------------------------------------------------------------------------------
void PdmUiTextEditor::configureAndUpdateUi(const QString& uiConfigName)
{
assert(!m_textEdit.isNull());
assert(!m_label.isNull());
CAF_ASSERT(!m_textEdit.isNull());
CAF_ASSERT(!m_label.isNull());
QIcon ic = field()->uiIcon(uiConfigName);
if (!ic.isNull())

View File

@ -47,7 +47,6 @@
#include <QMainWindow>
#include <QAction>
#include <assert.h>
#include "cafPdmUiOrdering.h"
#include "cafPdmObjectHandle.h"
#include "cafPdmUiObjectHandle.h"
@ -169,8 +168,8 @@ void PdmUiToolBarEditor::configureAndUpdateUi(const QString& uiConfigName)
}
}
assert(m_fields.size() == m_fieldViews.size());
assert(static_cast<int>(m_fields.size()) == m_actions.size());
CAF_ASSERT(m_fields.size() == m_fieldViews.size());
CAF_ASSERT(static_cast<int>(m_fields.size()) == m_actions.size());
for (size_t i = 0; i < m_fields.size(); i++)
{
@ -204,7 +203,7 @@ void PdmUiToolBarEditor::setFields(std::vector<caf::PdmFieldHandle*>& fields)
caf::PdmUiFieldHandle* uiFieldHandle = fields[i]->uiCapability();
// Supports only bool fields
assert(uiFieldHandle->uiValue().type() == QVariant::Bool);
CAF_ASSERT(uiFieldHandle->uiValue().type() == QVariant::Bool);
}
m_fields = fields;

View File

@ -54,7 +54,7 @@ CAF_PDM_UI_FIELD_EDITOR_SOURCE_INIT(PdmUiToolButtonEditor);
//--------------------------------------------------------------------------------------------------
void PdmUiToolButtonEditor::configureAndUpdateUi(const QString& uiConfigName)
{
assert(!m_toolButton.isNull());
CAF_ASSERT(!m_toolButton.isNull());
QIcon ic = field()->uiIcon(uiConfigName);
if (!ic.isNull())

View File

@ -92,7 +92,7 @@ void PdmUiTreeViewModel::setPdmItemRoot(PdmUiItem* rootItem)
}
}
assert( newRoot || rootItem == NULL ); // Only fields, objects or NULL is allowed.
CAF_ASSERT( newRoot || rootItem == NULL ); // Only fields, objects or NULL is allowed.
//if (newRoot) newRoot->debugDump(0);
@ -371,7 +371,7 @@ void PdmUiTreeViewModel::updateEditorsForSubTree(PdmUiTreeOrdering* root)
{
PdmUiTreeItemEditor* treeItemEditor = new PdmUiTreeItemEditor(root->activeItem());
root->setEditor(treeItemEditor);
assert(root->editor());
CAF_ASSERT(root->editor());
}
PdmUiTreeItemEditor* treeItemEditor = dynamic_cast<PdmUiTreeItemEditor*>(root->editor());
@ -396,7 +396,7 @@ PdmUiTreeOrdering* caf::PdmUiTreeViewModel::treeItemFromIndex(const QModelIndex&
return m_treeOrderingRoot;
}
assert(index.internalPointer());
CAF_ASSERT(index.internalPointer());
PdmUiTreeOrdering* treeItem = static_cast<PdmUiTreeOrdering*>(index.internalPointer());
@ -457,7 +457,7 @@ QModelIndex PdmUiTreeViewModel::index(int row, int column, const QModelIndex &pa
else
parentItem = static_cast<PdmUiTreeOrdering*>(parentIndex.internalPointer());
assert(parentItem);
CAF_ASSERT(parentItem);
if (parentItem->childCount() <= row)
{
@ -670,7 +670,7 @@ bool PdmUiTreeViewModel::setData(const QModelIndex &index, const QVariant &value
}
PdmUiTreeOrdering* treeItem = PdmUiTreeViewModel::treeItemFromIndex(index);
assert(treeItem);
CAF_ASSERT(treeItem);
if (!treeItem->isRepresentingObject()) return false;
@ -720,7 +720,7 @@ Qt::ItemFlags PdmUiTreeViewModel::flags(const QModelIndex &index) const
Qt::ItemFlags flagMask = QAbstractItemModel::flags(index);
PdmUiTreeOrdering* treeItem = treeItemFromIndex(index);
assert(treeItem);
CAF_ASSERT(treeItem);
if (treeItem->isRepresentingObject())
{

View File

@ -36,12 +36,13 @@
#include "cafProgressInfo.h"
#include "cafAssert.h"
#include <QPointer>
#include <QProgressDialog>
#include <QCoreApplication>
#include <QApplication>
#include <QThread>
#include <assert.h>
namespace caf {
@ -393,7 +394,7 @@ namespace caf {
int totalProgress = static_cast<int>(currentTotalProgress());
int totalMaxProgress = static_cast<int>(currentTotalMaxProgressValue());
assert(static_cast<int>(totalProgress) <= totalMaxProgress);
CAF_ASSERT(static_cast<int>(totalProgress) <= totalMaxProgress);
progressDialog()->setMaximum(totalMaxProgress);
progressDialog()->setValue(totalProgress);
@ -413,7 +414,7 @@ namespace caf {
std::vector<size_t>& progressStack_v = progressStack();
std::vector<size_t>& progressSpanStack_v = progressSpanStack();
assert(progressStack_v.size());
CAF_ASSERT(progressStack_v.size());
ProgressInfoStatic::setProgress(progressStack_v.back() + progressSpanStack_v.back());
}
@ -425,7 +426,7 @@ namespace caf {
{
if (!isUpdatePossible()) return;
assert(progressSpanStack().size());
CAF_ASSERT(progressSpanStack().size());
progressSpanStack().back() = nextStepSize;
}
@ -442,7 +443,7 @@ namespace caf {
std::vector<size_t>& progressSpanStack_v = progressSpanStack();
std::vector<size_t>& maxProgressStack_v = maxProgressStack();
assert(maxProgressStack_v.size() && progressStack_v.size() && progressSpanStack_v.size() && titleStack().size() && descriptionStack().size());
CAF_ASSERT(maxProgressStack_v.size() && progressStack_v.size() && progressSpanStack_v.size() && titleStack().size() && descriptionStack().size());
// Set progress to max value, and leave it there until somebody touches the progress again