Skip to content

Commit

Permalink
Fix sip build
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Nov 9, 2020
1 parent 00b9da6 commit 8d54dc8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
Expand Up @@ -46,7 +46,7 @@ Ctor
Returns name of the attribute Returns name of the attribute
%End %End


size_t size() const; int size() const;
%Docstring %Docstring
Returns size of the attribute in bytes Returns size of the attribute in bytes
%End %End
Expand Down Expand Up @@ -133,7 +133,7 @@ Returns the index of the attribute with the specified ``name``.
Returns -1 if a matching attribute was not found. Returns -1 if a matching attribute was not found.
%End %End


size_t pointRecordSize() const; int pointRecordSize() const;
%Docstring %Docstring
Returns total size of record Returns total size of record
%End %End
Expand Down
12 changes: 6 additions & 6 deletions src/core/pointcloud/qgspointcloudattribute.h
Expand Up @@ -53,7 +53,7 @@ class CORE_EXPORT QgsPointCloudAttribute
QString name() const { return mName; } QString name() const { return mName; }


//! Returns size of the attribute in bytes //! Returns size of the attribute in bytes
size_t size() const { return mSize; } int size() const { return mSize; }


//! Returns the data type //! Returns the data type
DataType type() const { return mType; } DataType type() const { return mType; }
Expand Down Expand Up @@ -84,7 +84,7 @@ class CORE_EXPORT QgsPointCloudAttribute
void updateSize(); void updateSize();


QString mName; QString mName;
size_t mSize = 0; int mSize = 0;
DataType mType; DataType mType;
}; };


Expand Down Expand Up @@ -133,17 +133,17 @@ class CORE_EXPORT QgsPointCloudAttributeCollection
int indexOf( const QString &name ) const; int indexOf( const QString &name ) const;


//! Returns total size of record //! Returns total size of record
size_t pointRecordSize() const { return mSize; } int pointRecordSize() const { return mSize; }


private: private:
std::size_t mSize = 0; int mSize = 0;
QVector<QgsPointCloudAttribute> mAttributes; QVector<QgsPointCloudAttribute> mAttributes;


struct CachedAttributeData struct CachedAttributeData
{ {
int index; int index;
std::size_t offset; int offset;
CachedAttributeData( int index, std::size_t offset ) CachedAttributeData( int index, int offset )
: index( index ) : index( index )
, offset( offset ) , offset( offset )
{} {}
Expand Down
12 changes: 6 additions & 6 deletions tests/src/core/testqgspointcloudattribute.cpp
Expand Up @@ -79,7 +79,7 @@ void TestQgsPointCloudAttribute::testAttribute()
QgsPointCloudAttribute attribute( QStringLiteral( "name" ), QgsPointCloudAttribute::DataType::Float ); QgsPointCloudAttribute attribute( QStringLiteral( "name" ), QgsPointCloudAttribute::DataType::Float );
QCOMPARE( attribute.name(), QStringLiteral( "name" ) ); QCOMPARE( attribute.name(), QStringLiteral( "name" ) );
QCOMPARE( attribute.type(), QgsPointCloudAttribute::DataType::Float ); QCOMPARE( attribute.type(), QgsPointCloudAttribute::DataType::Float );
QCOMPARE( attribute.size(), static_cast< std::size_t >( 4 ) ); QCOMPARE( attribute.size(), 4 );
} }


void TestQgsPointCloudAttribute::testAttributeDisplayType() void TestQgsPointCloudAttribute::testAttributeDisplayType()
Expand All @@ -106,7 +106,7 @@ void TestQgsPointCloudAttribute::testCollection()
QgsPointCloudAttributeCollection collection; QgsPointCloudAttributeCollection collection;
QVERIFY( collection.attributes().empty() ); QVERIFY( collection.attributes().empty() );
QCOMPARE( collection.count(), 0 ); QCOMPARE( collection.count(), 0 );
QCOMPARE( collection.pointRecordSize(), static_cast< std::size_t >( 0 ) ); QCOMPARE( collection.pointRecordSize(), 0 );
int offset = 0; int offset = 0;
QVERIFY( !collection.find( QStringLiteral( "test" ), offset ) ); QVERIFY( !collection.find( QStringLiteral( "test" ), offset ) );


