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. More...
UBool | isMarkup () const
| Checks if the part is a markup part. More...
UBool | isExpression () const
| Checks if the part is an expression part. More...
const Expression & | contents () const
| Accesses the expression of the part. More...
const Markup & | asMarkup () const
| Accesses the expression of the part. More...
const UnicodeString & | asText () const
| Accesses the text contents of the part. More...
| PatternPart (const PatternPart &other)
| Copy constructor. More...
PatternPart & | operator= (PatternPart) noexcept
| Assignment operator. More...
virtual | ~PatternPart ()
| Destructor. More...
| PatternPart (const UnicodeString &t)
| Text part constructor. More...
| PatternPart (Expression &&e)
| Expression part constructor. More...
| PatternPart (Markup &&m)
| Markup part constructor. More...
| 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
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 1965 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 2067 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 2077 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 2087 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 1993 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 1984 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 1975 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 Function Documentation

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

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

- i18n/unicode/messageformat2_data_model.h