/usr/include/qgis/qgswkbptr.h is in libqgis-dev 2.14.11+dfsg-3+deb9u1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | /***************************************************************************
qgswkbptr.h
---------------------
begin : January 2014
copyright : (C) 2014 by Juergen E. Fischer
email : jef at norbit dot de
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef QGSWKBPTR_H
#define QGSWKBPTR_H
#include "qgswkbtypes.h"
#include "qgsapplication.h"
#include "qgis.h"
#include "qgsexception.h"
/** \ingroup core
* * Custom exception class for Wkb related exceptions.
* */
class CORE_EXPORT QgsWkbException : public QgsException
{
public:
QgsWkbException( QString const &what ) : QgsException( what ) {}
};
/** \class QgsWkbPtr
* \note not available in Python bindings
*/
class CORE_EXPORT QgsWkbPtr
{
mutable unsigned char *mP;
unsigned char *mStart;
unsigned char *mEnd;
void verifyBound( int size ) const;
template<typename T> void read( T& v ) const
{
verifyBound( sizeof v );
memcpy( &v, mP, sizeof v );
mP += sizeof v;
}
template<typename T> void write( T& v ) const
{
verifyBound( sizeof v );
memcpy( mP, &v, sizeof v );
mP += sizeof v;
}
public:
QgsWkbPtr( unsigned char *p, int size );
inline const QgsWkbPtr &operator>>( double &v ) const { read( v ); return *this; }
inline const QgsWkbPtr &operator>>( float &r ) const { double v; read( v ); r = v; return *this; }
inline const QgsWkbPtr &operator>>( int &v ) const { read( v ); return *this; }
inline const QgsWkbPtr &operator>>( unsigned int &v ) const { read( v ); return *this; }
inline const QgsWkbPtr &operator>>( char &v ) const { read( v ); return *this; }
inline const QgsWkbPtr &operator>>( QgsWKBTypes::Type &v ) const { read( v ); return *this; }
inline const QgsWkbPtr &operator>>( QGis::WkbType &v ) const { read( v ); return *this; }
inline QgsWkbPtr &operator<<( const double &v ) { write( v ); return *this; }
inline QgsWkbPtr &operator<<( const float &r ) { double v = r; write( v ); return *this; }
inline QgsWkbPtr &operator<<( const int &v ) { write( v ); return *this; }
inline QgsWkbPtr &operator<<( const unsigned int &v ) { write( v ); return *this; }
inline QgsWkbPtr &operator<<( const char &v ) { write( v ); return *this; }
inline QgsWkbPtr &operator<<( const QgsWKBTypes::Type &v ) { write( v ); return *this; }
inline QgsWkbPtr &operator<<( const QGis::WkbType &v ) { write( v ); return *this; }
inline void operator+=( int n ) { verifyBound( n ); mP += n; }
inline operator unsigned char *() const { return mP; }
inline int size() const { return mEnd - mStart; }
inline int remaining() const { return mEnd - mP; }
inline int writtenSize() const { return mP - mStart; }
};
/** \class QgsConstWkbPtr
* \note not available in Python bindings
*/
class CORE_EXPORT QgsConstWkbPtr
{
mutable unsigned char *mP;
unsigned char *mEnd;
mutable bool mEndianSwap;
void verifyBound( int size ) const;
template<typename T> void read( T& v ) const
{
verifyBound( sizeof v );
memcpy( &v, mP, sizeof( v ) );
mP += sizeof( v );
if ( mEndianSwap )
QgsApplication::endian_swap( v );
}
public:
QgsConstWkbPtr( const unsigned char *p, int size );
QgsWKBTypes::Type readHeader() const;
inline const QgsConstWkbPtr &operator>>( double &v ) const { read( v ); return *this; }
inline const QgsConstWkbPtr &operator>>( float &r ) const { double v; read( v ); r = v; return *this; }
inline const QgsConstWkbPtr &operator>>( int &v ) const { read( v ); return *this; }
inline const QgsConstWkbPtr &operator>>( unsigned int &v ) const { read( v ); return *this; }
inline const QgsConstWkbPtr &operator>>( char &v ) const { read( v ); return *this; }
inline void operator+=( int n ) { verifyBound( n ); mP += n; }
inline void operator-=( int n ) { mP -= n; }
inline operator const unsigned char *() const { return mP; }
inline int remaining() const { return mEnd - mP; }
};
#endif // QGSWKBPTR_H
|