Logo Search packages:      
Sourcecode: icu version File versions  Download package

Replaceable Class Reference

#include <rep.h>

Inheritance diagram for Replaceable:
Collaboration diagram for Replaceable:

List of all members.

Public Member Functions

UChar32 char32At (int32_t offset) const
UChar charAt (int32_t offset) const
virtual Replaceableclone () const
virtual void copy (int32_t start, int32_t limit, int32_t dest)=0
virtual void extractBetween (int32_t start, int32_t limit, UnicodeString &target) const =0
virtual UClassID getDynamicClassID () const =0
virtual void handleReplaceBetween (int32_t start, int32_t limit, const UnicodeString &text)=0
virtual UBool hasMetaData () const
int32_t length () const
virtual ~Replaceable ()

Static Public Member Functions

static void U_EXPORT2 operator delete (void *p) U_NO_THROW
static void U_EXPORT2 operator delete (void *, void *) U_NO_THROW
static void U_EXPORT2 operator delete[] (void *p) U_NO_THROW
static void *U_EXPORT2 operator new (size_t size) U_NO_THROW
static void *U_EXPORT2 operator new (size_t, void *ptr) U_NO_THROW
static void *U_EXPORT2 operator new[] (size_t size) U_NO_THROW

Protected Member Functions

virtual UChar32 getChar32At (int32_t offset) const =0
virtual UChar getCharAt (int32_t offset) const =0
virtual int32_t getLength () const =0
 Replaceable ()

Detailed Description

Replaceable is an abstract base class representing a string of characters that supports the replacement of a range of itself with a new string of characters. It is used by APIs that change a piece of text while retaining metadata. Metadata is data other than the Unicode characters returned by char32At(). One example of metadata is style attributes; another is an edit history, marking each character with an author and revision number.

An implicit aspect of the Replaceable API is that during a replace operation, new characters take on the metadata of the old characters. For example, if the string "the <b>bold</b> font" has range (4, 8) replaced with "strong", then it becomes "the <b>strong</b> font".

Replaceable specifies ranges using a start offset and a limit offset. The range of characters thus specified includes the characters at offset start..limit-1. That is, the start offset is inclusive, and the limit offset is exclusive.

Replaceable also includes API to access characters in the string: length(), charAt(), char32At(), and extractBetween().

For a subclass to support metadata, typical behavior of replace() is the following:

  • Set the metadata of the new text to the metadata of the first character replaced
  • If no characters are replaced, use the metadata of the previous character
  • If there is no previous character (i.e. start == 0), use the following character
  • If there is no following character (i.e. the replaceable was empty), use default metadata.
  • If the code point U+FFFF is seen, it should be interpreted as a special marker having no metadata

If this is not the behavior, the subclass should document any differences.

Alan Liu ICU 2.0

Definition at line 71 of file rep.h.

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

Generated by  Doxygen 1.6.0   Back to index