C# Class ABB.Swum.ContextBuilder

Contains various helper functions to build context objects from SrcML.
Show file Open project: abb-iss/Swum.NET

Public Methods

Method Description
BuildFieldContext ( System.Xml.Linq.XElement declElement ) : FieldContext

Builds a FieldContext object based on the given field element.

BuildMethodContext ( System.Xml.Linq.XElement methodTag ) : MethodContext

Builds a MethodContext object based on the given method element.

ConstructTypeName ( System.Xml.Linq.XElement typeElement ) : string

Extracts the type name from a type srcML element. A type element may contain several name and type modifier elements. This function returns only the actual type name, ignoring any access modifiers, such as static, private or public. Type modifiers such as '*' or '&' are treated as part of the type name and concatenated with the name text.

ConstructTypeName ( System.Xml.Linq.XElement typeElement, bool &isPrimitive ) : string

Extracts the type name from a type srcML element. A type element may contain several name and type modifier elements. This function returns only the actual type name, ignoring any access modifiers, such as static, private or public. Type modifiers such as '*' or '&' are treated as part of the type name and concatenated with the name text.

Private Methods

Method Description
FindEnclosingClassElement ( System.Xml.Linq.XElement startElement ) : System.Xml.Linq.XElement

Finds the nearest class or struct element that encloses the given element.

GetNameFromNameElement ( System.Xml.Linq.XElement nameElement ) : string

Given a name element, this function extracts the identifier name from it. A name element may potentially contain several child name elements. For example, when a name has the form [ClassName]::[Identifier]. This function assumes that the last child name element is the desired name, and returns that. If there are no child name elements, the text of the name element is returned.

Method Details

BuildFieldContext() public static method

Builds a FieldContext object based on the given field element.
Thrown if the passed XElement does not represent a decl element.
public static BuildFieldContext ( System.Xml.Linq.XElement declElement ) : FieldContext
declElement System.Xml.Linq.XElement An XElement representing the decl element of the field.
return FieldContext

BuildMethodContext() public static method

Builds a MethodContext object based on the given method element.
The passed XElement does not represent a function, constructor, or destructor element. methodTag is null.
public static BuildMethodContext ( System.Xml.Linq.XElement methodTag ) : MethodContext
methodTag System.Xml.Linq.XElement An XElement representing the method to build the context for. This can be either a function, constructor or destructor element.
return MethodContext

ConstructTypeName() public static method

Extracts the type name from a type srcML element. A type element may contain several name and type modifier elements. This function returns only the actual type name, ignoring any access modifiers, such as static, private or public. Type modifiers such as '*' or '&' are treated as part of the type name and concatenated with the name text.
typeElement does not represent a type element.
public static ConstructTypeName ( System.Xml.Linq.XElement typeElement ) : string
typeElement System.Xml.Linq.XElement A type srcML element.
return string

ConstructTypeName() public static method

Extracts the type name from a type srcML element. A type element may contain several name and type modifier elements. This function returns only the actual type name, ignoring any access modifiers, such as static, private or public. Type modifiers such as '*' or '&' are treated as part of the type name and concatenated with the name text.
typeElement does not represent a type element.
public static ConstructTypeName ( System.Xml.Linq.XElement typeElement, bool &isPrimitive ) : string
typeElement System.Xml.Linq.XElement A type srcML element.
isPrimitive bool An output parameter indicating whether the type is a primitive data type.
return string