# firebase::gma::AdSize


`#include <types.h>`

The size of a banner ad.

## Summary

| ### Constructors and Destructors ||
|---|---|
| `https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size_1ad5d877505d4a3e62e699a5ff1a1cda27(uint32_t width, uint32_t height)` Creates a new [AdSize](https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size). ||

| ### Public types ||
|---|---|
| `https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size_1a1290f4ae53826584c2fa7588a791cf9b{ https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size_1a1290f4ae53826584c2fa7588a791cf9ba157371cb8a7b764b3e3247580cfde8e7 = 0, https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size_1a1290f4ae53826584c2fa7588a791cf9ba811023b7f3e5248bc24cb5f85cb8037b, https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size_1a1290f4ae53826584c2fa7588a791cf9ba3e01ca92b8dd3bc842fd965678a76e53 }` | enumDenotes the orientation of the [AdSize](https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size). |
| `https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size_1aaa8492e08dcaee1e52bc861ff9988dca{ https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size_1aaa8492e08dcaee1e52bc861ff9988dcaa97f9898c758b1229d8af9b3e29400f03 = 0, https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size_1aaa8492e08dcaee1e52bc861ff9988dcaa89899400adc683e00d0536e69f8830c8, https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size_1aaa8492e08dcaee1e52bc861ff9988dcaa6601dc62a2b5e8fff903647a37264e1c }` | enumDenotes the type size object that the [AdSize](https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size) represents. |

| ### Public static attributes ||
|---|---|
| `https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size_1a4d6f8645be81638b7042b45c9abc6076` | `const https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size` Mobile Marketing Association (MMA) banner ad size (320x50 density-independent pixels). |
| `https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size_1a49a34fd6fd6b56ae65a8ed9d6504097a` | `const https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size` Interactive Advertising Bureau (IAB) full banner ad size (468x60 density-independent pixels). |
| `https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size_1afbbb22a17c8aa9ed25c2e4a48f6beb14` | `const https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size` Taller version of kBanner. Typically 320x100. |
| `https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size_1a138ac66fd9dce892a7d90af61ac71415` | `const https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size` Interactive Advertising Bureau (IAB) leaderboard ad size (728x90 density-independent pixels). |
| `https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size_1adbeb9d4ffd402bc5eaff758cefb3c53a` | `const https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size` Interactive Advertising Bureau (IAB) medium rectangle ad size (300x250 density-independent pixels). |

| ### Public functions ||
|---|---|
| `https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size_1ae14b4044ab23bdb04abc2b48a1ba12d2() const ` | `uint32_t` The height of the region represented by this [AdSize](https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size). |
| `https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size_1ad2f22257abd121276198522fb168701b(const https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size & rhs) const ` | `bool` Comparison operator. |
| `https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size_1a51f848e1dcaac12a272a0b61b4453e4f(const https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size & rhs) const ` | `bool` Comparison operator. |
| `https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size_1a90df793ac01f05354d8f4051bd8f9b10() const ` | `https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size_1a1290f4ae53826584c2fa7588a791cf9b` The [AdSize](https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size) orientation. |
| `https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size_1ad54f3e5d846ff38460b0da47a3d70d2d() const ` | `https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size_1aaa8492e08dcaee1e52bc861ff9988dca` The [AdSize](https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size) type, either standard size or adaptive. |
| `https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size_1a091685e6653bf7894d75425a6b1355ac() const ` | `uint32_t` The width of the region represented by this [AdSize](https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size). |

| ### Public static functions ||
|---|---|
| `https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size_1a9d341beeb830c739d1fabbda39661f17(uint32_t width)` | `https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size` Creates an [AdSize](https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size) with the given width and a Google-optimized height to create a banner ad given the current orientation. |
| `https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size_1ac57f90839d12e3b1d6987aaaf0eb56d7(int width)` | `https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size` A convenience method to return an inline adaptive banner ad size given the current interface orientation. |
| `https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size_1ad725bdbc93c0403f013951331a0ddfdb(int width, int max_height)` | `https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size` This ad size is most suitable for banner ads given a maximum height. |
| `https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size_1a4181668061ad12f251746387cd4cf91d(uint32_t width)` | `https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size` Creates an [AdSize](https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size) with the given width and a Google-optimized height to create a banner ad in landscape mode. |
| `https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size_1a3510c1094e1639b863f362c67ed2b711(int width)` | `https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size` Creates an [AdSize](https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size) with the given width and the device's landscape height. |
| `https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size_1a501adaa23d1cd8fe5ce133f1e6984b0b(uint32_t width)` | `https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size` Creates an [AdSize](https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size) with the given width and a Google-optimized height to create a banner ad in portrait mode. |
| `https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size_1a9a714b6dd78bdd4e614c01dd8aa8a08a(int width)` | `https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size` Creates an [AdSize](https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size) with the given width and the device's portrait height. |

