fix indentation

This commit is contained in:
vcloarec 2023-05-24 09:36:23 -04:00 committed by Nyall Dawson
parent 2e0b29936c
commit fcc8a5cc3f
3 changed files with 23 additions and 21 deletions

View File

@ -79,7 +79,7 @@ namespace libply
virtual IProperty &operator=( unsigned char value ) = 0;
virtual IProperty &operator=( char value ) = 0;
virtual IProperty &operator=( unsigned short value ) = 0;
virtual IProperty &operator=( short value) = 0;
virtual IProperty &operator=( short value ) = 0;
virtual IProperty &operator=( unsigned int value ) = 0;
virtual IProperty &operator=( int value ) = 0;
virtual IProperty &operator=( float value ) = 0;
@ -105,7 +105,7 @@ namespace libply
virtual ~ScalarProperty() = default;
virtual ScalarProperty &operator= ( unsigned char value) override
virtual ScalarProperty &operator= ( unsigned char value ) override
{
m_value = static_cast<InternalType>( value );
return *this;
@ -115,7 +115,7 @@ namespace libply
m_value = static_cast<InternalType>( value );
return *this;
};
virtual ScalarProperty &operator= ( unsigned short value) override
virtual ScalarProperty &operator= ( unsigned short value ) override
{
m_value = static_cast<InternalType>( value );
return *this;

View File

@ -76,7 +76,7 @@ namespace libply
std::string File::format() const
{
return formatString(m_parser->format);
return formatString( m_parser->format );
}
@ -381,10 +381,11 @@ namespace libply
for ( PropertyDefinition p : properties )
{
uint32_t endian;
if ( format == File::Format::BINARY_LITTLE_ENDIAN)
if ( format == File::Format::BINARY_LITTLE_ENDIAN )
{
endian = LITTLE_ENDIAN;
} else
}
else
{
endian = BIG_ENDIAN;
}
@ -581,7 +582,8 @@ namespace libply
if ( format == File::Format::BINARY_LITTLE_ENDIAN )
{
endian = LITTLE_ENDIAN;
} else
}
else
{
endian = BIG_ENDIAN;
}
@ -662,7 +664,7 @@ namespace libply
file << "ply" << std::endl;
file << "format " << formatString( m_format ) << " 1.0" << std::endl;
file << "obj_info Generated by MDAL" << std::endl;
for( const std::pair<const std::string, std::string>& item : metadata )
for ( const std::pair<const std::string, std::string> &item : metadata )
{
file << "comment " << item.first << ": " << item.second << std::endl;
}

View File

@ -108,24 +108,24 @@ namespace libply
};
template <typename T>
T endian_convert(T w, uint32_t endian)
T endian_convert( T w, uint32_t endian )
{
// This gets optimized out into if (endian == host_endian) return w;
union { uint64_t quad; uint32_t islittle; } t;
t.quad = 1;
if (t.islittle ^ endian) return w;
if ( t.islittle ^ endian ) return w;
auto ptr = reinterpret_cast<std::uint8_t*>(&w);
std::array<std::uint8_t, sizeof(T)> raw_src, raw_dst;
auto ptr = reinterpret_cast<std::uint8_t *>( &w );
std::array<std::uint8_t, sizeof( T )> raw_src, raw_dst;
for(std::size_t i = 0; i < sizeof(T); ++i)
for ( std::size_t i = 0; i < sizeof( T ); ++i )
raw_src[i] = ptr[i];
std::reverse_copy(raw_src.begin(), raw_src.end(), raw_dst.begin());
std::reverse_copy( raw_src.begin(), raw_src.end(), raw_dst.begin() );
for(std::size_t i = 0; i < sizeof(T); ++i)
for ( std::size_t i = 0; i < sizeof( T ); ++i )
ptr[i] = raw_dst[i];
return *reinterpret_cast<T*>(ptr);
return *reinterpret_cast<T *>( ptr );
};
/// Type conversion functions.
@ -244,7 +244,7 @@ namespace libply
inline std::stringstream &write_convert_DOUBLE( IProperty &property, std::stringstream &ss )
{
ss << MDAL::doubleToString( static_cast<double>( property ), 12);
ss << MDAL::doubleToString( static_cast<double>( property ), 12 );
return ss;
}