QGIS API Documentation  3.0.2-Girona (307d082)
Functions | Variables
qgis.cpp File Reference
#include "qgis.h"
#include "qgsversion.h"
#include <QCoreApplication>
#include <QColor>
#include <QDate>
#include <QTime>
#include <QLocale>
#include <QDateTime>
#include "qgsconfig.h"
#include "qgslogger.h"
#include "qgswkbtypes.h"
#include <ogr_api.h>
Include dependency graph for qgis.cpp:

Go to the source code of this file.

Functions

void * qgsCalloc (size_t nmemb, size_t size)
 Allocates memory for an array of nmemb elements of size bytes each and returns a pointer to the allocated memory. More...
 
void qgsFree (void *ptr)
 Frees the memory space pointed to by ptr. More...
 
void * qgsMalloc (size_t size)
 Allocates size bytes and returns a pointer to the allocated memory. More...
 
double qgsPermissiveToDouble (QString string, bool &ok)
 Converts a string to a double in a permissive way, e.g., allowing for incorrect numbers of digits between thousand separators. More...
 
int qgsPermissiveToInt (QString string, bool &ok)
 Converts a string to an integer in a permissive way, e.g., allowing for incorrect numbers of digits between thousand separators. More...
 
bool qgsVariantGreaterThan (const QVariant &lhs, const QVariant &rhs)
 Compares two QVariant values and returns whether the first is greater than the second. More...
 
bool qgsVariantLessThan (const QVariant &lhs, const QVariant &rhs)
 Compares two QVariant values and returns whether the first is less than the second. More...
 
QString qgsVsiPrefix (const QString &path)
 
uint qHash (const QVariant &variant)
 Hash for QVariant. More...
 

Variables

const QString GEO_EPSG_CRS_AUTHID = QStringLiteral( "EPSG:4326" )
 Geographic coord sys from EPSG authority. More...
 
const QString GEO_NONE = QStringLiteral( "NONE" )
 Constant that holds the string representation for "No ellips/No CRS". More...
 
const QString GEOPROJ4 = QStringLiteral( "+proj=longlat +datum=WGS84 +no_defs" )
 PROJ4 string that represents a geographic coord sys. More...
 
const QString GEOWKT
 Wkt string that represents a geographic coord sys. More...
 
const QString PROJECT_SCALES
 

Function Documentation

◆ qgsCalloc()

void* qgsCalloc ( size_t  nmemb,
size_t  size 
)

Allocates memory for an array of nmemb elements of size bytes each and returns a pointer to the allocated memory.

Works like C calloc() but prints debug message by QgsLogger if allocation fails.

Parameters
nmembnumber of elements
sizesize of element in bytes

Definition at line 126 of file qgis.cpp.

◆ qgsFree()

void qgsFree ( void *  ptr)

Frees the memory space pointed to by ptr.

Works like C free().

Parameters
ptrpointer to memory space

Definition at line 141 of file qgis.cpp.

◆ qgsMalloc()

void* qgsMalloc ( size_t  size)

Allocates size bytes and returns a pointer to the allocated memory.

Works like C malloc() but prints debug message by QgsLogger if allocation fails.

Parameters
sizesize in bytes

Definition at line 111 of file qgis.cpp.

◆ qgsPermissiveToDouble()

double qgsPermissiveToDouble ( QString  string,
bool &  ok 
)

Converts a string to a double in a permissive way, e.g., allowing for incorrect numbers of digits between thousand separators.

Parameters
stringstring to convert
okwill be set to true if conversion was successful
Returns
string converted to double if possible
Since
QGIS 2.9
See also
permissiveToInt

Definition at line 97 of file qgis.cpp.

◆ qgsPermissiveToInt()

int qgsPermissiveToInt ( QString  string,
bool &  ok 
)

Converts a string to an integer in a permissive way, e.g., allowing for incorrect numbers of digits between thousand separators.

Parameters
stringstring to convert
okwill be set to true if conversion was successful
Returns
string converted to int if possible
Since
QGIS 2.9
See also
permissiveToDouble

Definition at line 104 of file qgis.cpp.

◆ qgsVariantGreaterThan()

bool qgsVariantGreaterThan ( const QVariant &  lhs,
const QVariant &  rhs 
)

Compares two QVariant values and returns whether the first is greater than the second.

Useful for sorting lists of variants, correctly handling sorting of the various QVariant data types (such as strings, numeric values, dates and times)

See also
qgsVariantLessThan()

Definition at line 214 of file qgis.cpp.

◆ qgsVariantLessThan()

bool qgsVariantLessThan ( const QVariant &  lhs,
const QVariant &  rhs 
)

Compares two QVariant values and returns whether the first is less than the second.

Useful for sorting lists of variants, correctly handling sorting of the various QVariant data types (such as strings, numeric values, dates and times)

See also
qgsVariantGreaterThan()

Definition at line 146 of file qgis.cpp.

◆ qgsVsiPrefix()

QString qgsVsiPrefix ( const QString &  path)

Definition at line 219 of file qgis.cpp.

◆ qHash()

uint qHash ( const QVariant &  variant)

Hash for QVariant.

Definition at line 236 of file qgis.cpp.

Variable Documentation

◆ GEO_EPSG_CRS_AUTHID

const QString GEO_EPSG_CRS_AUTHID = QStringLiteral( "EPSG:4326" )

Geographic coord sys from EPSG authority.

Definition at line 69 of file qgis.cpp.

◆ GEO_NONE

const QString GEO_NONE = QStringLiteral( "NONE" )

Constant that holds the string representation for "No ellips/No CRS".

Definition at line 71 of file qgis.cpp.

◆ GEOPROJ4

const QString GEOPROJ4 = QStringLiteral( "+proj=longlat +datum=WGS84 +no_defs" )

PROJ4 string that represents a geographic coord sys.

Definition at line 50 of file qgis.cpp.

◆ GEOWKT

const QString GEOWKT
Initial value:
=
"GEOGCS[\"WGS 84\", "
" DATUM[\"WGS_1984\", "
" SPHEROID[\"WGS 84\",6378137,298.257223563, "
" AUTHORITY[\"EPSG\",7030]], "
" TOWGS84[0,0,0,0,0,0,0], "
" AUTHORITY[\"EPSG\",6326]], "
" PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",8901]], "
" UNIT[\"DMSH\",0.0174532925199433,AUTHORITY[\"EPSG\",9108]], "
" AXIS[\"Lat\",NORTH], "
" AXIS[\"Long\",EAST], "
" AUTHORITY[\"EPSG\",4326]]"

Wkt string that represents a geographic coord sys.

Since
QGIS GEOWkt

Definition at line 52 of file qgis.cpp.

◆ PROJECT_SCALES

const QString PROJECT_SCALES
Initial value:
=
"1:1000000,1:500000,1:250000,1:100000,1:50000,1:25000,"
"1:10000,1:5000,1:2500,1:1000,1:500"

Definition at line 65 of file qgis.cpp.