Lines Matching defs:Spannable
9 goog.provide('cvox.Spannable');
15 * @param {string=} opt_string Initial value of the spannable.
18 cvox.Spannable = function(opt_string, opt_annotation) {
42 cvox.Spannable.prototype.toString = function() {
51 cvox.Spannable.prototype.getLength = function() {
62 cvox.Spannable.prototype.setSpan = function(value, start, end) {
79 cvox.Spannable.prototype.removeSpan = function(value) {
89 * Appends another Spannable or string to this one.
90 * @param {string|!cvox.Spannable} other String or spannable to concatenate.
92 cvox.Spannable.prototype.append = function(other) {
93 if (other instanceof cvox.Spannable) {
94 var otherSpannable = /** @type {!cvox.Spannable} */ (other);
114 cvox.Spannable.prototype.getSpan = function(position) {
129 cvox.Spannable.prototype.getSpanInstanceOf = function(constructor) {
144 cvox.Spannable.prototype.getSpans = function(position) {
161 cvox.Spannable.prototype.getSpanStart = function(value) {
177 cvox.Spannable.prototype.getSpanEnd = function(value) {
189 * Returns a substring of this spannable.
197 * @return {!cvox.Spannable} Substring requested.
199 cvox.Spannable.prototype.substring = function(start, opt_end) {
206 var result = new cvox.Spannable(this.string_.substring(start, end));
221 * @return {!cvox.Spannable} String with whitespace removed.
223 cvox.Spannable.prototype.trimLeft = function() {
230 * @return {!cvox.Spannable} String with whitespace removed.
232 cvox.Spannable.prototype.trimRight = function() {
239 * @return {!cvox.Spannable} String with whitespace removed.
241 cvox.Spannable.prototype.trim = function() {
250 * @return {!cvox.Spannable} String with whitespace removed.
253 cvox.Spannable.prototype.trim_ = function(trimStart, trimEnd) {
276 * Returns this spannable to a json serializable form, including the text and
279 * @return {!cvox.Spannable.SerializedSpannable_} the json serializable form.
281 cvox.Spannable.prototype.toJson = function() {
290 cvox.Spannable.serializableSpansByName_,
307 * Creates a spannable from a json serializable representation.
308 * @param {!cvox.Spannable.SerializedSpannable_} obj object containing the
310 * @return {!cvox.Spannable}
312 cvox.Spannable.fromJson = function(obj) {
314 throw 'Invalid spannable json object: string field not a string';
317 throw 'Invalid spannable json object: no spans array';
319 var result = new cvox.Spannable(obj.string);
322 throw 'Invalid span in spannable json object: type not a string';
325 throw 'Invalid span in spannable json object: start or end not a number';
327 var serializeInfo = cvox.Spannable.serializableSpansByName_[span.type];
345 cvox.Spannable.registerSerializableSpan = function(
349 cvox.Spannable.serializableSpansByName_[name] = obj;
362 cvox.Spannable.registerStatelessSerializableSpan = function(
372 cvox.Spannable.serializableSpansByName_[name] = obj;
383 cvox.Spannable.SerializeInfo_;
387 * The serialized format of a spannable.
388 * @typedef {{string: string, spans: Array.<cvox.Spannable.SerializedSpan_>}}
391 cvox.Spannable.SerializedSpannable_;
395 * The format of a single annotation in a serialized spannable.
399 cvox.Spannable.SerializedSpan_;
403 * @type {Object.<string, cvox.Spannable.SerializeInfo_>}
406 cvox.Spannable.serializableSpansByName_ = {};