| 1 | // Copyright 2013 The Closure Library Authors. All Rights Reserved. |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS-IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
| 15 | goog.provide('goog.string.TypedString'); |
| 16 | |
| 17 | |
| 18 | |
| 19 | /** |
| 20 | * Wrapper for strings that conform to a data type or language. |
| 21 | * |
| 22 | * Implementations of this interface are wrappers for strings, and typically |
| 23 | * associate a type contract with the wrapped string. Concrete implementations |
| 24 | * of this interface may choose to implement additional run-time type checking, |
| 25 | * see for example {@code goog.html.SafeHtml}. If available, client code that |
| 26 | * needs to ensure type membership of an object should use the type's function |
| 27 | * to assert type membership, such as {@code goog.html.SafeHtml.unwrap}. |
| 28 | * @interface |
| 29 | */ |
| 30 | goog.string.TypedString = function() {}; |
| 31 | |
| 32 | |
| 33 | /** |
| 34 | * Interface marker of the TypedString interface. |
| 35 | * |
| 36 | * This property can be used to determine at runtime whether or not an object |
| 37 | * implements this interface. All implementations of this interface set this |
| 38 | * property to {@code true}. |
| 39 | * @type {boolean} |
| 40 | */ |
| 41 | goog.string.TypedString.prototype.implementsGoogStringTypedString; |
| 42 | |
| 43 | |
| 44 | /** |
| 45 | * Retrieves this wrapped string's value. |
| 46 | * @return {!string} The wrapped string's value. |
| 47 | */ |
| 48 | goog.string.TypedString.prototype.getTypedStringValue; |