QGIS API Documentation  3.20.0-Odense (decaadbb31)
Macros | Functions
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 <gdal.h>
#include <geos_c.h>
#include <ogr_api.h>
Include dependency graph for qgis.cpp:

Go to the source code of this file.

Macros

#define str(x)   #x
 
#define xstr(x)   str(x)
 

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...
 
qlonglong qgsPermissiveToLongLong (QString string, bool &ok)
 Converts a string to an qlonglong in a permissive way, e.g., allowing for incorrect numbers of digits between thousand separators. More...
 
bool qgsVariantEqual (const QVariant &lhs, const QVariant &rhs)
 Compares two QVariant values and returns whether they are equal, two NULL values are always treated as equal and 0 is not treated as equal with NULL. 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...
 

Macro Definition Documentation

◆ str

#define str (   x)    #x

Definition at line 37 of file qgis.cpp.

◆ xstr

#define xstr (   x)    str(x)

Definition at line 36 of file qgis.cpp.

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 107 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 122 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 92 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
See also
permissiveToInt
Since
QGIS 2.9

Definition at line 71 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
See also
permissiveToDouble
Since
QGIS 2.9

Definition at line 78 of file qgis.cpp.

◆ qgsPermissiveToLongLong()

qlonglong qgsPermissiveToLongLong ( QString  string,
bool &  ok 
)

Converts a string to an qlonglong 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
See also
permissiveToInt
Since
QGIS 3.4

Definition at line 85 of file qgis.cpp.

◆ qgsVariantEqual()

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

Compares two QVariant values and returns whether they are equal, two NULL values are always treated as equal and 0 is not treated as equal with NULL.

Parameters
lhsfirst value
rhssecond value
Returns
true if values are equal

Definition at line 274 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 195 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)

Invalid < NULL < Values

See also
qgsVariantGreaterThan()

Definition at line 127 of file qgis.cpp.

◆ qgsVsiPrefix()

QString qgsVsiPrefix ( const QString &  path)

Definition at line 200 of file qgis.cpp.

◆ qHash()

uint qHash ( const QVariant &  variant)

Hash for QVariant.

Definition at line 225 of file qgis.cpp.