13 changed files with 124 additions and 206 deletions
@ -1,92 +0,0 @@ |
|||||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
|
||||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
|
||||||
|
|
||||||
using ICSharpCode.XmlEditor; |
|
||||||
using System; |
|
||||||
using ICSharpCode.NRefactory; |
|
||||||
|
|
||||||
namespace ICSharpCode.XamlBinding |
|
||||||
{ |
|
||||||
/// <summary>
|
|
||||||
/// Description of QualifiedNameWithLocation.
|
|
||||||
/// </summary>
|
|
||||||
public class QualifiedNameWithLocation : IEquatable<QualifiedNameWithLocation> { |
|
||||||
public QualifiedName QualifiedName { get; private set; } |
|
||||||
|
|
||||||
public int Offset { get; private set; } |
|
||||||
|
|
||||||
public string Name { |
|
||||||
get { |
|
||||||
return QualifiedName.Name; |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
public string Namespace { |
|
||||||
get { |
|
||||||
return QualifiedName.Namespace; |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
public string Prefix { |
|
||||||
get { |
|
||||||
return QualifiedName.Prefix; |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
public string FullXmlName { |
|
||||||
get { |
|
||||||
string name = Prefix; |
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(name)) |
|
||||||
name += ":"; |
|
||||||
|
|
||||||
name += Name; |
|
||||||
return name; |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
public QualifiedNameWithLocation(string localName, string namespaceName, string prefix, int offset) { |
|
||||||
QualifiedName = new QualifiedName(localName, namespaceName, prefix); |
|
||||||
Offset = offset; |
|
||||||
} |
|
||||||
|
|
||||||
public override bool Equals(object obj) |
|
||||||
{ |
|
||||||
return Equals(obj as QualifiedNameWithLocation); |
|
||||||
} |
|
||||||
|
|
||||||
public override int GetHashCode() |
|
||||||
{ |
|
||||||
return QualifiedName.GetHashCode() ^ Offset.GetHashCode(); |
|
||||||
} |
|
||||||
|
|
||||||
public bool Equals(QualifiedNameWithLocation other) |
|
||||||
{ |
|
||||||
if (other == null) |
|
||||||
return false; |
|
||||||
|
|
||||||
return other.QualifiedName == QualifiedName && |
|
||||||
other.Offset == Offset; |
|
||||||
} |
|
||||||
|
|
||||||
public static bool operator ==(QualifiedNameWithLocation lhs, QualifiedNameWithLocation rhs) |
|
||||||
{ |
|
||||||
if ((object)lhs == null && (object)rhs == null) |
|
||||||
return true; |
|
||||||
if ((object)lhs == null) |
|
||||||
return false; |
|
||||||
|
|
||||||
return lhs.Equals(rhs); |
|
||||||
} |
|
||||||
|
|
||||||
public static bool operator !=(QualifiedNameWithLocation lhs, QualifiedNameWithLocation rhs) |
|
||||||
{ |
|
||||||
return !(lhs == rhs); |
|
||||||
} |
|
||||||
|
|
||||||
public override string ToString() |
|
||||||
{ |
|
||||||
return this.QualifiedName + " Offset: " + Offset; |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
@ -1,14 +0,0 @@ |
|||||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
|
||||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
|
||||||
|
|
||||||
using System; |
|
||||||
|
|
||||||
namespace ICSharpCode.XamlBinding |
|
||||||
{ |
|
||||||
public class XamlCompletionSettings |
|
||||||
{ |
|
||||||
public XamlCompletionSettings() |
|
||||||
{ |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
@ -1,54 +0,0 @@ |
|||||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
|
||||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
|
||||||
|
|
||||||
using System; |
|
||||||
using System.Text; |
|
||||||
using ICSharpCode.NRefactory.TypeSystem; |
|
||||||
using ICSharpCode.XmlEditor; |
|
||||||
|
|
||||||
namespace ICSharpCode.XamlBinding |
|
||||||
{ |
|
||||||
/// <summary>
|
|
||||||
/// Represents the context of a location in a XAML document.
|
|
||||||
/// </summary>
|
|
||||||
public sealed class XamlExpressionContext |
|
||||||
{ |
|
||||||
public static readonly XamlExpressionContext Empty = new XamlExpressionContext(new XmlElementPath(), null, false); |
|
||||||
|
|
||||||
public XmlElementPath ElementPath { get; private set; } |
|
||||||
public string AttributeName { get; private set; } |
|
||||||
public bool InAttributeValue { get; private set; } |
|
||||||
|
|
||||||
public XamlExpressionContext(XmlElementPath elementPath, string attributeName, bool inAttributeValue) |
|
||||||
{ |
|
||||||
if (elementPath == null) |
|
||||||
throw new ArgumentNullException("elementPath"); |
|
||||||
this.ElementPath = elementPath; |
|
||||||
this.AttributeName = attributeName; |
|
||||||
this.InAttributeValue = inAttributeValue; |
|
||||||
} |
|
||||||
|
|
||||||
public override string ToString() |
|
||||||
{ |
|
||||||
StringBuilder b = new StringBuilder(); |
|
||||||
b.Append("[XamlExpressionContext "); |
|
||||||
for (int i = 0; i < ElementPath.Elements.Count; i++) { |
|
||||||
if (i > 0) b.Append(">"); |
|
||||||
if (!string.IsNullOrEmpty(ElementPath.Elements[i].Prefix)) { |
|
||||||
b.Append(ElementPath.Elements[i].Prefix); |
|
||||||
b.Append(':'); |
|
||||||
} |
|
||||||
b.Append(ElementPath.Elements[i].Name); |
|
||||||
} |
|
||||||
if (AttributeName != null) { |
|
||||||
b.Append(" AttributeName="); |
|
||||||
b.Append(AttributeName); |
|
||||||
if (InAttributeValue) { |
|
||||||
b.Append(" InAttributeValue"); |
|
||||||
} |
|
||||||
} |
|
||||||
b.Append("]"); |
|
||||||
return b.ToString(); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
Loading…
Reference in new issue