QGIS API Documentation  3.2.0-Bonn (bc43194)
Classes | Public Member Functions | Friends | List of all members
QgsReadWriteContext Class Reference

The class is used as a container of context for various read/write operations on other objects. More...

#include <qgsreadwritecontext.h>

Classes

struct  ReadWriteMessage
 Struct for QgsReadWriteContext error or warning messages. More...
 

Public Member Functions

 QgsReadWriteContext ()=default
 Constructor for QgsReadWriteContext. More...
 
 ~QgsReadWriteContext ()
 
MAYBE_UNUSED NODISCARD QgsReadWriteContextCategoryPopper enterCategory (const QString &category, const QString &details=QString())
 Push a category to the stack. More...
 
const QgsPathResolverpathResolver () const
 Returns path resolver for conversion between relative and absolute paths. More...
 
void pushMessage (const QString &message, Qgis::MessageLevel level=Qgis::Warning)
 Append a message to the context. More...
 
void setPathResolver (const QgsPathResolver &resolver)
 Sets up path resolver for conversion between relative and absolute paths. More...
 
QList< QgsReadWriteContext::ReadWriteMessagetakeMessages ()
 Returns the stored messages and remove them. More...
 

Friends

class QgsReadWriteContextCategoryPopper
 

Detailed Description

The class is used as a container of context for various read/write operations on other objects.

Since
QGIS 3.0

Definition at line 32 of file qgsreadwritecontext.h.

Constructor & Destructor Documentation

◆ QgsReadWriteContext()

QgsReadWriteContext::QgsReadWriteContext ( )
default

Constructor for QgsReadWriteContext.

◆ ~QgsReadWriteContext()

QgsReadWriteContext::~QgsReadWriteContext ( )

Definition at line 17 of file qgsreadwritecontext.cpp.

Member Function Documentation

◆ enterCategory()

QgsReadWriteContextCategoryPopper QgsReadWriteContext::enterCategory ( const QString &  category,
const QString &  details = QString() 
)

Push a category to the stack.

Note
The return value should always be used so category can be automatically left.
It is not aimed at being used in Python. Instead use the context manager.
with QgsReadWriteContext.enterCategory(context, category, details):
# do something
Since
QGIS 3.2

Definition at line 38 of file qgsreadwritecontext.cpp.

◆ pathResolver()

const QgsPathResolver & QgsReadWriteContext::pathResolver ( ) const

Returns path resolver for conversion between relative and absolute paths.

Definition at line 23 of file qgsreadwritecontext.cpp.

◆ pushMessage()

void QgsReadWriteContext::pushMessage ( const QString &  message,
Qgis::MessageLevel  level = Qgis::Warning 
)

Append a message to the context.

Since
QGIS 3.2

Definition at line 33 of file qgsreadwritecontext.cpp.

◆ setPathResolver()

void QgsReadWriteContext::setPathResolver ( const QgsPathResolver resolver)

Sets up path resolver for conversion between relative and absolute paths.

Definition at line 28 of file qgsreadwritecontext.cpp.

◆ takeMessages()

QList< QgsReadWriteContext::ReadWriteMessage > QgsReadWriteContext::takeMessages ( )

Returns the stored messages and remove them.

Since
QGIS 3.2

Definition at line 53 of file qgsreadwritecontext.cpp.

Friends And Related Function Documentation

◆ QgsReadWriteContextCategoryPopper

friend class QgsReadWriteContextCategoryPopper
friend

Definition at line 111 of file qgsreadwritecontext.h.


The documentation for this class was generated from the following files: