Esempio n. 1
0
        /// <summary>
        /// Creates a JSString wrapper from a JS string pointer.
        /// If the pointer is zero, null is returned.
        /// </summary>
        public static JSString New(JSContextPtr context, JSStringPtr str)
        {
            if (str.IsZero)
            {
                return(null);
            }

            return(new JSString(context, str));
        }
Esempio n. 2
0
        /// <summary>
        /// Wraps existing reference and roots it.
        /// </summary>
        /// <param name="context"></param>
        /// <param name="str"></param>
        public JSString(
            JSContextPtr context,
            JSStringPtr str
            )
        {
            if (context.IsZero)
            {
                throw new ArgumentNullException("context");
            }

            Context = context;
            Root    = new Rooted <JSStringPtr>(Context, str);
        }
Esempio n. 3
0
        public bool TryGetNested(out JSStringPtr result, params string[] propertyNames)
        {
            JS.Value temp;

            if (TryGetNested(out temp, propertyNames))
            {
                if (temp.ValueType == JSValueType.STRING)
                {
                    result = temp.AsString;
                    return(true);
                }
            }

            result = default(JSStringPtr);
            return(false);
        }
Esempio n. 4
0
 /// <summary>
 /// WARNING: Make sure this string is already rooted!
 /// </summary>
 /// <param name="s"></param>
 public Value(JSStringPtr s)
 {
     this       = default(Value);
     tag        = JSValueTag.STRING;
     packed.str = s;
 }