OpenPetra
Free Administration Software for Non-Profits
Ict.Tools.CodeGeneration.CSParser Class Reference

A wrapper for NRefactory from SharpDevelop More...

Public Member Functions

 CSParser (string filename)
 constructor, parse the given file More...
 
CompilationUnit ParseFile (string fileName)
 parse a c# file More...
 
List< NamespaceDeclaration > GetNamespaces ()
 get all namespaces in the current file More...
 
List< TypeDeclaration > GetClasses ()
 overload that just uses the compilationunit of the current file More...
 
TypeDeclaration GetType (ref string ANamespace, string ATypeName, ClassType AClassType)
 get a specific interface More...
 
TypeDeclaration GetInterface (string ANamespace, string AInterfaceName)
 get a specific interface More...
 
TypeDeclaration GetClass (string AClassName)
 get a specific class More...
 
string GetFullClassNameWithNamespace (TypeDeclaration AClassNode)
 get the full name of a class with namespace separated by a dot More...
 

Static Public Member Functions

static List< TypeDeclaration > GetClassesInNamespace (List< CSParser >ACSFiles, string ANamespace)
 get all classes in that namespace More...
 
static List< NamespaceDeclaration > GetNamespaces (CompilationUnit cu)
 get all the namespaces from the file More...
 
static List< TypeDeclaration > GetClasses (CompilationUnit cu)
 get all classes defined in this file More...
 
static List< TypeDeclaration > GetClasses (NamespaceDeclaration nd)
 get all classes defined in this namespace More...
 
static StringCollection GetFields (TypeDeclaration cnode)
 
static List< PropertyDeclaration > GetProperties (TypeDeclaration cnode)
 
static List< MethodDeclaration > GetMethods (TypeDeclaration AClass)
 get all methods of the class More...
 
static string GetImplementedInterface (TypeDeclaration AClass)
 get the first interface that this class implements More...
 
static List< ConstructorDeclaration > GetConstructors (TypeDeclaration AClass)
 get all constructors of the class More...
 
static MethodDeclaration GetMethod (TypeDeclaration cnode, string AMethodName)
 
static TypeDeclaration FindClass (List< CSParser >ACSFiles, string AClassName)
 find a class in a list of csharp files More...
 
static TypeDeclaration FindInterface (List< CSParser >ACSFiles, string ANamespace, string AInterfaceName)
 find an interface in a list of csharp files More...
 
static string GetSourceDirectory (string ns)
 Reads the nsmap generated from GenerateNamespaceMap and get the directory that includes this namespace More...
 
static List< CSParserGetCSFilesForDirectory (string dir, SearchOption option)
 Returns CSParser instances for the cs files in the given directory. If you get the list more then one time, then you will get a cached copy More...
 
static List< TypeDeclaration > GetWebConnectorClasses (string AServerNamespace)
 get the web connector classes that fit the server namespace More...
 
static MethodDeclaration GetWebConnectorMethod (List< TypeDeclaration >AWebConnectorClasses, string AWebFunction, string ATablename, out TypeDeclaration AClassOfFoundMethod)
 check if there is a webconnector method for that table and function, eg CreateNew + AApDocument More...
 

Static Public Attributes

static string ICTPath
 contains the path for the csharp/ICT directory, eg. u:\openpetraorg\csharp\ICT More...
 

Detailed Description

A wrapper for NRefactory from SharpDevelop

Constructor & Destructor Documentation

◆ CSParser()

Ict.Tools.CodeGeneration.CSParser.CSParser ( string  filename)
inline

constructor, parse the given file

Parameters
filename

Member Function Documentation

◆ FindClass()

static TypeDeclaration Ict.Tools.CodeGeneration.CSParser.FindClass ( List< CSParser ACSFiles,
string  AClassName 
)
inlinestatic

find a class in a list of csharp files

Parameters
ACSFiles
AClassName
Returns
null if class cannot be found

◆ FindInterface()

static TypeDeclaration Ict.Tools.CodeGeneration.CSParser.FindInterface ( List< CSParser ACSFiles,
string  ANamespace,
string  AInterfaceName 
)
inlinestatic

find an interface in a list of csharp files

Parameters
ACSFiles
ANamespace
AInterfaceName
Returns
null if class cannot be found

◆ GetClass()

TypeDeclaration Ict.Tools.CodeGeneration.CSParser.GetClass ( string  AClassName)
inline

get a specific class

Returns

◆ GetClasses() [1/3]

List< TypeDeclaration > Ict.Tools.CodeGeneration.CSParser.GetClasses ( )
inline

overload that just uses the compilationunit of the current file

Returns

◆ GetClasses() [2/3]

static List< TypeDeclaration > Ict.Tools.CodeGeneration.CSParser.GetClasses ( CompilationUnit  cu)
inlinestatic

get all classes defined in this file

Returns

◆ GetClasses() [3/3]

