C# Class ABB.SrcML.SrcMLGenerator

The SrcML Generator class provides a convenient wrapper for multiple src2srcml runners, each targetted at a different language.
Inheritance: ABB.SrcML.AbstractGenerator
ファイルを表示 Open project: abb-iss/SrcML.NET Class Usage Examples

Public Methods

Method Description
GenerateSrcMLFileFromDirectory ( string directoryPath, string xmlFileName ) : ABB.SrcML.SrcMLFile

Generate a SrcML document from the given path and place it in the XML file.

GenerateSrcMLFileFromDirectory ( string directoryPath, string xmlFileName, IEnumerable filesToExclude ) : ABB.SrcML.SrcMLFile

Generates a SrcML document from the given path and place it in the XML file. The XML document will only contain files not present in filesToExclude.

GenerateSrcMLFileFromDirectory ( string directoryPath, string xmlFileName, IEnumerable filesToExclude, System.Language languageFilter ) : ABB.SrcML.SrcMLFile
GenerateSrcMLFileFromDirectory ( string directoryPath, string xmlFileName, System.Language languageFilter ) : ABB.SrcML.SrcMLFile

Generate a SrcML document from the given path and place it in the XML file. The file will only contain source files classified as languageFilter.

GenerateSrcMLFileFromFiles ( IEnumerable sourceFileNames, string xmlFileName ) : ABB.SrcML.SrcMLFile

Generates a SrcML document from a collection of source files. The language(s) will be inferred from the file extensions.

GenerateSrcMLFromDirectory ( string directoryPath, string xmlFileName ) : void
GenerateSrcMLFromDirectory ( string directoryPath, string xmlFileName, IEnumerable filesToExclude ) : void
GenerateSrcMLFromDirectory ( string directoryPath, string xmlFileName, IEnumerable filesToExclude, System.Language languageFilter ) : void

Generate a SrcML document from the given path and place it in the XML file. The file will only contain source files classified as languageFilter.

GenerateSrcMLFromDirectory ( string directoryPath, string xmlFileName, System.Language languageFilter ) : void
GenerateSrcMLFromFile ( string sourceFileName, string xmlFileName ) : void

Generate a SrcML document from a single source file. The language will be inferred from the extension.

GenerateSrcMLFromFile ( string sourceFileName, string xmlFileName, System.Language language ) : void

Generate a SrcML document from a single source file.

GenerateSrcMLFromFiles ( IEnumerable sourceFileNames, string xmlFileName ) : void
GenerateSrcMLFromFiles ( IEnumerable sourceFileNames, string xmlFileName, System.Language language ) : void

Generates a SrcML document from a collection of source files using the specified language.

GenerateSrcMLFromString ( string source ) : string

Generate SrcML from a given string of source code. The source code will be parsed as C++.

GenerateSrcMLFromString ( string source, System.Language language ) : string

Generate SrcML from a given string of source code.

RegisterExecutable ( string executableDirectory, IEnumerable languages ) : void

Registers a src2srcml executable to use for the given languages.

RegisterExecutable ( string executableDirectory, IEnumerable languages, IEnumerable namespaceArguments ) : void

Registers a src2srcml executable to use for the given languages.

SrcMLGenerator ( ) : System

Creates a new SrcMLGenerator.

SrcMLGenerator ( string defaultExecutableDirectory ) : System

Creates a new SrcMLGenerator

SrcMLGenerator ( string defaultExecutableDirectory, IEnumerable namespaceArguments ) : System

Creates a new SrcMLGenerator

Protected Methods

Method Description
DetectNonDefaultExecutables ( ) : void

Scans the directory containing the default src2srcml executable and looks for subdirectories corresponding to defined languages. Each of these is registered for the given language.

GenerateImpl ( string inputFileName, string outputFileName ) : bool

Private Methods

Method Description
CreateArgumentsForLanguage ( System.Language language ) : Collection
CreateExtensionMappingForRunner ( ABB.SrcML.Src2SrcMLRunner2 runner ) : Language>.Dictionary

Method Details

DetectNonDefaultExecutables() protected method

Scans the directory containing the default src2srcml executable and looks for subdirectories corresponding to defined languages. Each of these is registered for the given language.
protected DetectNonDefaultExecutables ( ) : void
return void

GenerateImpl() protected method

protected GenerateImpl ( string inputFileName, string outputFileName ) : bool
inputFileName string
outputFileName string
return bool

GenerateSrcMLFileFromDirectory() public method

Generate a SrcML document from the given path and place it in the XML file.
public GenerateSrcMLFileFromDirectory ( string directoryPath, string xmlFileName ) : ABB.SrcML.SrcMLFile
directoryPath string The directory path.
xmlFileName string The path of the xml file.
return ABB.SrcML.SrcMLFile

GenerateSrcMLFileFromDirectory() public method

Generates a SrcML document from the given path and place it in the XML file. The XML document will only contain files not present in filesToExclude.
public GenerateSrcMLFileFromDirectory ( string directoryPath, string xmlFileName, IEnumerable filesToExclude ) : ABB.SrcML.SrcMLFile
directoryPath string The directory path.
xmlFileName string The path of the xml file.
filesToExclude IEnumerable A collection of files to exclude from .
return ABB.SrcML.SrcMLFile

GenerateSrcMLFileFromDirectory() public method

