This class provides a strong typing for a XRI subsegment. Any obj of this class that appears outside of the package is a valid subsegment.
상속: Parsable
예제 #1
0
 public bool Equals(XRISubSegment subseg)
 {
     return ToString(true).Equals(subseg.ToString(true));
 }
예제 #2
0
 public bool EqualsIgnoreCase(XRISubSegment subseg)
 {
     return ToString(true).Equals(subseg.ToString(true), StringComparison.InvariantCultureIgnoreCase);
 }
예제 #3
0
        /// <summary>
        /// Parses the input stream into the obj
        /// </summary>
        /// <param name="oXRISegStream">The input stream to scan from</param>
        /// <returns>True if part of the Stream was consumed into the obj</returns>
        bool doScan(ParseStream oXRISegStream)
        {
            moSubSegments = new List<XRISubSegment>();
            bool bAllowImpliedDelimiter = mbAllowImpliedDelimiter;
            bool bAllowReassignable = mbAllowReassignable;

            // loop through the stream, but don't consume the real string unless
            // we are successful
            while (!oXRISegStream.empty())
            {
                // determine if we have a delimiter for the next subsegment
                char c = oXRISegStream.getData()[0];

                // break out if the first character has to be persistent and isn't
                if ((!bAllowReassignable) && (c != XRI.PDELIM))
                {
                    break;
                }

                // check if we have a valid non-null subsegment
                XRISubSegment oSubSegment = new XRISubSegment(bAllowImpliedDelimiter, mbAllowColon);
                if (oSubSegment.scan(oXRISegStream))
                {
                    // if we had a valid sub-segment, consume it and add it to the list
                    moSubSegments.Add(oSubSegment);
                }
                else
                {
                    break;
                }

                bAllowImpliedDelimiter = false;
                bAllowReassignable = true;
            }

            // if we have subsegments, we are good.  Otherwise, it is an error
            if (moSubSegments.Count > 0)
            {
                return true;
            }

            moSubSegments = null;
            return false;
        }