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

ICU 78.2 78.2

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

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

## 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 1392 of file messageformat2_data_model.h.

## Constructor & Destructor Documentation

## ◆ PatternPart() [1/5]

U_I18N_API 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 U_I18N_API 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]

U_I18N_API 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 1494 of file messageformat2_data_model.h.

## ◆ PatternPart() [3/5]

U_I18N_API 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 1504 of file messageformat2_data_model.h.

## ◆ PatternPart() [4/5]

U_I18N_API 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 1514 of file messageformat2_data_model.h.

## ◆ PatternPart() [5/5]

U_I18N_API 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()

U_I18N_API 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()

U_I18N_API 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()

U_I18N_API 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()

U_I18N_API 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 1420 of file messageformat2_data_model.h.

## ◆ isMarkup()

U_I18N_API 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 1411 of file messageformat2_data_model.h.

## ◆ isText()

U_I18N_API 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 1402 of file messageformat2_data_model.h.

## ◆ operator=()

U_I18N_API 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 Function Documentation

## ◆ swap

U_I18N_API friend 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 1459 of file messageformat2_data_model.h.

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

- i18n/unicode/messageformat2_data_model.h