public GenerateSrcMLFileFromDirectory ( string directoryPath, string xmlFileName, IEnumerable filesToExclude, System.Language languageFilter ) : ABB.SrcML.SrcMLFile
directoryPath string
xmlFileName string
filesToExclude IEnumerable
languageFilter System.Language
return ABB.SrcML.SrcMLFile

GenerateSrcMLFileFromDirectory() public method

Generate a SrcML document from the given path and place it in the XML file. The file will only contain source files classified as languageFilter.
public GenerateSrcMLFileFromDirectory ( string directoryPath, string xmlFileName, System.Language languageFilter ) : ABB.SrcML.SrcMLFile
directoryPath string The directory path.
xmlFileName string The path of the xml file.
languageFilter System.Language The language to include.
return ABB.SrcML.SrcMLFile

GenerateSrcMLFileFromFiles() public method

Generates a SrcML document from a collection of source files. The language(s) will be inferred from the file extensions.
public GenerateSrcMLFileFromFiles ( IEnumerable sourceFileNames, string xmlFileName ) : ABB.SrcML.SrcMLFile
sourceFileNames IEnumerable The source files to generate SrcML from.
xmlFileName string The file name to write the resulting XML to.
return ABB.SrcML.SrcMLFile

GenerateSrcMLFromDirectory() public method

public GenerateSrcMLFromDirectory ( string directoryPath, string xmlFileName ) : void
directoryPath string
xmlFileName string
return void

GenerateSrcMLFromDirectory() public method

public GenerateSrcMLFromDirectory ( string directoryPath, string xmlFileName, IEnumerable filesToExclude ) : void
directoryPath string
xmlFileName string
filesToExclude IEnumerable
return void

GenerateSrcMLFromDirectory() public method

Generate a SrcML document from the given path and place it in the XML file. The file will only contain source files classified as languageFilter.
public GenerateSrcMLFromDirectory ( string directoryPath, string xmlFileName, IEnumerable filesToExclude, System.Language languageFilter ) : void
directoryPath string The directory path.
xmlFileName string The path of the xml file.
filesToExclude IEnumerable A collection of files to exclude from .
languageFilter System.Language The language to include.
return void

GenerateSrcMLFromDirectory() public method

public GenerateSrcMLFromDirectory ( string directoryPath, string xmlFileName, System.Language languageFilter ) : void
directoryPath string
xmlFileName string
languageFilter System.Language
return void

GenerateSrcMLFromFile() public method

Generate a SrcML document from a single source file. The language will be inferred from the extension.
public GenerateSrcMLFromFile ( string sourceFileName, string xmlFileName ) : void
sourceFileName string The path of the source file to convert.
xmlFileName string The file name to write the resulting XML to.
return void

GenerateSrcMLFromFile() public method

Generate a SrcML document from a single source file.
public GenerateSrcMLFromFile ( string sourceFileName, string xmlFileName, System.Language language ) : void
sourceFileName string The path to the source file to convert.
xmlFileName string The file name to write the resulting XML to.
language System.Language The language to parse the source file as. If this is Language.Any, then the language will be determined from the file extension.
return void

GenerateSrcMLFromFiles() public method

public GenerateSrcMLFromFiles ( IEnumerable sourceFileNames, string xmlFileName ) : void
sourceFileNames IEnumerable
xmlFileName string
return void

GenerateSrcMLFromFiles() public method

Generates a SrcML document from a collection of source files using the specified language.
public GenerateSrcMLFromFiles ( IEnumerable sourceFileNames, string xmlFileName, System.Language language ) : void
sourceFileNames IEnumerable The source files to generate SrcML from.
xmlFileName string The file name to write the resulting XML to.
language System.Language The language to parse the source files as.
return void

GenerateSrcMLFromString() public method

Generate SrcML from a given string of source code. The source code will be parsed as C++.
public GenerateSrcMLFromString ( string source ) : string
source string A string containing the source code to parse.
return string

GenerateSrcMLFromString() public method

Generate SrcML from a given string of source code.
public GenerateSrcMLFromString ( string source, System.Language language ) : string
source string A string containing the source code to parse.
language System.Language The language to parse the string as. Language.Any is not valid.
return string

RegisterExecutable() public method

Registers a src2srcml executable to use for the given languages.
public RegisterExecutable ( string executableDirectory, IEnumerable languages ) : void
executableDirectory string The directory containing the src2srcml executable to use.
languages IEnumerable A collection of the Languages that should be parsed by this executable.
return void

RegisterExecutable() public method

Registers a src2srcml executable to use for the given languages.
public RegisterExecutable ( string executableDirectory, IEnumerable languages, IEnumerable namespaceArguments ) : void
executableDirectory string The directory containing the src2srcml executable to use.
languages IEnumerable A collection of the Languages that should be parsed by this executable.
namespaceArguments IEnumerable The namespace arguments to use when converting to SrcML.
return void

SrcMLGenerator() public method

Creates a new SrcMLGenerator.
public SrcMLGenerator ( ) : System
return System

SrcMLGenerator() public method

Creates a new SrcMLGenerator
public SrcMLGenerator ( string defaultExecutableDirectory ) : System
defaultExecutableDirectory string The directory containing the default srcml executables to use.
return System

SrcMLGenerator() public method

Creates a new SrcMLGenerator
public SrcMLGenerator ( string defaultExecutableDirectory, IEnumerable namespaceArguments ) : System
defaultExecutableDirectory string The directory containing the default srcml executables to use.
namespaceArguments IEnumerable The namespace arguments to use when converting to SrcML.
return System