# RoleMap

## Content

# Class: RoleMap

Represents the value of the **RoleMap** entry of the structure tree: a dictionary that maps
the names of structure types used in a document to their approximate equivalents in the set
of standard structure types. See the PDF specification for details.

Both keys and values are PDF names (plain JS strings).

Obtain it from [StructTreeRoot#roleMap](StructTreeRoot#rolemap).

## Extends

- [`ObjectBase`](ObjectBase)

## Accessors

### count

#### Get Signature

```ts
get count(): number;
```

Gets the number of entries in the map.

##### Returns

`number`

***

### id

#### Get Signature

```ts
get id(): number;
```

Gets the reference to the object.

##### Returns

`number`

#### Inherited from

[`ObjectBase`](ObjectBase).[`id`](ObjectBase#id)

***

### om

#### Get Signature

```ts
get om(): ObjectManager;
```

Gets the owner [ObjectManager](ObjectManager) instance.

##### Returns

[`ObjectManager`](ObjectManager)

#### Inherited from

[`ObjectBase`](ObjectBase).[`om`](ObjectBase#om)

## Methods

### clear()

```ts
clear(): void;
```

Removes all entries from the map.

#### Returns

`void`

***

### contains()

```ts
contains(key): boolean;
```

Determines whether the map contains the specified key.

#### Parameters

##### key

`string`

The structure type name to check.

#### Returns

`boolean`

true if the key is present, false otherwise.

***

### entries()

```ts
entries(): [string, string][];
```

Gets the array of key/value pairs in the map.

#### Returns

\[`string`, `string`\][]

***

### free()

```ts
free(): void;
```

Detaches the object from the [ObjectManager](ObjectManager) and deallocates its memory, if possible.

#### Returns

`void`

#### Inherited from

[`ObjectBase`](ObjectBase).[`free`](ObjectBase#free)

***

### get()

```ts
get(key): string;
```

Gets the standard structure type name mapped to the specified key.

#### Parameters

##### key

`string`

The structure type name used in the document.

#### Returns

`string`

The mapped standard structure type name, or `undefined` if the key is not present.

***

### keys()

```ts
keys(): string[];
```

Gets the array of keys (the structure type names used in the document).

#### Returns

`string`[]

***

### rebind()

```ts
rebind(omTo): void;
```

Rebinds the object from the current [ObjectManager](ObjectManager) to the specified one.

#### Parameters

##### omTo

[`ObjectManager`](ObjectManager)

The new [ObjectManager](ObjectManager) for the object.

#### Returns

`void`

#### Inherited from

[`ObjectBase`](ObjectBase).[`rebind`](ObjectBase#rebind)

***

### remove()

```ts
remove(key): boolean;
```

Removes the entry with the specified key.

#### Parameters

##### key

`string`

The structure type name to remove.

#### Returns

`boolean`

true if the entry was actually removed, false otherwise.

***

### set()

```ts
set(key, value): void;
```

Maps the specified structure type name to a standard structure type name.

#### Parameters

##### key

`string`

The structure type name used in the document.

##### value

`string`

The equivalent standard structure type name.

#### Returns

`void`