static List< TypeDeclaration > Ict.Tools.CodeGeneration.CSParser.GetClasses ( NamespaceDeclaration  nd)
inlinestatic

get all classes defined in this namespace

Returns

◆ GetClassesInNamespace()

static List< TypeDeclaration > Ict.Tools.CodeGeneration.CSParser.GetClassesInNamespace ( List< CSParser ACSFiles,
string  ANamespace 
)
inlinestatic

get all classes in that namespace

Parameters
ACSFiles
ANamespace
Returns
list of classes

◆ GetConstructors()

static List< ConstructorDeclaration > Ict.Tools.CodeGeneration.CSParser.GetConstructors ( TypeDeclaration  AClass)
inlinestatic

get all constructors of the class

Returns

◆ GetCSFilesForDirectory()

static List< CSParser > Ict.Tools.CodeGeneration.CSParser.GetCSFilesForDirectory ( string  dir,
SearchOption  option 
)
inlinestatic

Returns CSParser instances for the cs files in the given directory. If you get the list more then one time, then you will get a cached copy

Parameters
dirstring with the directory to parse
optionsearch the subdirectories or not
Returns
List of CSParser instances

◆ GetFields()

static StringCollection Ict.Tools.CodeGeneration.CSParser.GetFields ( TypeDeclaration  cnode)
inlinestatic
Returns
a string collection of the field names of the class

◆ GetFullClassNameWithNamespace()

string Ict.Tools.CodeGeneration.CSParser.GetFullClassNameWithNamespace ( TypeDeclaration  AClassNode)
inline

get the full name of a class with namespace separated by a dot

Parameters
AClassNodethe node of the class
Returns

◆ GetImplementedInterface()

static string Ict.Tools.CodeGeneration.CSParser.GetImplementedInterface ( TypeDeclaration  AClass)
inlinestatic

get the first interface that this class implements

Returns

◆ GetInterface()

TypeDeclaration Ict.Tools.CodeGeneration.CSParser.GetInterface ( string  ANamespace,
string  AInterfaceName 
)
inline

get a specific interface

Returns

◆ GetMethod()

static MethodDeclaration Ict.Tools.CodeGeneration.CSParser.GetMethod ( TypeDeclaration  cnode,
string  AMethodName 
)
inlinestatic

return the method by name

◆ GetMethods()

static List< MethodDeclaration > Ict.Tools.CodeGeneration.CSParser.GetMethods ( TypeDeclaration  AClass)
inlinestatic

get all methods of the class

Returns

◆ GetNamespaces() [1/2]

List< NamespaceDeclaration > Ict.Tools.CodeGeneration.CSParser.GetNamespaces ( )
inline

get all namespaces in the current file

Returns

◆ GetNamespaces() [2/2]

static List< NamespaceDeclaration > Ict.Tools.CodeGeneration.CSParser.GetNamespaces ( CompilationUnit  cu)
inlinestatic

get all the namespaces from the file

Returns

◆ GetProperties()

static List< PropertyDeclaration > Ict.Tools.CodeGeneration.CSParser.GetProperties ( TypeDeclaration  cnode)
inlinestatic
Returns
a list of the properties of the class

◆ GetSourceDirectory()

static string Ict.Tools.CodeGeneration.CSParser.GetSourceDirectory ( string  ns)
inlinestatic

Reads the nsmap generated from GenerateNamespaceMap and get the directory that includes this namespace

Parameters
ns
Returns

◆ GetType()

TypeDeclaration Ict.Tools.CodeGeneration.CSParser.GetType ( ref string  ANamespace,
string  ATypeName,
ClassType  AClassType 
)
inline

get a specific interface

Returns

◆ GetWebConnectorClasses()

static List< TypeDeclaration > Ict.Tools.CodeGeneration.CSParser.GetWebConnectorClasses ( string  AServerNamespace)
inlinestatic

get the web connector classes that fit the server namespace

Parameters
AServerNamespace
Returns

◆ GetWebConnectorMethod()

static MethodDeclaration Ict.Tools.CodeGeneration.CSParser.GetWebConnectorMethod ( List< TypeDeclaration >  AWebConnectorClasses,
string  AWebFunction,
string  ATablename,
out TypeDeclaration  AClassOfFoundMethod 
)
inlinestatic

check if there is a webconnector method for that table and function, eg CreateNew + AApDocument

Parameters
AWebConnectorClasses
AWebFunction
ATablename
AClassOfFoundMethod
Returns

◆ ParseFile()

CompilationUnit Ict.Tools.CodeGeneration.CSParser.ParseFile ( string  fileName)
inline

parse a c# file

Parameters
fileName
Returns

Member Data Documentation

◆ ICTPath

string Ict.Tools.CodeGeneration.CSParser.ICTPath
static

contains the path for the csharp/ICT directory, eg. u:\openpetraorg\csharp\ICT


The documentation for this class was generated from the following file: