OGR
|
#include "cpl_config.h"
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <stdarg.h>
#include <string.h>
#include <ctype.h>
#include <limits.h>
#include <time.h>
#include <errno.h>
#include <locale.h>
#include <strings.h>
Go to the source code of this file.
Macros | |
#define | GINTBIG_MIN ((GIntBig)(0x80000000) << 32) |
#define | GINTBIG_MAX (((GIntBig)(0x7FFFFFFF) << 32) | 0xFFFFFFFFU) |
#define | GUINTBIG_MAX (((GUIntBig)(0xFFFFFFFFU) << 32) | 0xFFFFFFFFU) |
#define | GINT64_MIN GINTBIG_MIN |
#define | GINT64_MAX GINTBIG_MAX |
#define | GUINT64_MAX GUINTBIG_MAX |
#define | CPL_FRMT_GB_WITHOUT_PREFIX "ll" |
#define | CPL_FRMT_GIB "%" CPL_FRMT_GB_WITHOUT_PREFIX "d" |
#define | CPL_FRMT_GUIB "%" CPL_FRMT_GB_WITHOUT_PREFIX "u" |
#define | CPL_C_START extern "C" { |
#define | CPL_C_END } |
#define | MIN(a, b) (((a)<(b)) ? (a) : (b)) |
#define | MAX(a, b) (((a)>(b)) ? (a) : (b)) |
#define | ABS(x) (((x)<0) ? (-1*(x)) : (x)) |
#define | M_PI 3.14159265358979323846 |
#define | STRCASECMP(a, b) (strcasecmp(a,b)) |
#define | STRNCASECMP(a, b, n) (strncasecmp(a,b,n)) |
#define | EQUALN(a, b, n) (STRNCASECMP(a,b,n)==0) |
#define | EQUAL(a, b) (STRCASECMP(a,b)==0) |
#define | STARTS_WITH(a, b) (strncmp(a,b,strlen(b)) == 0) |
#define | STARTS_WITH_CI(a, b) EQUALN(a,b,strlen(b)) |
#define | CPL_SWAP16(x) ((GUInt16)( ((GUInt16)(x) << 8) | ((GUInt16)(x) >> 8) )) |
#define | CPL_SWAP32(x) |
#define | CPL_SWAP64(x) |
#define | CPL_SWAP16PTR(x) |
#define | CPL_SWAP32PTR(x) |
#define | CPL_SWAP64PTR(x) |
#define | CPL_SWAPDOUBLE(p) CPL_SWAP64PTR(p) |
#define | CPL_LSBWORD16(x) (x) |
#define | CPL_MSBWORD16(x) CPL_SWAP16(x) |
#define | CPL_LSBWORD32(x) (x) |
#define | CPL_MSBWORD32(x) CPL_SWAP32(x) |
#define | CPL_LSBPTR16(x) CPL_STATIC_ASSERT_IF_AVAILABLE(sizeof(*(x)) == 1 || sizeof(*(x)) == 2) |
#define | CPL_MSBPTR16(x) CPL_SWAP16PTR(x) |
#define | CPL_LSBPTR32(x) CPL_STATIC_ASSERT_IF_AVAILABLE(sizeof(*(x)) == 1 || sizeof(*(x)) == 4) |
#define | CPL_MSBPTR32(x) CPL_SWAP32PTR(x) |
#define | CPL_LSBPTR64(x) CPL_STATIC_ASSERT_IF_AVAILABLE(sizeof(*(x)) == 1 || sizeof(*(x)) == 8) |
#define | CPL_MSBPTR64(x) CPL_SWAP64PTR(x) |
#define | CPL_LSBINT16PTR(x) ((*(GByte*)(x)) | (*(((GByte*)(x))+1) << 8)) |
#define | CPL_LSBINT32PTR(x) |
#define | CPL_LSBSINT16PTR(x) ((GInt16) CPL_LSBINT16PTR(x)) |
#define | CPL_LSBUINT16PTR(x) ((GUInt16)CPL_LSBINT16PTR(x)) |
#define | CPL_LSBSINT32PTR(x) ((GInt32) CPL_LSBINT32PTR(x)) |
#define | CPL_LSBUINT32PTR(x) ((GUInt32)CPL_LSBINT32PTR(x)) |
#define | CPL_NULL_TERMINATED |
#define | CPL_PRINT_FUNC_FORMAT(format_idx, arg_idx) |
#define | CPL_SCAN_FUNC_FORMAT(format_idx, arg_idx) |
#define | CPL_FORMAT_STRING(arg) arg |
#define | CPL_SCANF_FORMAT_STRING(arg) arg |
#define | CPL_WARN_UNUSED_RESULT |
#define | CPL_UNUSED |
#define | CPL_NO_RETURN |
#define | CPL_RETURNS_NONNULL |
#define | CPL_RESTRICT |
#define | CPL_OVERRIDE |
#define | CPL_FINAL |
#define | CPL_DISALLOW_COPY_ASSIGN(ClassName) |
#define | CPL_ARRAYSIZE(array) |
#define | CPL_FALLTHROUGH |
Typedefs | |
typedef int | GInt32 |
typedef unsigned int | GUInt32 |
typedef short | GInt16 |
typedef unsigned short | GUInt16 |
typedef unsigned char | GByte |
typedef int | GBool |
typedef long long | GIntBig |
typedef unsigned long long | GUIntBig |
typedef GIntBig | GInt64 |
typedef GUIntBig | GUInt64 |
typedef GIntBig | GPtrDiff_t |
Core portability definitions for CPL.
#define ABS | ( | x | ) | (((x)<0) ? (-1*(x)) : (x)) |
Macro to compute the absolute value
#define CPL_ARRAYSIZE | ( | array | ) |
Returns the size of C style arrays.
Referenced by OGRSpatialReference::importFromProj4().
#define CPL_C_END } |
Macro to end a block of C symbols
#define CPL_C_START extern "C" { |
Macro to start a block of C symbols
#define CPL_DISALLOW_COPY_ASSIGN | ( | ClassName | ) |
Helper to remove the copy and assignment constructors so that the compiler will not generate the default versions.
Must be placed in the private section of a class and should be at the end.
#define CPL_FALLTHROUGH |
Macro for fallthrough in a switch case construct
#define CPL_FINAL |
C++11 final qualifier
#define CPL_FORMAT_STRING | ( | arg | ) | arg |
Macro into which to wrap the format argument of a printf-like function
#define CPL_FRMT_GB_WITHOUT_PREFIX "ll" |
Printf formatting suffix for GIntBig
#define CPL_FRMT_GIB "%" CPL_FRMT_GB_WITHOUT_PREFIX "d" |
Printf formatting for GIntBig
Referenced by OGRFeature::DumpReadable(), OGRFeature::GetFieldAsString(), OGRFeature::SetField(), VSICalloc(), VSIIngestFile(), and VSIRealloc().
#define CPL_FRMT_GUIB "%" CPL_FRMT_GB_WITHOUT_PREFIX "u" |
Printf formatting for GUIntBig
Referenced by CPLVirtualMemFileMapNew(), VSICalloc(), VSIMallocAlignedAutoVerbose(), and VSIRealloc().
Return a Int16 from the 2 bytes ordered in LSB order at address x.
#define CPL_LSBINT32PTR | ( | x | ) |
Return a Int32 from the 4 bytes ordered in LSB order at address x.
#define CPL_LSBPTR16 | ( | x | ) | CPL_STATIC_ASSERT_IF_AVAILABLE(sizeof(*(x)) == 1 || sizeof(*(x)) == 2) |
Byte-swap if necessary a 16bit word at the location pointed from a originally LSB ordered pointer
#define CPL_LSBPTR32 | ( | x | ) | CPL_STATIC_ASSERT_IF_AVAILABLE(sizeof(*(x)) == 1 || sizeof(*(x)) == 4) |
Byte-swap if necessary a 32bit word at the location pointed from a originally LSB ordered pointer
#define CPL_LSBPTR64 | ( | x | ) | CPL_STATIC_ASSERT_IF_AVAILABLE(sizeof(*(x)) == 1 || sizeof(*(x)) == 8) |
Byte-swap if necessary a 64bit word at the location pointed from a originally LSB ordered pointer
#define CPL_LSBSINT16PTR | ( | x | ) | ((GInt16) CPL_LSBINT16PTR(x)) |
Return a signed Int16 from the 2 bytes ordered in LSB order at address x
#define CPL_LSBSINT32PTR | ( | x | ) | ((GInt32) CPL_LSBINT32PTR(x)) |
Return a signed Int32 from the 4 bytes ordered in LSB order at address x
#define CPL_LSBUINT16PTR | ( | x | ) | ((GUInt16)CPL_LSBINT16PTR(x)) |
Return a unsigned Int16 from the 2 bytes ordered in LSB order at address x
#define CPL_LSBUINT32PTR | ( | x | ) | ((GUInt32)CPL_LSBINT32PTR(x)) |
Return a unsigned Int32 from the 4 bytes ordered in LSB order at address x
#define CPL_LSBWORD16 | ( | x | ) | (x) |
Return a 16bit word from a originally LSB ordered word
#define CPL_LSBWORD32 | ( | x | ) | (x) |
Return a 32bit word from a originally LSB ordered word
Referenced by OGRPoint::exportToWkb(), and OGRSimpleCurve::exportToWkb().
#define CPL_MSBPTR16 | ( | x | ) | CPL_SWAP16PTR(x) |
Byte-swap if necessary a 16bit word at the location pointed from a originally MSB ordered pointer
#define CPL_MSBPTR32 | ( | x | ) | CPL_SWAP32PTR(x) |
Byte-swap if necessary a 32bit word at the location pointed from a originally MSB ordered pointer
#define CPL_MSBPTR64 | ( | x | ) | CPL_SWAP64PTR(x) |
Byte-swap if necessary a 64bit word at the location pointed from a originally MSB ordered pointer
#define CPL_MSBWORD16 | ( | x | ) | CPL_SWAP16(x) |
Return a 16bit word from a originally MSB ordered word
#define CPL_MSBWORD32 | ( | x | ) | CPL_SWAP32(x) |
Return a 32bit word from a originally MSB ordered word
Referenced by OGRPoint::exportToWkb(), and OGRSimpleCurve::exportToWkb().
#define CPL_NO_RETURN |
Qualifier for a function that does not return at all (terminates the process)
#define CPL_NULL_TERMINATED |
Null terminated variadic
#define CPL_OVERRIDE |
To be used in public headers only. For non-public headers or .cpp files, use override directly.
#define CPL_PRINT_FUNC_FORMAT | ( | format_idx, | |
arg_idx | |||
) |
Tag a function to have printf() formatting
#define CPL_RESTRICT |
restrict keyword to declare that pointers do not alias
#define CPL_RETURNS_NONNULL |
Qualifier for a function that does not return NULL
#define CPL_SCAN_FUNC_FORMAT | ( | format_idx, | |
arg_idx | |||
) |
Tag a function to have scanf() formatting
#define CPL_SCANF_FORMAT_STRING | ( | arg | ) | arg |
Macro into which to wrap the format argument of a sscanf-like function.
Byte-swap a 16bit unsigned integer
#define CPL_SWAP16PTR | ( | x | ) |
#define CPL_SWAP32 | ( | x | ) |
Byte-swap a 32bit unsigned integer
Referenced by OGRSimpleCurve::exportToWkb(), OGRPolygon::exportToWkb(), OGRGeometryCollection::exportToWkb(), and OGRPolyhedralSurface::exportToWkb().
#define CPL_SWAP32PTR | ( | x | ) |
Byte-swap a 32 bit pointer
#define CPL_SWAP64 | ( | x | ) |
Byte-swap a 64bit unsigned integer
#define CPL_SWAP64PTR | ( | x | ) |
Byte-swap a 64 bit pointer
Referenced by OGRSimpleCurve::exportToWkb().
#define CPL_SWAPDOUBLE | ( | p | ) | CPL_SWAP64PTR(p) |
Byte-swap a 64 bit pointer
Referenced by OGRPoint::exportToWkb(), OGRPoint::importFromWkb(), and OGRSimpleCurve::importFromWkb().
#define CPL_UNUSED |
Qualifier for an argument that is unused
Referenced by CPLODBCDriverInstaller::InstallDriver().
#define CPL_WARN_UNUSED_RESULT |
Qualifier to warn when the return value of a function is not used
#define EQUAL | ( | a, | |
b | |||
) | (STRCASECMP(a,b)==0) |
Alias for strcasecmp() == 0
Referenced by OGRTriangulatedSurface::addGeometry(), OGR_SRSNode::applyRemapper(), OGRSpatialReference::AutoIdentifyEPSG(), OGRSpatialReference::CopyGeogCSFrom(), CPLCheckForFile(), CPLCopyTree(), CPLCorrespondingPaths(), CPLDebug(), CPLDecToDMS(), CPLEncodingCharSize(), CPLErrorV(), CPLExtractRelativePath(), CPLGetXMLNode(), CPLLoggingErrorHandler(), CPLOpenShared(), CPLParseXMLString(), CPLPrintTime(), CPLRecode(), CPLRecodeFromWChar(), CPLRecodeToWChar(), CPLSearchXMLNode(), CPLSetXMLValue(), CPLTestBool(), CPLUnlinkTree(), CSLFindString(), OGRGeometryFactory::curveToLineString(), OGRGeometry::dumpReadable(), OGRFeature::DumpReadable(), OGRSpatialReference::EPSGTreatsAsLatLong(), OGRSpatialReference::EPSGTreatsAsNorthingEasting(), OGRSpatialReference::exportToERM(), OGRSpatialReference::exportToPanorama(), OGRSpatialReference::exportToPCI(), OGRSpatialReference::exportToProj4(), OGRSpatialReference::exportToUSGS(), OGR_SRSNode::FindChild(), OGRSpatialReference::FindProjParm(), OGR_SRSNode::FixupOrdering(), OGRSpatialReference::GetAngularUnits(), OGRSpatialReference::GetAxis(), CPLODBCStatement::GetColId(), OGRSpatialReference::GetEPSGGeogCS(), OGRSpatialReference::GetExtension(), OGRFeatureDefn::GetFieldIndex(), OGRFeatureDefn::GetGeomFieldIndex(), OGR_SRSNode::GetNode(), OGRStyleTable::GetStyleName(), OGRSpatialReference::GetTargetLinearUnits(), OGRSpatialReference::GetUTMZone(), OGRSpatialReference::importFromERM(), OGRSpatialReference::importFromESRI(), OGRSpatialReference::ImportFromESRIStatePlaneWKT(), OGRSpatialReference::ImportFromESRIWisconsinWKT(), OGRSpatialReference::importFromOzi(), OGRSpatialReference::importFromPCI(), OGRSpatialReference::importFromProj4(), OGRMultiSurface::importFromWkt(), OGRPolyhedralSurface::importFromWkt(), OGRMultiPoint::importFromWkt(), OGRSpatialReference::importFromXML(), OGRSpatialReference::IsAngularParameter(), OGRSpatialReference::IsCompound(), OGRFieldDefn::IsDefaultDriverSpecific(), OGRSpatialReference::IsGeocentric(), OGRSpatialReference::IsGeographic(), OGRSpatialReference::IsLinearParameter(), OGRSpatialReference::IsLocal(), OGRSpatialReference::IsLongitudeParameter(), OGRSpatialReference::IsProjected(), OGRSpatialReference::IsSame(), OGRSpatialReference::IsSameGeogCS(), OGRSpatialReference::IsSameVertCS(), OGRSpatialReference::IsVertical(), OGRSpatialReference::morphFromESRI(), OGRSpatialReference::morphToESRI(), OGR_G_ExportToGMLEx(), OGRGeocode(), OGRGeocodeCreateSession(), OGRGeocodeReverse(), OPTGetParameterList(), OPTGetProjectionMethods(), OGRGeometryFactory::organizePolygons(), OGRGeometry::Polygonize(), OGRCurvePolygon::segmentize(), OGRSpatialReference::SetExtension(), OGRSpatialReference::SetFromUserInput(), OGRSpatialReference::SetGeocCS(), OGRSpatialReference::SetGeogCS(), OGRLayer::SetIgnoredFields(), OGRSpatialReference::SetLinearUnitsAndUpdateParameters(), OGRSpatialReference::SetNode(), OGRSpatialReference::SetProjCS(), OGRSpatialReference::SetProjection(), OGRSpatialReference::SetProjParm(), OGRSpatialReference::SetUTM(), OGRSpatialReference::SetVertCS(), OGRSpatialReference::SetWellKnownGeogCS(), OGRSpatialReference::StripCTParms(), OGRSpatialReference::StripVertical(), and VSIReadDirRecursive().
#define EQUALN | ( | a, | |
b, | |||
n | |||
) | (STRNCASECMP(a,b,n)==0) |
Alias for strncasecmp() == 0
Referenced by CPLCorrespondingPaths(), CPLDebug(), CPLExtractRelativePath(), CPLStripXMLNamespace(), CSLFetchNameValue(), CSLFetchNameValueMultiple(), CSLFindName(), CSLSetNameValue(), CPLStringList::FindName(), CPLString::ifind(), OGRSpatialReference::importFromDict(), OGRSpatialReference::importFromPCI(), and OGRSpatialReference::morphToESRI().
#define GINT64_MAX GINTBIG_MAX |
Maximum GInt64 value
#define GINT64_MIN GINTBIG_MIN |
Minimum GInt64 value
#define GINTBIG_MAX (((GIntBig)(0x7FFFFFFF) << 32) | 0xFFFFFFFFU) |
Maximum GIntBig value
Referenced by CPLAtoGIntBigEx().
#define GINTBIG_MIN ((GIntBig)(0x80000000) << 32) |
Minimum GIntBig value
Referenced by CPLAtoGIntBigEx().
#define GUINT64_MAX GUINTBIG_MAX |
Minimum GUInt64 value
#define GUINTBIG_MAX (((GUIntBig)(0xFFFFFFFFU) << 32) | 0xFFFFFFFFU) |
Maximum GUIntBig value
#define M_PI 3.14159265358979323846 |
#define MAX | ( | a, | |
b | |||
) | (((a)>(b)) ? (a) : (b)) |
Macro to compute the maximum of 2 values
Referenced by OGRFieldDefn::SetWidth().
#define MIN | ( | a, | |
b | |||
) | (((a)<(b)) ? (a) : (b)) |
Macro to compute the minimum of 2 values
#define STARTS_WITH | ( | a, | |
b | |||
) | (strncmp(a,b,strlen(b)) == 0) |
Returns whether a starts with b
Referenced by CPLFormFilename(), CPLHTTPFetch(), CPLHTTPParseMultipartMime(), CPLIsFilenameRelative(), CPLProjectRelativeFilename(), CPLStrtodDelim(), and OGRSpatialReference::importFromURN().
#define STARTS_WITH_CI | ( | a, | |
b | |||
) | EQUALN(a,b,strlen(b)) |
Returns whether a starts with b (case insensitive comparison)
Referenced by CPLEncodingCharSize(), CPLExpandTilde(), CPLPrintPointer(), CPLScanPointer(), CPLStrtodDelim(), CPLUnescapeString(), OGRGeometryFactory::createFromWkt(), OGRSpatialReference::exportToPCI(), OGRPolygon::exportToWkt(), OGRFeature::FillUnsetWithDefault(), OGRSpatialReference::importFromCRSURL(), OGRSpatialReference::importFromDict(), OGRSpatialReference::importFromERM(), OGRSpatialReference::importFromESRI(), OGRSpatialReference::ImportFromESRIWisconsinWKT(), OGRSpatialReference::importFromOzi(), OGRSpatialReference::importFromPCI(), OGRSpatialReference::importFromProj4(), OGRSpatialReference::importFromUrl(), OGRSpatialReference::importFromURN(), OGRSpatialReference::importFromWMSAUTO(), OGRSpatialReference::IsAngularParameter(), OGRSpatialReference::IsLinearParameter(), OGRSpatialReference::IsLongitudeParameter(), OGRSpatialReference::morphFromESRI(), OGRSpatialReference::morphToESRI(), OGRFromOGCGeomType(), OGRGeocodeCreateSession(), OGRSpatialReference::SetFromUserInput(), and OGRSpatialReference::SetWellKnownGeogCS().
#define STRCASECMP | ( | a, | |
b | |||
) | (strcasecmp(a,b)) |
Alias for strcasecmp()
#define STRNCASECMP | ( | a, | |
b, | |||
n | |||
) | (strncasecmp(a,b,n)) |
Alias for strncasecmp()
typedef int GBool |
Type for boolean values (alias to int)
typedef unsigned char GByte |
Unsigned byte type
typedef short GInt16 |
Int16 type
typedef int GInt32 |
Int32 type
typedef long long GIntBig |
Large signed integer type (generally 64-bit integer type). Use GInt64 when exactly 64 bit is needed
typedef GIntBig GPtrDiff_t |
Integer type large enough to hold the difference between 2 addresses
typedef unsigned short GUInt16 |
Unsigned int16 type
typedef unsigned int GUInt32 |
Unsigned int32 type
typedef unsigned long long GUIntBig |
Large unsigned integer type (generally 64-bit unsigned integer type). Use GUInt64 when exactly 64 bit is needed