Esempio n. 1
0
        public PhpString /*!*/ Append(char c)
        {
            if (cow.IsShared)
            {
                cow.Unshare();
                cow = new CowStringBuilder(cow.Builder.ToString(), cow.Builder.Length + 1);
            }

            cow.Builder.Append(c);

            return(this);
        }
Esempio n. 2
0
        internal void SetCharUnchecked(int index, char value)
        {
            Debug.Assert(index >= 0 && index < this.Length);

            if (cow.IsShared)
            {
                cow.Unshare();
                cow = new CowStringBuilder(cow.Builder.ToString());
            }

            cow.Builder[index] = value;
        }
Esempio n. 3
0
        public PhpString /*!*/ Prepend(string str)
        {
            if (cow.IsShared)
            {
                cow.Unshare();
                cow = new CowStringBuilder(str, cow.Builder.ToString());
            }
            else
            {
                cow.Builder.Insert(0, str);
            }

            return(this);
        }
Esempio n. 4
0
        public PhpString /*!*/ Append(string str)
        {
            if (cow.IsShared)
            {
                cow.Unshare();
                cow = new CowStringBuilder(cow.Builder.ToString(), str);
            }
            else
            {
                cow.Builder.Append(str);
            }

            return(this);
        }
Esempio n. 5
0
        public PhpString /*!*/ Append(char c, int count)
        {
            if (count < 0)
            {
                throw new ArgumentOutOfRangeException("count");
            }

            if (count > 0)
            {
                if (cow.IsShared)
                {
                    cow.Unshare();
                    cow = new CowStringBuilder(cow.Builder.ToString(), cow.Builder.Length + count);
                }

                cow.Builder.Append(c, count);
            }

            return(this);
        }
Esempio n. 6
0
		internal void SetCharUnchecked(int index, char value)
		{
            Debug.Assert(index >= 0 && index < this.Length);

            if (cow.IsShared)
            {
                cow.Unshare();
				cow = new CowStringBuilder(cow.Builder.ToString());
			}

			cow.Builder[index] = value;
		}
Esempio n. 7
0
		public PhpString/*!*/ Prepend(string str)
		{
            if (cow.IsShared)
            {
                cow.Unshare();
				cow = new CowStringBuilder(str, cow.Builder.ToString());
			}
			else
			{
				cow.Builder.Insert(0, str);
			}

			return this;
		}
Esempio n. 8
0
		public PhpString/*!*/ Append(char c, int count)
		{
			if (count < 0)
				throw new ArgumentOutOfRangeException("count");

            if (count > 0)
            {
                if (cow.IsShared)
                {
                    cow.Unshare();
                    cow = new CowStringBuilder(cow.Builder.ToString(), cow.Builder.Length + count);
                }

                cow.Builder.Append(c, count);
            }

			return this;
		}
Esempio n. 9
0
		public PhpString/*!*/ Append(char c)
		{
            if (cow.IsShared)
            {
                cow.Unshare();
				cow = new CowStringBuilder(cow.Builder.ToString(), cow.Builder.Length + 1);
			}

			cow.Builder.Append(c);

			return this;
		}
Esempio n. 10
0
		public PhpString/*!*/ Append(string str)
		{
            if (cow.IsShared)
            {
                cow.Unshare();
            	cow = new CowStringBuilder(cow.Builder.ToString(), str);
			}
			else
			{
				cow.Builder.Append(str);
			}

			return this;
		}
Esempio n. 11
0
        /// <summary>
        /// Initialize PhpString with two string values that will be concatenated.
        /// </summary>
        /// <param name="str1">First string value.</param>
        /// <param name="str2">Second string value.</param>
		public PhpString(string str1, string str2)
		{
			this.cow = new CowStringBuilder(str1, str2);
		}
Esempio n. 12
0
		/// <summary>
		/// Lazy copy construction.
		/// </summary>
		/// <param name="phps"></param>
		private PhpString(PhpString phps)
		{
			this.cow = phps.cow.Share();
		}
Esempio n. 13
0
 /// <summary>
 /// Initialize PhpString with two string values that will be concatenated.
 /// </summary>
 /// <param name="str1">First string value.</param>
 /// <param name="str2">Second string value.</param>
 public PhpString(string str1, string str2)
 {
     this.cow = new CowStringBuilder(str1, str2);
 }
Esempio n. 14
0
 /// <summary>
 /// Lazy copy construction.
 /// </summary>
 /// <param name="phps"></param>
 private PhpString(PhpString phps)
 {
     this.cow = phps.cow.Share();
 }