GDAL

Classes | Public Member Functions | Friends | List of all members
GDALDataset::ConstLayers Class Reference

Class returned by GetLayers() that acts as a range of layers. More...

`#include <gdal_dataset.h>`

## Classes
class | Iterator
| Layer iterator. More...

## Public Member Functions
Iterator | begin () const
| Return beginning of layer iterator.
Iterator | end () const
| Return end of layer iterator.
size_t | size () const
| Get the number of layers in this dataset.
const OGRLayer * | operator[] (int iLayer)
| Fetch a layer by index.
const OGRLayer * | operator[] (size_t iLayer)
| Fetch a layer by index.
const OGRLayer * | operator[] (const char *pszLayername)
| Fetch a layer by name.

## Friends
class | GDALDataset

## Detailed Description

Class returned by GetLayers() that acts as a range of layers.

Since
  GDAL 3.12

## Member Function Documentation

## ◆ begin()

GDALDataset::ConstLayers::Iterator GDALDataset::ConstLayers::begin | ( |  | ) | const

Return beginning of layer iterator.

Since
  GDAL 3.12

## ◆ end()

GDALDataset::ConstLayers::Iterator GDALDataset::ConstLayers::end | ( |  | ) | const

Return end of layer iterator.

Since
  GDAL 3.12

## ◆ operator[]() [1/3]

const OGRLayer * GDALDataset::ConstLayers::operator[] | ( | const char * | pszLayerName | ) |

Fetch a layer by name.

The returned layer remains owned by the GDALDataset and should not be deleted by the application.

Parameters

  pszLayerName | layer name

Returns
  the layer, or nullptr if pszLayerName does not match with a layer

Since
  GDAL 3.12

## ◆ operator[]() [2/3]

const OGRLayer * GDALDataset::ConstLayers::operator[] | ( | int | iLayer | ) |

Fetch a layer by index.

The returned layer remains owned by the GDALDataset and should not be deleted by the application.

Parameters

  iLayer | a layer number between 0 and size()-1.

Returns
  the layer, or nullptr if iLayer is out of range or an error occurs.

Since
  GDAL 3.12

## ◆ operator[]() [3/3]

const OGRLayer * GDALDataset::ConstLayers::operator[] | ( | size_t | iLayer | ) |

Fetch a layer by index.

The returned layer remains owned by the GDALDataset and should not be deleted by the application.

Parameters

  iLayer | a layer number between 0 and size()-1.

Returns
  the layer, or nullptr if iLayer is out of range or an error occurs.

Since
  GDAL 3.12

## ◆ size()

size_t GDALDataset::ConstLayers::size | ( |  | ) | const

Get the number of layers in this dataset.

Returns
  layer count.

Since
  GDAL 3.12

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

- gdal_dataset.h
- gdaldataset.cpp