GDAL

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

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

`#include <gdal_priv.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.
OGRLayer * | operator[] (int iLayer)
| Fetch a layer by index.
OGRLayer * | operator[] (size_t iLayer)
| Fetch a layer by index.
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 2.3

## Member Function Documentation

## ◆ begin()

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

Return beginning of layer iterator.

Since
  GDAL 2.3

## ◆ end()

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

Return end of layer iterator.

Since
  GDAL 2.3

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

OGRLayer * GDALDataset::Layers::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 2.3

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

OGRLayer * GDALDataset::Layers::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 2.3

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

OGRLayer * GDALDataset::Layers::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 2.3

## ◆ size()

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

Get the number of layers in this dataset.

Returns
  layer count.

Since
  GDAL 2.3

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

- gdal_priv.h
- gdaldataset.cpp