ICU 76.1: icu::message2::data_model::PatternPart Class Reference

ICU 76.1 76.1

Public Member Functions | Friends
icu::message2::data_model::PatternPart Class Reference

A `PatternPart` is a single element (text or expression) in a `Pattern`. More...

`#include <messageformat2_data_model.h>`

Inheritance diagram for icu::message2::data_model::PatternPart:

## Public Member Functions
UBool | isText () const
| Checks if the part is a text part.
UBool | isMarkup () const
| Checks if the part is a markup part.
UBool | isExpression () const
| Checks if the part is an expression part.
const Expression & | contents () const
| Accesses the expression of the part.
const Markup & | asMarkup () const
| Accesses the expression of the part.
const UnicodeString & | asText () const
| Accesses the text contents of the part.
| PatternPart (const PatternPart &other)
| Copy constructor.
PatternPart & | operator= (PatternPart) noexcept
| Assignment operator.
virtual | ~PatternPart ()
| Destructor.
| PatternPart (const UnicodeString &t)
| Text part constructor.
| PatternPart (Expression &&e)
| Expression part constructor.
| PatternPart (Markup &&m)
| Markup part constructor.
| PatternPart ()=default
| Default constructor.
Public Member Functions inherited from icu::UObject
virtual | ~UObject ()
| Destructor.
virtual UClassID | getDynamicClassID () const
| ICU4C "poor man's RTTI", returns a UClassID for the actual ICU class.

## Friends
class | Pattern
void | swap (PatternPart &p1, PatternPart &p2) noexcept
| Non-member swap function.

## Detailed Description

A `PatternPart` is a single element (text or expression) in a `Pattern`.

It corresponds to the `body` field of the `Pattern` interface defined in https://github.com/unicode-org/message-format-wg/blob/main/spec/data-model.md#patterns

`PatternPart` is immutable, copyable and movable.

Internal
  Do not use. This API is for internal use only. ICU 75 technology preview

Deprecated
  This API is for technology preview only.

Definition at line 1513 of file messageformat2_data_model.h.

## Constructor & Destructor Documentation

## ◆ PatternPart() [1/5]

icu::message2::data_model::PatternPart::PatternPart | ( | const PatternPart & | other | ) |

Copy constructor.

Internal
  Do not use. This API is for internal use only. ICU 75 technology preview

Deprecated
  This API is for technology preview only.

## ◆ ~PatternPart()

virtual icu::message2::data_model::PatternPart::~PatternPart | ( |  | ) |
| virtual

Destructor.

Internal
  Do not use. This API is for internal use only. ICU 75 technology preview

Deprecated
  This API is for technology preview only.

## ◆ PatternPart() [2/5]

icu::message2::data_model::PatternPart::PatternPart | ( | const UnicodeString & | t | ) |
| inlineexplicit

Text part constructor.

Returns a text pattern part with text `t`.

Parameters

  t | A text string.

Internal
  Do not use. This API is for internal use only. ICU 75 technology preview

Deprecated
  This API is for technology preview only.

Definition at line 1615 of file messageformat2_data_model.h.

## ◆ PatternPart() [3/5]

icu::message2::data_model::PatternPart::PatternPart | ( | Expression && | e | ) |
| inlineexplicit

Expression part constructor.

Returns an Expression pattern part with expression `e`.

Parameters

  e | An Expression.

Internal
  Do not use. This API is for internal use only. ICU 75 technology preview

Deprecated
  This API is for technology preview only.

Definition at line 1625 of file messageformat2_data_model.h.

## ◆ PatternPart() [4/5]

icu::message2::data_model::PatternPart::PatternPart | ( | Markup && | m | ) |
| inlineexplicit

Markup part constructor.

Returns a Markup pattern part with markup `m`

Parameters

  m | A Markup.

Internal
  Do not use. This API is for internal use only. ICU 75 technology preview

Deprecated
  This API is for technology preview only.

Definition at line 1635 of file messageformat2_data_model.h.

## ◆ PatternPart() [5/5]

icu::message2::data_model::PatternPart::PatternPart | ( |  | ) |
| default

Default constructor.

Puts the PatternPart into a valid but undefined state.

Internal
  Do not use. This API is for internal use only. ICU 75 technology preview

Deprecated
  This API is for technology preview only.

## Member Function Documentation

## ◆ asMarkup()

const Markup & icu::message2::data_model::PatternPart::asMarkup | ( |  | ) | const

Accesses the expression of the part.

Precondition: isMarkup()

Returns
  A reference to the part's underlying expression.

Internal
  Do not use. This API is for internal use only. ICU 75 technology preview

Deprecated
  This API is for technology preview only.

## ◆ asText()

const UnicodeString & icu::message2::data_model::PatternPart::asText | ( |  | ) | const

Accesses the text contents of the part.

Precondition: isText()

Returns
  A reference to a string representing the part's text..

Internal
  Do not use. This API is for internal use only. ICU 75 technology preview

Deprecated
  This API is for technology preview only.

## ◆ contents()

const Expression & icu::message2::data_model::PatternPart::contents | ( |  | ) | const

Accesses the expression of the part.

Precondition: isExpression()

Returns
  A reference to the part's underlying expression.

Internal
  Do not use. This API is for internal use only. ICU 75 technology preview

Deprecated
  This API is for technology preview only.

## ◆ isExpression()

UBool icu::message2::data_model::PatternPart::isExpression | ( |  | ) | const
| inline

Checks if the part is an expression part.

Returns
  True if and only if this is an expression part.

Internal
  Do not use. This API is for internal use only. ICU 75 technology preview

Deprecated
  This API is for technology preview only.

Definition at line 1541 of file messageformat2_data_model.h.

## ◆ isMarkup()

UBool icu::message2::data_model::PatternPart::isMarkup | ( |  | ) | const
| inline

Checks if the part is a markup part.

Returns
  True if and only if this is a markup part.

Internal
  Do not use. This API is for internal use only. ICU 75 technology preview

Deprecated
  This API is for technology preview only.

Definition at line 1532 of file messageformat2_data_model.h.

## ◆ isText()

UBool icu::message2::data_model::PatternPart::isText | ( |  | ) | const
| inline

Checks if the part is a text part.

Returns
  True if and only if this is a text part.

Internal
  Do not use. This API is for internal use only. ICU 75 technology preview

Deprecated
  This API is for technology preview only.

Definition at line 1523 of file messageformat2_data_model.h.

## ◆ operator=()

PatternPart & icu::message2::data_model::PatternPart::operator= | ( | PatternPart |  | ) |
| noexcept

Assignment operator.

Internal
  Do not use. This API is for internal use only. ICU 75 technology preview

Deprecated
  This API is for technology preview only.

## Friends And Related Symbol Documentation

## ◆ Pattern

friend class Pattern
| friend

Definition at line 1645 of file messageformat2_data_model.h.

## ◆ swap

void swap | ( | PatternPart & | p1,
|  | PatternPart & | p2 )
| friend

Non-member swap function.

Parameters

  p1 | will get p2's contents
  p2 | will get p1's contents

Internal
  Do not use. This API is for internal use only. ICU 75 technology preview

Deprecated
  This API is for technology preview only.

Definition at line 1580 of file messageformat2_data_model.h.

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

- i18n/unicode/messageformat2_data_model.h