# OptionalContentGroup Class

> A dictionary used to manage graphics images in a PDF.

- Product: Adobe PDF Library 21
- Language: Modern C++
- Version: 21.4.0
- HTML page: https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/OptionalContentGroup
- Version index: https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/llms.txt

```cpp
class OptionalContentGroup
```

**Namespace:** `datalogics_interface`

## Description

A dictionary used to manage graphics images in a PDF.

An Optional Content Group is a dictionary that represents a set of graphics images that users can turn on or off in a PDF document, making them visible or invisible.

In a PDF Viewer, Optional Content Groups are referred to as "Layers."

**Referenced by:** [`Document`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Document.md), [`OptionalContentConfig`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/OptionalContentConfig.md), [`OptionalContentContext`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/OptionalContentContext.md), [`OptionalContentMembershipDict`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/OptionalContentMembershipDict.md), [`OptionalContentOrderLeaf`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/OptionalContentOrderLeaf.md)

**Uses types:** [`PDFDict`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/PDFDict.md)

## Constructors

### OptionalContentGroup

```cpp
datalogics_interface::OptionalContentGroup::OptionalContentGroup()
```

*constructor*

Create a new OptionalContentGroup.

### OptionalContentGroup

```cpp
datalogics_interface::OptionalContentGroup::OptionalContentGroup(const Document &doc, const std::string &name)
```

*constructor*

**Parameters**

- `doc` ([`const Document &`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Document.md)): The document that the new OptionalContentGroup will belong to.
- `name` (`const std::string &`): The name given to the new OptionalContentGroup.

Create a new OptionalContentGroup.

### OptionalContentGroup

```cpp
datalogics_interface::OptionalContentGroup::OptionalContentGroup(OptionalContentGroup &&) noexcept
```

*constructor*

**Parameters**

- (unnamed) ([`OptionalContentGroup &&`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/OptionalContentGroup.md))

### ~OptionalContentGroup

```cpp
datalogics_interface::OptionalContentGroup::~OptionalContentGroup()
```

*destructor*

## Methods

### get_intent

```cpp
std::vector< std::string > datalogics_interface::OptionalContentGroup::get_intent() const
```

**Returns:** `std::vector< std::string >`

An array containing intent strings.

Gets the intent list for an optional-content group. An intent is a string value broadly describing the intended use, either View or Design.

A group's content is considered to be optional (that is, the group's state is considered in its visibility) if any intent in its list matches an intent of the context. The intent list of the context is usually set from the intent list of the document configuration.

### get_name

```cpp
std::string datalogics_interface::OptionalContentGroup::get_name() const
```

**Returns:** `std::string`

the name

Get the name of the optional content group

### get_pdf_dict

```cpp
PDFDict datalogics_interface::OptionalContentGroup::get_pdf_dict()
```

**Returns:** [`PDFDict`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/PDFDict.md)

The underlying PDF dictionary for this OptionalContentGroup.

Retrieve the PDFObject representation of this object.

### operator=

```cpp
OptionalContentGroup & datalogics_interface::OptionalContentGroup::operator=(OptionalContentGroup &&) noexcept
```

**Parameters**

- (unnamed) ([`OptionalContentGroup &&`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/OptionalContentGroup.md))

**Returns:** [`OptionalContentGroup &`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/OptionalContentGroup.md)

### operator==

```cpp
bool datalogics_interface::OptionalContentGroup::operator==(const OptionalContentGroup &other) const
```

**Parameters**

- `other` ([`const OptionalContentGroup &`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/OptionalContentGroup.md)): The OptionalContentGroup to compare with.

**Returns:** `bool`

true if the two objects refer to the same optional content group, false otherwise.

Determines whether this OptionalContentGroup is equal to another.

Two OptionalContentGroups are considered equal if they refer to the same underlying optional content group object.

### set_intent

```cpp
void datalogics_interface::OptionalContentGroup::set_intent(const std::vector< std::string > &intents)
```

**Parameters**

- `intents` (`const std::vector< std::string > &`): An array of intent strings to assign to this group.

**Returns:** `void`

Sets the intent list for an optional-content group. An intent is a string value broadly describing the intended use, either View or Design.

A group's content is considered to be optional (that is, the group's state is considered in its visibility) if any intent in its list matches an intent of the context. The intent list of the context is usually set from the intent list of the document configuration.

### set_name

```cpp
void datalogics_interface::OptionalContentGroup::set_name(const std::string &name)
```

**Parameters**

- `name` (`const std::string &`): The new name for this OptionalContentGroup.

**Returns:** `void`

Set the name of the optional content group.

### to_string

```cpp
std::string datalogics_interface::OptionalContentGroup::to_string() const
```

**Returns:** `std::string`

A string describing this OptionalContentGroup.

Returns a string representation of this OptionalContentGroup.

The string includes the group's name and its intent list.