## Public types

### Orientation

```c++
 Orientation
```
Denotes the orientation of the [AdSize](https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size).

| Properties ||
|---|---|
| `kOrientationCurrent` | [AdSize](https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size) should reflect the current orientation of the device. |
| `kOrientationLandscape` | [AdSize](https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size) will be adaptively formatted in Landscape mode. |
| `kOrientationPortrait` | [AdSize](https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size) will be adaptively formatted in Portrait mode. |

### Type

```c++
 Type
```
Denotes the type size object that the [AdSize](https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size) represents.

| Properties ||
|---|---|
| `kTypeAnchoredAdaptive` | An adaptive size anchored to a portion of the screen. |
| `kTypeInlineAdaptive` | An adaptive size intended to be embedded in scrollable content. |
| `kTypeStandard` | The standard [AdSize](https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size) type of a set height and width. |

## Public static attributes

### kBanner

```c++
const AdSize kBanner
```
Mobile Marketing Association (MMA) banner ad size (320x50 density-independent pixels).

### kFullBanner

```c++
const AdSize kFullBanner
```
Interactive Advertising Bureau (IAB) full banner ad size (468x60 density-independent pixels).

### kLargeBanner

```c++
const AdSize kLargeBanner
```
Taller version of kBanner. Typically 320x100.

### kLeaderboard

```c++
const AdSize kLeaderboard
```
Interactive Advertising Bureau (IAB) leaderboard ad size (728x90 density-independent pixels).

### kMediumRectangle

```c++
const AdSize kMediumRectangle
```
Interactive Advertising Bureau (IAB) medium rectangle ad size (300x250 density-independent pixels).

## Public functions

### AdSize

```c++
 AdSize(
  uint32_t width,
  uint32_t height
)
```
Creates a new [AdSize](https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size).

<br />

Details Parameters `width` The width of the ad in density-independent pixels. `height` The height of the ad in density-independent pixels.

### height

```c++
uint32_t height() const 
```
The height of the region represented by this [AdSize](https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size).

Value is in density-independent pixels.

### operator!=

```c++
bool operator!=(
  const AdSize & rhs
) const 
```
Comparison operator.

<br />

| Details ||
|---|---|
| **Returns** | true if `rhs` refers to a different [AdSize](https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size) as `this`. |

### operator==

```c++
bool operator==(
  const AdSize & rhs
) const 
```
Comparison operator.

<br />

| Details ||
|---|---|
| **Returns** | true if `rhs` refers to the same [AdSize](https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size) as `this`. |

### orientation

```c++
Orientation orientation() const 
```
The [AdSize](https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size) orientation.

### type

```c++
Type type() const 
```
The [AdSize](https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size) type, either standard size or adaptive.

### width

```c++
uint32_t width() const 
```
The width of the region represented by this [AdSize](https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size).

Value is in density-independent pixels.

## Public static functions

### GetCurrentOrientationAnchoredAdaptiveBannerAdSize

```c++
AdSize GetCurrentOrientationAnchoredAdaptiveBannerAdSize(
  uint32_t width
)
```
Creates an [AdSize](https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size) with the given width and a Google-optimized height to create a banner ad given the current orientation.

<br />

