123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186 |
- goog.provide('goog.string.Const');
- goog.require('goog.asserts');
- goog.require('goog.string.TypedString');
- goog.string.Const = function() {
-
- this.stringConstValueWithSecurityContract__googStringSecurityPrivate_ = '';
-
- this.STRING_CONST_TYPE_MARKER__GOOG_STRING_SECURITY_PRIVATE_ =
- goog.string.Const.TYPE_MARKER_;
- };
- goog.string.Const.prototype.implementsGoogStringTypedString = true;
- goog.string.Const.prototype.getTypedStringValue = function() {
- return this.stringConstValueWithSecurityContract__googStringSecurityPrivate_;
- };
- goog.string.Const.prototype.toString = function() {
- return 'Const{' +
- this.stringConstValueWithSecurityContract__googStringSecurityPrivate_ +
- '}';
- };
- goog.string.Const.unwrap = function(stringConst) {
-
-
-
-
- if (stringConst instanceof goog.string.Const &&
- stringConst.constructor === goog.string.Const &&
- stringConst.STRING_CONST_TYPE_MARKER__GOOG_STRING_SECURITY_PRIVATE_ ===
- goog.string.Const.TYPE_MARKER_) {
- return stringConst
- .stringConstValueWithSecurityContract__googStringSecurityPrivate_;
- } else {
- goog.asserts.fail(
- 'expected object of type Const, got \'' + stringConst + '\'');
- return 'type_error:Const';
- }
- };
- goog.string.Const.from = function(s) {
- return goog.string.Const.create__googStringSecurityPrivate_(s);
- };
- goog.string.Const.TYPE_MARKER_ = {};
- goog.string.Const.create__googStringSecurityPrivate_ = function(s) {
- var stringConst = new goog.string.Const();
- stringConst.stringConstValueWithSecurityContract__googStringSecurityPrivate_ =
- s;
- return stringConst;
- };
- goog.string.Const.EMPTY = goog.string.Const.from('');
|