AbstractMessageParser
abstract class AbstractMessageParser
| kotlin.Any | |
| ↳ | com.google.android.util.AbstractMessageParser |
Logic for parsing a text message typed by the user looking for smileys, urls, acronyms,formatting (e.g., '*'s for bold), me commands (e.g., "/me is asleep"), and punctuation. It constructs an array, which breaks the text up into its constituent pieces, which we return to the client.
Summary
Nested classes |
|
|---|---|
| open |
Represents an acronym that was found in the input. |
| open |
Represents a link to a Flickr photo or album. |
| open |
Represents a character that changes formatting. |
| open |
Represents a simple string of html text. |
| open |
Represents a link that was found in the input. |
| open |
Represents a music track token at the beginning. |
| open |
Represents set of tokens that are delivered as a single message. |
| open |
Represents a link to a Picasa photo or album. |
| abstract |
Interface representing the set of resources needed by a message parser |
| open |
Represents a smiley that was found in the input. |
| abstract |
Represents a unit of parsed output. |
| open | |
| open |
Represents a link to a Google Video. |
| open |
Represents a link to a YouTube video. |
Constants |
|
|---|---|
| static String |
Music note that indicates user is listening to a music track. |
Public constructors |
|
|---|---|
|
Create a message parser to parse urls, formatting, acronyms, smileys, /me text and music |
|
<init>(text: String!, parseSmilies: Boolean, parseAcronyms: Boolean, parseFormatting: Boolean, parseUrls: Boolean, parseMusic: Boolean, parseMeText: Boolean)Create a message parser, specifying the kinds of text to parse |
|
Public methods |
|
|---|---|
| AbstractMessageParser.Part! |
Return the part at the given index. |
| Int |
Return the number of parts. |
| MutableList<AbstractMessageParser.Part!>! |
getParts()Return the list of parts from the parsed text |
| String! |
Returns the raw text being parsed. |
| open Unit |
parse()Parses the text string into an internal representation. |
| open String! |
toHtml()Converts the entire message into a single HTML display string. |
| open static AbstractMessageParser.Token! |
tokenForUrl(url: String!, text: String!)Get a the appropriate Token for a given URL |
Protected methods |
|
|---|---|
| abstract AbstractMessageParser.Resources! |
Subclasses must define the schemes, domains, smileys and acronyms that are necessary for parsing |
| open static String! |
Returns the reverse of the given string. |
Constants
musicNote
static val musicNote: String
Music note that indicates user is listening to a music track.
Value: "\u266b "
Public constructors
<init>
AbstractMessageParser(text: String!)
Create a message parser to parse urls, formatting, acronyms, smileys, /me text and music
| Parameters | |
|---|---|
text |
String!: the text to parse |
<init>
AbstractMessageParser(
text: String!,
parseSmilies: Boolean,
parseAcronyms: Boolean,
parseFormatting: Boolean,
parseUrls: Boolean,
parseMusic: Boolean,
parseMeText: Boolean)
Create a message parser, specifying the kinds of text to parse
| Parameters | |
|---|---|
text |
String!: the text to parse |
Public methods
getPart
fun getPart(index: Int): AbstractMessageParser.Part!
Return the part at the given index.
getParts
fun getParts(): MutableList<AbstractMessageParser.Part!>!
Return the list of parts from the parsed text
parse
open fun parse(): Unit
Parses the text string into an internal representation.
toHtml
open fun toHtml(): String!
Converts the entire message into a single HTML display string.
tokenForUrl
open static fun tokenForUrl(
url: String!,
text: String!
): AbstractMessageParser.Token!
Get a the appropriate Token for a given URL
| Parameters | |
|---|---|
text |
String!: the anchor text |
url |
String!: the url |
Protected methods
getResources
protected abstract fun getResources(): AbstractMessageParser.Resources!
Subclasses must define the schemes, domains, smileys and acronyms that are necessary for parsing
reverse
protected open static fun reverse(str: String!): String!
Returns the reverse of the given string.