Details Parameters `width` The width of the ad in density-independent pixels. **Returns** an [AdSize](https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size) with the given width and a Google-optimized height to create a banner ad. The size returned will have an aspect ratio similar to [AdSize](https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size), suitable for anchoring near the top or bottom of your app. The exact size of the ad returned can be retrieved by calling [AdView::ad_size](https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-view#classfirebase_1_1gma_1_1_ad_view_1ae6e63939d1496e45365a4204e63dff02) once the ad has been loaded.

### GetCurrentOrientationInlineAdaptiveBannerAdSize

```c++
AdSize GetCurrentOrientationInlineAdaptiveBannerAdSize(
  int width
)
```
A convenience method to return an inline adaptive banner ad size given the current interface orientation.

This [AdSize](https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size) allows Google servers to choose an optimal ad size with a height less than or equal to the height of the screen in the requested orientation.

<br />

Details Parameters `width` The width of the ad in density-independent pixels. **Returns** an [AdSize](https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size) with the given width and a height that is always 0. The exact size of the ad returned can be retrieved by calling [AdView::ad_size](https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-view#classfirebase_1_1gma_1_1_ad_view_1ae6e63939d1496e45365a4204e63dff02) once the ad has been loaded.

### GetInlineAdaptiveBannerAdSize

```c++
AdSize GetInlineAdaptiveBannerAdSize(
  int width,
  int max_height
)
```
This ad size is most suitable for banner ads given a maximum height.

This [AdSize](https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size) allows Google servers to choose an optimal ad size with a height less than or equal to the max height given in

<br />

Details Parameters `width` The width of the ad in density-independent pixels. `max_height` The maximum height that a loaded ad will have. Must be at least 32 dp, but a maxHeight of 50 dp or higher is recommended. **Returns** an [AdSize](https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size) with the given width and a height that is always 0. The exact size of the ad returned can be retrieved by calling [AdView::ad_size](https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-view#classfirebase_1_1gma_1_1_ad_view_1ae6e63939d1496e45365a4204e63dff02) once the ad has been loaded.

### GetLandscapeAnchoredAdaptiveBannerAdSize

```c++
AdSize GetLandscapeAnchoredAdaptiveBannerAdSize(
  uint32_t width
)
```
Creates an [AdSize](https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size) with the given width and a Google-optimized height to create a banner ad in landscape mode.

<br />

Details Parameters `width` The width of the ad in density-independent pixels. **Returns** an [AdSize](https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size) with the given width and a Google-optimized height to create a banner ad. The size returned will have an aspect ratio similar to BANNER, suitable for anchoring near the top or bottom of your app. The exact size of the ad returned can be retrieved by calling [AdView::ad_size](https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-view#classfirebase_1_1gma_1_1_ad_view_1ae6e63939d1496e45365a4204e63dff02) once the ad has been loaded.

### GetLandscapeInlineAdaptiveBannerAdSize

```c++
AdSize GetLandscapeInlineAdaptiveBannerAdSize(
  int width
)
```
Creates an [AdSize](https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size) with the given width and the device's landscape height.

This ad size allows Google servers to choose an optimal ad size with a height less than or equal to the height of the screen in landscape orientation.

<br />

Details Parameters `width` The width of the ad in density-independent pixels. **Returns** an [AdSize](https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size) with the given width and a height that is always 0. The exact size of the ad returned can be retrieved by calling [AdView::ad_size](https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-view#classfirebase_1_1gma_1_1_ad_view_1ae6e63939d1496e45365a4204e63dff02) once the ad has been loaded.

### GetPortraitAnchoredAdaptiveBannerAdSize

```c++
AdSize GetPortraitAnchoredAdaptiveBannerAdSize(
  uint32_t width
)
```
Creates an [AdSize](https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size) with the given width and a Google-optimized height to create a banner ad in portrait mode.

<br />

Details Parameters `width` The width of the ad in density-independent pixels. **Returns** an [AdSize](https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size) with the given width and a Google-optimized height to create a banner ad. The size returned will have an aspect ratio similar to BANNER, suitable for anchoring near the top or bottom of your app. The exact size of the ad returned can be retrieved by calling [AdView::ad_size](https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-view#classfirebase_1_1gma_1_1_ad_view_1ae6e63939d1496e45365a4204e63dff02) once the ad has been loaded.

### GetPortraitInlineAdaptiveBannerAdSize

```c++
AdSize GetPortraitInlineAdaptiveBannerAdSize(
  int width
)
```
Creates an [AdSize](https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size) with the given width and the device's portrait height.

This ad size allows Google servers to choose an optimal ad size with a height less than or equal to the height of the screen in portrait orientation.

<br />

Details Parameters `width` The width of the ad in density-independent pixels. **Returns** an [AdSize](https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-size#classfirebase_1_1gma_1_1_ad_size) with the given width and a height that is always 0. The exact size of the ad returned can be retrieved by calling [AdView::ad_size](https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-view#classfirebase_1_1gma_1_1_ad_view_1ae6e63939d1496e45365a4204e63dff02) once the ad has been loaded.