#10649 Fwk: Use collection.empty() instead of comparing with size

This commit is contained in:
Kristian Bendiksen 2023-09-25 13:44:35 +02:00
parent a4def5d407
commit 98796b0dd9
41 changed files with 77 additions and 77 deletions

View File

@ -48,7 +48,7 @@ namespace caf
ColorTable::ColorTable( const std::vector<cvf::Color3ub>& colors )
: m_colors( colors )
{
CVF_ASSERT( m_colors.size() > 0 );
CVF_ASSERT( !m_colors.empty() );
}
//--------------------------------------------------------------------------------------------------
@ -57,7 +57,7 @@ ColorTable::ColorTable( const std::vector<cvf::Color3ub>& colors )
ColorTable::ColorTable( const cvf::Color3ubArray& colors )
: m_colors( colors.begin(), colors.end() )
{
CVF_ASSERT( m_colors.size() > 0 );
CVF_ASSERT( !m_colors.empty() );
}
//--------------------------------------------------------------------------------------------------

View File

@ -190,12 +190,12 @@ bool Utils::getSaveDirectoryAndCheckOverwriteFiles( const QString& defaultDir, s
}
}
if ( filesToOverwrite.size() == 0 )
if ( filesToOverwrite.empty() )
{
overWriteFiles = true;
return overWriteFiles;
}
else if ( filesToOverwrite.size() > 0 )
else if ( !filesToOverwrite.empty() )
{
QMessageBox msgBox;

View File

@ -113,7 +113,7 @@ void CellRangeFilter::addCellExclude( size_t i, size_t j, size_t k, bool applyTo
//--------------------------------------------------------------------------------------------------
bool CellRangeFilter::isCellVisible( size_t i, size_t j, size_t k, bool isInSubGridArea ) const
{
if ( m_includeRanges.size() == 0 )
if ( m_includeRanges.empty() )
{
return false;
}
@ -159,7 +159,7 @@ bool CellRangeFilter::isCellExcluded( size_t i, size_t j, size_t k, bool isInSub
//--------------------------------------------------------------------------------------------------
bool CellRangeFilter::hasIncludeRanges() const
{
if ( m_includeRanges.size() > 0 )
if ( !m_includeRanges.empty() )
return true;
else
return false;
@ -411,7 +411,7 @@ void StructGridGeometryGenerator::computeArrays()
if ( isCellFaceVisible( i, j, k, StructGridInterface::POS_K ) )
visibleFaces.push_back( cvf::StructGridInterface::POS_K );
if ( visibleFaces.size() > 0 )
if ( !visibleFaces.empty() )
{
cvf::Vec3d cornerVerts[8];
m_grid->cellCornerVertices( cellIndex, cornerVerts );

View File

@ -208,7 +208,7 @@ caf::CmdFeature* CmdFeatureManager::commandFeature( const std::string& commandId
//--------------------------------------------------------------------------------------------------
void CmdFeatureManager::refreshStates( const QStringList& commandIdList )
{
if ( commandIdList.size() == 0 )
if ( commandIdList.empty() )
{
for ( size_t i = 0; i < m_commandFeatures.size(); i++ )
{
@ -241,7 +241,7 @@ void CmdFeatureManager::refreshStates( const QStringList& commandIdList )
//--------------------------------------------------------------------------------------------------
void CmdFeatureManager::refreshEnabledState( const QStringList& commandIdList )
{
if ( commandIdList.size() == 0 )
if ( commandIdList.empty() )
{
for ( size_t i = 0; i < m_commandFeatures.size(); i++ )
{
@ -267,7 +267,7 @@ void CmdFeatureManager::refreshEnabledState( const QStringList& commandIdList )
//--------------------------------------------------------------------------------------------------
void CmdFeatureManager::refreshCheckedState( const QStringList& commandIdList )
{
if ( commandIdList.size() == 0 )
if ( commandIdList.empty() )
{
for ( size_t i = 0; i < m_commandFeatures.size(); i++ )
{

View File

@ -60,7 +60,7 @@ bool ToggleItemsOnOthersOffFeature::isCommandEnabled() const
caf::PdmFieldHandle* commonParent = verifySameParentForSelection( selectedObjects );
std::vector<caf::PdmObjectHandle*> children = childObjects( commonParent );
return commonParent != nullptr && children.size() > 0 && objectToggleField( children.front() ) &&
return commonParent != nullptr && !children.empty() && objectToggleField( children.front() ) &&
children.size() > selectedObjects.size();
}

View File

@ -56,7 +56,7 @@
QString iconResourceName; \
QString toolTip; \
QString whatsThis; \
if ( arguments.size() > 0 ) iconResourceName = arguments[0]; \
if ( !arguments.empty() ) iconResourceName = arguments[0]; \
if ( arguments.size() > 1 ) toolTip = arguments[1]; \
if ( arguments.size() > 2 ) whatsThis = arguments[2]; \
\
@ -76,7 +76,7 @@
QString iconResourceName; \
QString toolTip; \
QString whatsThis; \
if ( arguments.size() > 0 ) iconResourceName = arguments[0]; \
if ( !arguments.empty() ) iconResourceName = arguments[0]; \
if ( arguments.size() > 1 ) toolTip = arguments[1]; \
if ( arguments.size() > 2 ) whatsThis = arguments[2]; \
\
@ -95,7 +95,7 @@
QString iconResourceName; \
QString toolTip; \
QString whatsThis; \
if ( arguments.size() > 0 ) iconResourceName = arguments[0]; \
if ( !arguments.empty() ) iconResourceName = arguments[0]; \
if ( arguments.size() > 1 ) toolTip = arguments[1]; \
if ( arguments.size() > 2 ) whatsThis = arguments[2]; \
\
@ -115,7 +115,7 @@
QString iconResourceName; \
QString toolTip; \
QString whatsThis; \
if ( arguments.size() > 0 ) iconResourceName = arguments[0]; \
if ( !arguments.empty() ) iconResourceName = arguments[0]; \
if ( arguments.size() > 1 ) toolTip = arguments[1]; \
if ( arguments.size() > 2 ) whatsThis = arguments[2]; \
\

View File

@ -38,7 +38,7 @@ NotificationCenter::NotificationCenter()
//--------------------------------------------------------------------------------------------------
NotificationCenter::~NotificationCenter()
{
CAF_ASSERT( m_observers.size() == 0 );
CAF_ASSERT( m_observers.empty() );
}
//--------------------------------------------------------------------------------------------------

View File

@ -188,7 +188,7 @@ QStringList PdmReferenceHelper::referenceFromRootToObjectAsStringList( PdmObject
PdmFieldHandle* PdmReferenceHelper::fieldFromReference( PdmObjectHandle* root, const QString& reference )
{
QStringList decodedReference = reference.split( " " );
if ( decodedReference.size() == 0 ) return nullptr;
if ( decodedReference.empty() ) return nullptr;
QString fieldKeyword = decodedReference[0];
decodedReference.pop_front();
@ -364,7 +364,7 @@ PdmObjectHandle* PdmReferenceHelper::findRoot( PdmObjectHandle* obj )
{
std::vector<PdmObjectHandle*> path = findPathToObjectFromRoot( obj );
if ( path.size() )
if ( !path.empty() )
return path[0];
else
return nullptr;

View File

@ -83,7 +83,7 @@ class PdmObjectCapability;
QString iconResourceName; \
QString toolTip; \
QString whatsThis; \
if ( arguments.size() > 0 ) iconResourceName = arguments[0]; \
if ( !arguments.empty() ) iconResourceName = arguments[0]; \
if ( arguments.size() > 1 ) toolTip = arguments[1]; \
if ( arguments.size() > 2 ) whatsThis = arguments[2]; \
\
@ -108,7 +108,7 @@ class PdmObjectCapability;
QString iconResourceName; \
QString toolTip; \
QString whatsThis; \
if ( arguments.size() > 0 ) iconResourceName = arguments[0]; \
if ( !arguments.empty() ) iconResourceName = arguments[0]; \
if ( arguments.size() > 1 ) toolTip = arguments[1]; \
if ( arguments.size() > 2 ) whatsThis = arguments[2]; \
CAF_PDM_VERIFY_XML_KEYWORD( keyword ) \
@ -137,7 +137,7 @@ class PdmObjectCapability;
QString iconResourceName; \
QString toolTip; \
QString whatsThis; \
if ( arguments.size() > 0 ) iconResourceName = arguments[0]; \
if ( !arguments.empty() ) iconResourceName = arguments[0]; \
if ( arguments.size() > 1 ) toolTip = arguments[1]; \
if ( arguments.size() > 2 ) whatsThis = arguments[2]; \
CAF_PDM_VERIFY_XML_KEYWORD( keyword ) \

View File

@ -21,7 +21,7 @@ void PdmFieldUiCap<FieldType>::setValueFromUiEditor( const QVariant& uiValue, bo
bool setUiValueDirectly = false;
// Check whether we are handling selections of values or actual values
if ( m_optionEntryCache.size() )
if ( !m_optionEntryCache.empty() )
{
// This has an option based GUI, the uiValue is only indexes into the m_optionEntryCache
if ( uiValue.type() == QVariant::UInt )
@ -125,7 +125,7 @@ void PdmFieldUiCap<FieldType>::setValueFromUiEditor( const QVariant& uiValue, bo
template <typename FieldType>
QVariant PdmFieldUiCap<FieldType>::uiValue() const
{
if ( m_optionEntryCache.size() )
if ( !m_optionEntryCache.empty() )
{
QVariant uiBasedQVariant = toUiBasedQVariant();
std::vector<unsigned int> indexesToFoundOptions;
@ -190,12 +190,12 @@ QList<PdmOptionItemInfo> PdmFieldUiCap<FieldType>::valueOptions() const
// If we got no options, use the options defined by the type. Normally only caf::AppEnum type
if ( !m_optionEntryCache.size() )
if ( m_optionEntryCache.empty() )
{
m_optionEntryCache = PdmUiFieldSpecialization<typename FieldType::FieldDataType>::valueOptions( m_field->value() );
}
if ( m_optionEntryCache.size() && isAutoAddingOptionFromValue() )
if ( !m_optionEntryCache.empty() && isAutoAddingOptionFromValue() )
{
// Make sure the options contain the field values, event though they not necessarily
// is supplied as possible options by the application. This is a convenience making sure

View File

@ -188,7 +188,7 @@ bool PdmOptionItemInfo::findValues( const QList<PdmOptionItemInfo>& optionList,
{
QList<QVariant> valuesSelectedInField = fieldValue.toList();
if ( valuesSelectedInField.size() )
if ( !valuesSelectedInField.empty() )
{
// Create a list to be able to remove items as they are matched with values
std::list<std::pair<QVariant, unsigned int>> optionVariantAndIndexPairs;
@ -230,7 +230,7 @@ bool PdmOptionItemInfo::findValues( const QList<PdmOptionItemInfo>& optionList,
break;
}
}
return ( foundIndexes.size() > 0 );
return ( !foundIndexes.empty() );
}
}

View File

@ -358,7 +358,7 @@ void SelectionManager::clearAll()
m_selectionPrLevel.clear();
if ( changedSelectionLevels.size() )
if ( !changedSelectionLevels.empty() )
{
notifySelectionChanged( changedSelectionLevels );
}

View File

@ -67,7 +67,7 @@ void PdmSettings::readFieldsFromApplicationStore( caf::PdmObjectHandle* object,
readFieldsFromApplicationStore( child, subContext );
}
if ( children.size() == 0 )
if ( children.empty() )
{
QString key = context + fieldHandle->keyword();
if ( settings.contains( key ) )
@ -116,7 +116,7 @@ void PdmSettings::writeFieldsToApplicationStore( const caf::PdmObjectHandle* obj
writeFieldsToApplicationStore( child, subContext );
}
if ( children.size() == 0 )
if ( children.empty() )
{
caf::PdmValueField* valueField = dynamic_cast<caf::PdmValueField*>( fieldHandle );
CAF_ASSERT( valueField );

View File

@ -213,7 +213,7 @@ void AboutDialog::create()
}
// Possibly show extend version info
if ( m_showQtVersion || m_verLabels.size() > 0 )
if ( m_showQtVersion || !m_verLabels.empty() )
{
QGridLayout* verInfoLayout = new QGridLayout;
verInfoLayout->setSpacing( 0 );
@ -227,7 +227,7 @@ void AboutDialog::create()
}
// Custom specified labels
if ( m_verLabels.size() > 0 )
if ( !m_verLabels.empty() )
{
CAF_ASSERT( m_verLabels.size() == m_verTexts.size() );

View File

@ -67,7 +67,7 @@ caf::PdmUiFormLayoutObjectEditor::~PdmUiFormLayoutObjectEditor()
{
// 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
CAF_ASSERT( m_fieldViews.size() == 0 );
CAF_ASSERT( m_fieldViews.empty() );
}
//--------------------------------------------------------------------------------------------------

View File

@ -311,7 +311,7 @@ void PdmUiLineEditor::slotEditingFinished()
uiField()->enableAutoValue( false );
if ( m_optionCache.size() )
if ( !m_optionCache.empty() )
{
int index = findIndexToOption( m_lineEdit->text() );
if ( index > -1 )

View File

@ -161,7 +161,7 @@ void PdmUiListEditor::configureAndUpdateUi( const QString& uiConfigName )
QList<PdmOptionItemInfo> options = uiField()->valueOptions();
m_optionItemCount = options.size();
if ( options.size() > 0 || uiField()->isUiReadOnly( uiConfigName ) )
if ( !options.empty() || uiField()->isUiReadOnly( uiConfigName ) )
{
m_isEditOperationsAvailable = false;
}
@ -322,7 +322,7 @@ void PdmUiListEditor::slotSelectionChanged( const QItemSelection& selected, cons
m_listView->selectionModel()->select( m_listView->currentIndex(), QItemSelectionModel::SelectCurrent );
QModelIndexList idxList = m_listView->selectionModel()->selectedIndexes();
if ( idxList.size() >= 1 )
if ( !idxList.empty() )
{
if ( idxList[0].row() < m_optionItemCount )
{
@ -471,7 +471,7 @@ bool PdmUiListEditor::eventFilter( QObject* object, QEvent* event )
{
QModelIndexList idxList = m_listView->selectionModel()->selectedIndexes();
bool isAnyDeleted = false;
while ( idxList.size() )
while ( !idxList.empty() )
{
m_model->removeRow( idxList[0].row() );
idxList = m_listView->selectionModel()->selectedIndexes();

View File

@ -93,7 +93,7 @@ int UiListViewModelPdm::columnCount( const QModelIndex& parent /*= QModelIndex(
//--------------------------------------------------------------------------------------------------
void UiListViewModelPdm::computeColumnCount()
{
if ( m_editorAttribute.fieldNames.size() > 0 )
if ( !m_editorAttribute.fieldNames.empty() )
{
m_columnCount = m_editorAttribute.fieldNames.size();
}
@ -139,7 +139,7 @@ QVariant caf::UiListViewModelPdm::data( const QModelIndex& index, int role /*= Q
{
size_t fieldIndex = 0;
if ( m_editorAttribute.fieldNames.size() > 0 )
if ( !m_editorAttribute.fieldNames.empty() )
{
QString fieldName = m_editorAttribute.fieldNames[index.column()];
for ( size_t i = 0; i < fields.size(); i++ )

View File

@ -152,7 +152,7 @@ void PdmUiTreeView::slotOnSelectionChanged()
m_treeViewEditor->selectedUiItems( objects );
PdmObjectHandle* objHandle = nullptr;
if ( objects.size() )
if ( !objects.empty() )
{
PdmUiObjectHandle* uiObjH = dynamic_cast<PdmUiObjectHandle*>( objects[0] );
if ( uiObjH )

View File

@ -379,7 +379,7 @@ void PdmUiTreeViewEditor::customMenuRequested( QPoint pos )
caf::PdmUiCommandSystemProxy::instance()->populateMenuWithDefaultCommands( "PdmUiTreeViewEditor", &menu );
if ( menu.actions().size() > 0 )
if ( !menu.actions().empty() )
{
// Qt doc: QAbstractScrollArea and its subclasses that map the context menu event to coordinates of the viewport().
QPoint globalPos = m_treeView->viewport()->mapToGlobal( pos );

View File

@ -474,7 +474,7 @@ void ProgressInfoStatic::start( size_t maxProgressValue, const QString& title, b
QProgressDialog* dialog = progressDialog();
if ( !maxProgressStack_v.size() )
if ( maxProgressStack_v.empty() )
{
// progressDialog()->setWindowModality(Qt::ApplicationModal);
if ( dialog )
@ -630,8 +630,8 @@ void ProgressInfoStatic::finished()
std::vector<size_t>& progressSpanStack_v = progressSpanStack();
std::vector<size_t>& maxProgressStack_v = maxProgressStack();
CAF_ASSERT( maxProgressStack_v.size() && progressStack_v.size() && progressSpanStack_v.size() &&
titleStack().size() && descriptionStack().size() );
CAF_ASSERT( !maxProgressStack_v.empty() && !progressStack_v.empty() && !progressSpanStack_v.empty() &&
!titleStack().empty() && !descriptionStack().empty() );
// Set progress to max value, and leave it there until somebody touches the progress again

View File

@ -280,7 +280,7 @@ void caf::Viewer::setupRenderingSequence()
//--------------------------------------------------------------------------------------------------
caf::Viewer* caf::Viewer::sharedWidget()
{
if ( sm_viewers.size() > 0 )
if ( !sm_viewers.empty() )
{
return *( sm_viewers.begin() );
}
@ -1036,7 +1036,7 @@ void caf::Viewer::updateComparisonViewActiveFlag()
//--------------------------------------------------------------------------------------------------
void caf::Viewer::setCurrentComparisonFrame( int frameIndex )
{
if ( m_frameScenes.size() == 0 ) return;
if ( m_frameScenes.empty() ) return;
unsigned clampedFrameIndex = static_cast<unsigned>( clampFrameIndex( frameIndex ) );
@ -1072,7 +1072,7 @@ void caf::Viewer::setComparisonViewToFollowAnimation( bool isToFollow )
//--------------------------------------------------------------------------------------------------
void caf::Viewer::slotSetCurrentFrame( int frameIndex )
{
if ( m_frameScenes.size() == 0 ) return;
if ( m_frameScenes.empty() ) return;
unsigned clampedFrameIndex = static_cast<unsigned>( clampFrameIndex( frameIndex ) );

View File

@ -203,7 +203,7 @@ double CategoryMapper::domainValue( double normalizedValue ) const
{
double clampedValue = cvf::Math::clamp( normalizedValue, 0.0, 1.0 );
if ( m_categoryValues.size() == 0 )
if ( m_categoryValues.empty() )
{
return 0.0;
}

View File

@ -133,7 +133,7 @@ Array<T>::Array(const std::vector<T>& other)
{
ground();
if (other.size() > 0)
if (!other.empty())
{
assign(other);
}

View File

@ -221,7 +221,7 @@ std::string Base64::encode(const cvf::UByteArray& data)
//--------------------------------------------------------------------------------------------------
cvf::ref<cvf::UByteArray> Base64::decode(const std::string& encodedData)
{
if (encodedData.size() < 1) return NULL;
if (encodedData.empty()) return NULL;
std::string decodedData = cvf_base64::base64_decode(encodedData);
size_t numDecodedBytes = decodedData.length();

View File

@ -160,7 +160,7 @@ size_t CharArray::size() const
//--------------------------------------------------------------------------------------------------
const char* CharArray::ptr() const
{
CVF_ASSERT(m_data.size() > 0);
CVF_ASSERT(!m_data.empty());
CVF_ASSERT(m_data[m_data.size() - 1] == '\0');
return &m_data[0];
@ -172,7 +172,7 @@ const char* CharArray::ptr() const
//--------------------------------------------------------------------------------------------------
char* CharArray::ptr()
{
CVF_ASSERT(m_data.size() > 0);
CVF_ASSERT(!m_data.empty());
CVF_ASSERT(m_data[m_data.size() - 1] == '\0');
return &m_data[0];

View File

@ -501,7 +501,7 @@ Option ProgramOptions::option(const String& optionName) const
String ProgramOptions::firstValue(const String& optionName) const
{
const ParsedOption* parsedOption = findParsedOption(optionName);
if (parsedOption && parsedOption->m_values.size() > 0)
if (parsedOption && !parsedOption->m_values.empty())
{
return parsedOption->m_values[0];
}
@ -657,7 +657,7 @@ String ProgramOptions::usageText(int maxWidth, int maxOptionWidth) const
std::vector<String> descrLines = breakStringIntoLines(descrArr[iopt], static_cast<size_t>(maxDescrWidth));
String s = String("%1 ").arg(optAndValArr[iopt], -(firstColWidth - 1));
if (s.size() > static_cast<size_t>(firstColWidth) && descrLines.size() > 0)
if (s.size() > static_cast<size_t>(firstColWidth) && !descrLines.empty())
{
s += "\n" + firstColBlanks;
}
@ -683,7 +683,7 @@ String ProgramOptions::usageText(int maxWidth, int maxOptionWidth) const
std::vector<String> ProgramOptions::breakStringIntoLines(const String& str, size_t maxCharsPerLine)
{
std::vector<String> words = str.split();
if (words.size() < 1)
if (words.empty())
{
return std::vector<String>();
}

View File

@ -442,7 +442,7 @@ void Variant::swap(Variant& other)
//--------------------------------------------------------------------------------------------------
void Variant::assignData(const void* pointerToData, size_t dataSizeInBytes)
{
CVF_ASSERT(m_arrayData.size() == 0);
CVF_ASSERT(m_arrayData.empty());
m_data.assign(reinterpret_cast<const ubyte*>(pointerToData), reinterpret_cast<const ubyte*>(pointerToData) + dataSizeInBytes);
CVF_ASSERT(m_data.size() == dataSizeInBytes);

View File

@ -245,7 +245,7 @@ void BasicAboutDialog::create()
// Possibly show extend version info
if (m_showLibraryVersion ||
m_showQtVersion ||
m_verLabels.size() > 0)
!m_verLabels.empty())
{
QGridLayout* verInfoLayout = new QGridLayout;
verInfoLayout->setSpacing(0);
@ -268,7 +268,7 @@ void BasicAboutDialog::create()
}
// Custom specified labels
if (m_verLabels.size() > 0)
if (!m_verLabels.empty())
{
CVF_ASSERT(m_verLabels.size() == m_verTexts.size());

View File

@ -1428,7 +1428,7 @@ bool DrawableGeo::rayIntersect(const Ray& ray, Vec3dArray* intersectionPoints, U
accumulatedFaceCount += numPrimFaces;
}
if (isectPts.size() > 0)
if (!isectPts.empty())
{
if (intersectionPoints) intersectionPoints->assign(isectPts);
if (facesHit) facesHit->assign(faceIndices);

View File

@ -322,7 +322,7 @@ void DrawableText::renderText(OpenGLContext* oglContext, ShaderProgram* shaderPr
CVF_ASSERT(oglContext);
CVF_ASSERT(!shaderProgram || ShaderProgram::supportedOpenGL(oglContext));
if (m_texts.size() == 0) return;
if (m_texts.empty()) return;
CVF_ASSERT(m_positions.size() == m_texts.size() && m_positions.size() == m_directions.size());
if (m_checkPosVisible)

View File

@ -158,7 +158,7 @@ ref<DrawableGeo> GeometryBuilderDrawableGeo::drawableGeo() const
{
ref<DrawableGeo> geo = new DrawableGeo;
if (m_vertices.size() > 0)
if (!m_vertices.empty())
{
ref<Vec3fArray> newVertexArray = new Vec3fArray(m_vertices);
geo->setVertexArray(newVertexArray.p());

View File

@ -165,7 +165,7 @@ bool OpenGLContextGroup::initializeContextGroup(OpenGLContext* currentContext)
//--------------------------------------------------------------------------------------------------
void OpenGLContextGroup::uninitializeContextGroup()
{
CVF_ASSERT(m_contexts.size() == 0);
CVF_ASSERT(m_contexts.empty());
CVF_ASSERT(!m_resourceManager->hasAnyOpenGLResources());
// Just replace capablities with a new object

View File

@ -82,7 +82,7 @@ OpenGLResourceManager::~OpenGLResourceManager()
CVF_ASSERT(bufferObjectMemoryUsage() == 0);
CVF_ASSERT(bufferObjectCount() == 0);
CVF_ASSERT(m_oglResources.size() == 0);
CVF_ASSERT(m_oglResources.empty());
CVF_ASSERT(m_textShaderProgram.isNull());
CVF_ASSERT(m_nudgeShaderProgram.isNull());

View File

@ -196,7 +196,7 @@ void OverlayNavigationCube::render(OpenGLContext* oglContext, const Vec2i& posit
createAxisGeometry(software);
}
if (m_cubeGeos.size() == 0)
if (m_cubeGeos.empty())
{
createCubeGeos();
@ -228,7 +228,7 @@ void OverlayNavigationCube::render(OpenGLContext* oglContext, const Vec2i& posit
}
}
if (m_2dGeos.size() == 0)
if (m_2dGeos.empty())
{
create2dGeos();
}

View File

@ -168,7 +168,7 @@ void ShaderProgramGenerator::configureStandardHeadlightTexture()
//--------------------------------------------------------------------------------------------------
ref<ShaderProgram> ShaderProgramGenerator::generate()
{
CVF_ASSERT((m_vertexCodes.size() > 0) && (m_fragmentCodes.size() > 0));
CVF_ASSERT((!m_vertexCodes.empty()) && (!m_fragmentCodes.empty()));
ShaderSourceCombiner vertexCombiner(m_vertexCodes, m_vertexNames);
ShaderSourceCombiner fragmentCombiner(m_fragmentCodes, m_fragmentNames);
@ -185,7 +185,7 @@ ref<ShaderProgram> ShaderProgramGenerator::generate()
prog->addShader(vertexShader.p());
prog->addShader(fragmentShader.p());
if (m_geometryCodes.size() > 0)
if (!m_geometryCodes.empty())
{
ShaderSourceCombiner geometryCombiner(m_geometryCodes, m_geometryNames);
String geometrySource = geometryCombiner.combinedSource();
@ -316,7 +316,7 @@ uint ShaderSourceCombiner::findVersion(const String& shaderCode)
String firstLine = shaderCode.subString(0, firstNewline);
std::vector<String> firstLineArr = firstLine.split(" ");
if (firstLineArr.size() == 0)
if (firstLineArr.empty())
{
return 0;
}

View File

@ -110,7 +110,7 @@ Texture::~Texture()
void Texture::setFromImage(TextureImage* image)
{
CVF_ASSERT(textureType() == TEXTURE_2D || textureType() == TEXTURE_RECTANGLE);
CVF_ASSERT(m_cubeMapImages.size() == 0);
CVF_ASSERT(m_cubeMapImages.empty());
CVF_ASSERT(image);
forgetCurrentOglTexture();
@ -133,7 +133,7 @@ void Texture::setCubeMapImage(CubeMapFace face, TextureImage* cubeMapImage)
forgetCurrentOglTexture();
m_image = NULL;
if (m_cubeMapImages.size() == 0)
if (m_cubeMapImages.empty())
{
m_cubeMapImages.resize(6);
@ -175,7 +175,7 @@ TextureImage* Texture::cubeMapImage(CubeMapFace face)
void Texture::setSize(uint width, uint height)
{
CVF_ASSERT(m_image.isNull());
CVF_ASSERT(m_cubeMapImages.size() == 0);
CVF_ASSERT(m_cubeMapImages.empty());
forgetCurrentOglTexture();
clearImages();
@ -322,7 +322,7 @@ bool Texture::setupTexture(OpenGLContext* oglContext)
case TEXTURE_CUBE_MAP:
{
if (m_cubeMapImages.size() == 0)
if (m_cubeMapImages.empty())
{
uint i;
for (i = 0; i < 6; i++)

View File

@ -328,7 +328,7 @@ void VertexBundle::removeGenericAttribute(const VertexAttribute* vertexAttribute
m_genericAttributes.eraseAt(idx);
m_genericBufferObjects.eraseAt(idx);
if (m_genericAttributes.size() == 0)
if (m_genericAttributes.empty())
{
m_hasGenericAttribs = false;
}

View File

@ -114,7 +114,7 @@ const HitItem* HitItemCollection::item(size_t index) const
//--------------------------------------------------------------------------------------------------
HitItem* HitItemCollection::firstItem()
{
if (m_items.size() > 0)
if (!m_items.empty())
{
return m_items.at(0).p();
}
@ -130,7 +130,7 @@ HitItem* HitItemCollection::firstItem()
//--------------------------------------------------------------------------------------------------
const HitItem* HitItemCollection::firstItem() const
{
if (m_items.size() > 0)
if (!m_items.empty())
{
return m_items.at(0).p();
}

View File

@ -475,7 +475,7 @@ void ModelBasicTreeNode::mergeParts(double maxExtent, uint minimumPrimitiveCount
}
}
if (childrenToBeRemoved.size() > 0)
if (!childrenToBeRemoved.empty())
{
// Remove children from last to first index to make sure the indices are valid
std::vector<ModelBasicTreeNode*>::iterator it;

View File

@ -158,7 +158,7 @@ ref<Rendering> SingleQuadRenderingGenerator::generate()
// sampler->setMinFilter(Sampler::NEAREST);
// sampler->setMagFilter(Sampler::NEAREST);
if (m_textures.size() > 0)
if (!m_textures.empty())
{
// Setup the texture binding render state
ref<RenderStateTextureBindings> textureBindings = new RenderStateTextureBindings;