Expand All @@ -115,7 +115,7 @@ void TestQgsPointCloudAttribute::testCollection()
QCOMPARE( collection.count(), 1 ); QCOMPARE( collection.count(), 1 );
QCOMPARE( collection.at( 0 ).name(), QStringLiteral( "at1" ) ); QCOMPARE( collection.at( 0 ).name(), QStringLiteral( "at1" ) );
QCOMPARE( collection.attributes().at( 0 ).name(), QStringLiteral( "at1" ) ); QCOMPARE( collection.attributes().at( 0 ).name(), QStringLiteral( "at1" ) );
QCOMPARE( collection.pointRecordSize(), static_cast< std::size_t >( 4 ) ); QCOMPARE( collection.pointRecordSize(), 4 );
QVERIFY( !collection.find( QStringLiteral( "test" ), offset ) ); QVERIFY( !collection.find( QStringLiteral( "test" ), offset ) );
QCOMPARE( collection.find( QStringLiteral( "at1" ), offset )->name(), QStringLiteral( "at1" ) ); QCOMPARE( collection.find( QStringLiteral( "at1" ), offset )->name(), QStringLiteral( "at1" ) );
QCOMPARE( collection.indexOf( QStringLiteral( "test" ) ), -1 ); QCOMPARE( collection.indexOf( QStringLiteral( "test" ) ), -1 );
Expand All @@ -129,7 +129,7 @@ void TestQgsPointCloudAttribute::testCollection()
QCOMPARE( collection.at( 1 ).name(), QStringLiteral( "at2" ) ); QCOMPARE( collection.at( 1 ).name(), QStringLiteral( "at2" ) );
QCOMPARE( collection.attributes().at( 0 ).name(), QStringLiteral( "at1" ) ); QCOMPARE( collection.attributes().at( 0 ).name(), QStringLiteral( "at1" ) );
QCOMPARE( collection.attributes().at( 1 ).name(), QStringLiteral( "at2" ) ); QCOMPARE( collection.attributes().at( 1 ).name(), QStringLiteral( "at2" ) );
QCOMPARE( collection.pointRecordSize(), static_cast< std::size_t >( 6 ) ); QCOMPARE( collection.pointRecordSize(), 6 );
QVERIFY( !collection.find( QStringLiteral( "test" ), offset ) ); QVERIFY( !collection.find( QStringLiteral( "test" ), offset ) );
QCOMPARE( collection.find( QStringLiteral( "at1" ), offset )->name(), QStringLiteral( "at1" ) ); QCOMPARE( collection.find( QStringLiteral( "at1" ), offset )->name(), QStringLiteral( "at1" ) );
QCOMPARE( offset, 0 ); QCOMPARE( offset, 0 );
Expand All @@ -145,7 +145,7 @@ void TestQgsPointCloudAttribute::testCollection()
QCOMPARE( collection.attributes().at( 0 ).name(), QStringLiteral( "at1" ) ); QCOMPARE( collection.attributes().at( 0 ).name(), QStringLiteral( "at1" ) );
QCOMPARE( collection.attributes().at( 1 ).name(), QStringLiteral( "at2" ) ); QCOMPARE( collection.attributes().at( 1 ).name(), QStringLiteral( "at2" ) );
QCOMPARE( collection.attributes().at( 2 ).name(), QStringLiteral( "at3" ) ); QCOMPARE( collection.attributes().at( 2 ).name(), QStringLiteral( "at3" ) );
QCOMPARE( collection.pointRecordSize(), static_cast< std::size_t >( 14 ) ); QCOMPARE( collection.pointRecordSize(), 14 );
QVERIFY( !collection.find( QStringLiteral( "test" ), offset ) ); QVERIFY( !collection.find( QStringLiteral( "test" ), offset ) );
QCOMPARE( collection.find( QStringLiteral( "at1" ), offset )->name(), QStringLiteral( "at1" ) ); QCOMPARE( collection.find( QStringLiteral( "at1" ), offset )->name(), QStringLiteral( "at1" ) );
QCOMPARE( offset, 0 ); QCOMPARE( offset, 0 );
Expand All @@ -164,7 +164,7 @@ void TestQgsPointCloudAttribute::testCollection()
QCOMPARE( collection2.attributes().at( 0 ).name(), QStringLiteral( "at1" ) ); QCOMPARE( collection2.attributes().at( 0 ).name(), QStringLiteral( "at1" ) );
QCOMPARE( collection2.attributes().at( 1 ).name(), QStringLiteral( "at2" ) ); QCOMPARE( collection2.attributes().at( 1 ).name(), QStringLiteral( "at2" ) );
QCOMPARE( collection2.attributes().at( 2 ).name(), QStringLiteral( "at3" ) ); QCOMPARE( collection2.attributes().at( 2 ).name(), QStringLiteral( "at3" ) );
QCOMPARE( collection2.pointRecordSize(), static_cast< std::size_t >( 14 ) ); QCOMPARE( collection2.pointRecordSize(), 14 );
QVERIFY( !collection2.find( QStringLiteral( "test" ), offset ) ); QVERIFY( !collection2.find( QStringLiteral( "test" ), offset ) );
QCOMPARE( collection2.find( QStringLiteral( "at1" ), offset )->name(), QStringLiteral( "at1" ) ); QCOMPARE( collection2.find( QStringLiteral( "at1" ), offset )->name(), QStringLiteral( "at1" ) );
QCOMPARE( offset, 0 ); QCOMPARE( offset, 0 );
Expand Down

0 comments on commit 8d54dc8

Please sign in to comment.