Ejemplo n.º 1
0
        public static XElement GetElement(SrcMLArchive archive, SrcMLLocation location)
        {
            string fileName = location.SourceFileName;
            string query = location.XPath;

            var unit = archive.GetXElementForSourceFile(fileName);
            var element = unit.XPathSelectElement(query, SrcMLNamespaces.Manager);

            return element;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Adds a new srcML location to this scope.
        /// </summary>
        /// <param name="location">the location to add</param>
        public virtual void AddSourceLocation(SrcMLLocation location)
        {
            Collection <SrcMLLocation> locationsForFile;

            if (!LocationDictionary.TryGetValue(location.SourceFileName, out locationsForFile))
            {
                locationsForFile = new Collection <SrcMLLocation>();
                LocationDictionary[location.SourceFileName] = locationsForFile;
            }
            locationsForFile.Add(location);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Processes the child of the current reader position into a child of this object.
 /// </summary>
 /// <param name="reader">The XML reader</param>
 protected override void ReadXmlChild(XmlReader reader)
 {
     if (SrcMLLocation.XmlName == reader.Name)
     {
         Location = XmlSerialization.DeserializeSrcMLLocation(reader);
     }
     else if (XmlComponentsName == reader.Name)
     {
         AddComponents(XmlSerialization.ReadChildExpressions(reader));
     }
 }
Ejemplo n.º 4
0
        public static XElement GetElement(SrcMLArchive archive, SrcMLLocation location) {
            string fileName = location.SourceFileName;
            string query = location.XPath;

            var unit = archive.GetXElementForSourceFile(fileName);

            var startingLength = fileName.Length + 23;
            var path = query.Substring(startingLength);
            var element = unit.XPathSelectElement(path, SrcMLNamespaces.Manager);

            return element;
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Creates a location object for the given
        /// <paramref name="element"/>.
        /// </summary>
        /// <param name="element">The element to create a location for</param>
        /// <returns>The new location object. The <see cref="SourceLocation.SourceFileName"/> will
        /// be set to see cref="FileName"/></returns>
        public SrcMLLocation CreateLocation(XElement element)
        {
            var location = new SrcMLLocation(element, this.FileName);

            return(location);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Creates a location object for the given
        /// <paramref name="element"/>.
        /// </summary>
        /// <param name="element">The element to create a location for</param>
        /// <param name="isReference">whether or not this is a reference location</param>
        /// <returns>The new location object. The <see cref="SourceLocation.SourceFileName"/> will
        /// be set to see cref="FileName"/></returns>
        public SrcMLLocation CreateLocation(XElement element, bool isReference)
        {
            var location = new SrcMLLocation(element, this.FileName, isReference);

            return(location);
        }
Ejemplo n.º 7
0
 /// <summary>
 /// Add the given SrcMLLocation to the Locations collection.
 /// </summary>
 /// <param name="location">The location to add.</param>
 public virtual void AddLocation(SrcMLLocation location)
 {
     LocationList.Add(location);
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Creates a location object for the given <paramref name="element"/>.
 /// </summary>
 /// <param name="element">The element to create a location for</param>
 /// <returns>The new location object. The <see cref="SourceLocation.SourceFileName"/> will be set to <see cref="FileName"/></returns>
 public SrcMLLocation CreateLocation(XElement element) {
     var location = new SrcMLLocation(element, this.FileName);
     return location;
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Creates a location object for the given <paramref name="element"/>.
 /// </summary>
 /// <param name="element">The element to create a location for</param>
 /// <param name="isReference">whether or not this is a reference location</param>
 /// <returns>The new location object. The <see cref="SourceLocation.SourceFileName"/> will be set to <see cref="FileName"/></returns>
 public SrcMLLocation CreateLocation(XElement element, bool isReference) {
     var location = new SrcMLLocation(element, this.FileName, isReference);
     return location;
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Processes the child of the current reader position into a child of this object.
 /// </summary>
 /// <param name="reader">The XML reader</param>
 protected override void ReadXmlChild(XmlReader reader) {
     if(SrcMLLocation.XmlName == reader.Name) {
         Location = XmlSerialization.DeserializeSrcMLLocation(reader);
     } else if(XmlComponentsName == reader.Name) {
         AddComponents(XmlSerialization.ReadChildExpressions(reader));
     }
 }