Class CsSource
Data model that represents source code.
Inherited Members
Namespace: CodeFactory.DotNet.CSharp
Assembly: CodeFactory.DotNet.dll
Syntax
public abstract class CsSource : CsModel, ICsSource, ICsModel, IDotNetSource, IDotNetModel, IModelStatus, ILookup, IParent, IParent
Constructors
| Improve this Doc View SourceCsSource(bool, bool, bool, SourceCodeType, string, string, string, IReadOnlyList<CsUsingStatement>, IReadOnlyList<CsInterface>, IReadOnlyList<CsClass>, IReadOnlyList<CsStructure>, IReadOnlyList<CsRecord>, IReadOnlyList<CsRecordStructure>, IReadOnlyList<CsDelegate>, IReadOnlyList<CsEnum>, IReadOnlyList<CsNamespace>, bool, string, ModelStore<ICsModel>, IReadOnlyList<ModelLoadException>)
Constructor for the CsSource
Declaration
protected CsSource(bool isLoaded, bool hasErrors, bool loadedFromSource, SourceCodeType language, string lookupPath, string sourceDocument, string parentPath, IReadOnlyList<CsUsingStatement> namespaceReferences, IReadOnlyList<CsInterface> interfaces, IReadOnlyList<CsClass> classes, IReadOnlyList<CsStructure> structures, IReadOnlyList<CsRecord> records, IReadOnlyList<CsRecordStructure> recordStructures, IReadOnlyList<CsDelegate> delegates, IReadOnlyList<CsEnum> enums, IReadOnlyList<CsNamespace> namespaces, bool hostedInProject, string projectName, ModelStore<ICsModel> modelStore = null, IReadOnlyList<ModelLoadException> modelErrors = null)
Parameters
Type | Name | Description |
---|---|---|
bool | isLoaded | Flag that determines if the model was loaded. |
bool | hasErrors | Flag that determine if errors were found creating the model. |
bool | loadedFromSource | Flag that determines if the model was loaded from source code or from an existing library. |
SourceCodeType | language | The target language the model was generated from. |
string | lookupPath | The fully qualified name of the model to be used with the model store. |
string | sourceDocument | The fully qualified path to the source document that loaded this model. |
string | parentPath | The fully qualified path to the parent model of this model. |
IReadOnlyList<CsUsingStatement> | namespaceReferences | The namespace reference in the source. |
IReadOnlyList<CsInterface> | interfaces | The interfaces that are define in this source. |
IReadOnlyList<CsClass> | classes | The classes that are defined in this source. |
IReadOnlyList<CsStructure> | structures | The structures that are defined in this source. |
IReadOnlyList<CsRecord> | records | The records that are defined in this source. |
IReadOnlyList<CsRecordStructure> | recordStructures | The record structures that are defined in this source. |
IReadOnlyList<CsDelegate> | delegates | The delegates that are defined in this source. |
IReadOnlyList<CsEnum> | enums | The enumerations defined in this source. |
IReadOnlyList<CsNamespace> | namespaces | The namespaces that are defined in this source. |
bool | hostedInProject | |
string | projectName | |
ModelStore<ICsModel> | modelStore | Optional the lookup storage for models created during the compile or lookup of the model. |
IReadOnlyList<ModelLoadException> | modelErrors | Optional the error that occurred while creating the model. |
Properties
| Improve this Doc View SourceClasses
The classes that were defined in the source.
Declaration
public IReadOnlyList<CsClass> Classes { get; }
Property Value
Type | Description |
---|---|
IReadOnlyList<CsClass> |
Delegates
The delegates that were defined in the source.
Declaration
public IReadOnlyList<CsDelegate> Delegates { get; }
Property Value
Type | Description |
---|---|
IReadOnlyList<CsDelegate> |
Enums
The enumerations that were defined in the source.
Declaration
public IReadOnlyList<CsEnum> Enums { get; }
Property Value
Type | Description |
---|---|
IReadOnlyList<CsEnum> |
HostedInProject
Flag that determines if the source code was hosted in a project.
Declaration
public bool HostedInProject { get; }
Property Value
Type | Description |
---|---|
bool |
Interfaces
The interfaces that were defined in the source.
Declaration
public IReadOnlyList<CsInterface> Interfaces { get; }
Property Value
Type | Description |
---|---|
IReadOnlyList<CsInterface> |
LookupPath
The fully qualified path for this model that can be used when searching the source for the model.
Declaration
public string LookupPath { get; }
Property Value
Type | Description |
---|---|
string |
NamespaceReferences
The namespaces that are used as references to access other libraries not hosted in the source document.
Declaration
public IReadOnlyList<CsUsingStatement> NamespaceReferences { get; }
Property Value
Type | Description |
---|---|
IReadOnlyList<CsUsingStatement> |
Namespaces
The namespaces that were defined in the source.
Declaration
public IReadOnlyList<CsNamespace> Namespaces { get; }
Property Value
Type | Description |
---|---|
IReadOnlyList<CsNamespace> |
Parent
The parent to the current model. This will return null if there is no parent for this model, or the parent could not be located.
Declaration
public CsModel Parent { get; }
Property Value
Type | Description |
---|---|
CsModel |
ProjectName
The name of the project the source is hosted in. This will be null if this source is not hosted in a project.
Declaration
public string ProjectName { get; }
Property Value
Type | Description |
---|---|
string |
Records
The records that were defined in the source.
Declaration
public IReadOnlyList<CsRecord> Records { get; }
Property Value
Type | Description |
---|---|
IReadOnlyList<CsRecord> |
RecordStructures
The record structures that were defined in the source.
Declaration
public IReadOnlyList<CsRecordStructure> RecordStructures { get; }
Property Value
Type | Description |
---|---|
IReadOnlyList<CsRecordStructure> |
Structures
The structures that were defined in the source.
Declaration
public IReadOnlyList<CsStructure> Structures { get; }
Property Value
Type | Description |
---|---|
IReadOnlyList<CsStructure> |
Methods
| Improve this Doc View SourceAddToBeginningAsync(string)
Adds the source code to the beginning of the ICsSource model.
Declaration
public abstract Task<CsSource> AddToBeginningAsync(string sourceCode)
Parameters
Type | Name | Description |
---|---|---|
string | sourceCode | The source code that is to be added to the document. |
Returns
Type | Description |
---|---|
Task<CsSource> | A newly loaded copy of the ICsSource model after the changes have been applied. |
Exceptions
Type | Condition |
---|---|
DocumentException | Error is raised when errors occur updating the source document. |
AddToEndAsync(string)
Adds the source code the end of the ICsSource model.
Declaration
public abstract Task<CsSource> AddToEndAsync(string sourceCode)
Parameters
Type | Name | Description |
---|---|---|
string | sourceCode | The source code that is to be added to the document. |
Returns
Type | Description |
---|---|
Task<CsSource> | A newly loaded copy of the ICsSource model after the changes have been applied. |
Exceptions
Type | Condition |
---|---|
DocumentException | Error is raised when errors occur updating the source document. |
DeleteAsync()
Deletes the content from the ICsSource model.
Declaration
public abstract Task<CsSource> DeleteAsync()
Returns
Type | Description |
---|---|
Task<CsSource> | A newly loaded copy of the ICsSource model after the delegate has been removed from the document. |
Exceptions
Type | Condition |
---|---|
DocumentException | Error is raised when errors occur updating the source document. |
ReplaceAsync(string)
Replaces the content of the ICsSource model.
Declaration
public abstract Task<CsSource> ReplaceAsync(string sourceCode)
Parameters
Type | Name | Description |
---|---|---|
string | sourceCode | The source code that is to be used to replace the original definition in the document. |
Returns
Type | Description |
---|---|
Task<CsSource> | A newly loaded copy of the ICsSource model after the changes have been applied. |
Exceptions
Type | Condition |
---|---|
DocumentException | Error is raised when errors occur updating the source document. |
Explicit Interface Implementations
| Improve this Doc View SourceIDotNetSource.Classes
The classes that were defined in the source.
Declaration
IReadOnlyList<IDotNetClass> IDotNetSource.Classes { get; }
Returns
Type | Description |
---|---|
IReadOnlyList<IDotNetClass> |
IDotNetSource.Delegates
The delegates that were defined in the source.
Declaration
IReadOnlyList<IDotNetDelegate> IDotNetSource.Delegates { get; }
Returns
Type | Description |
---|---|
IReadOnlyList<IDotNetDelegate> |
IDotNetSource.Enums
The enumerations that were defined in the source.
Declaration
IReadOnlyList<IDotNetEnum> IDotNetSource.Enums { get; }
Returns
Type | Description |
---|---|
IReadOnlyList<IDotNetEnum> |
IDotNetSource.Interfaces
The interfaces that were defined in the source.
Declaration
IReadOnlyList<IDotNetInterface> IDotNetSource.Interfaces { get; }
Returns
Type | Description |
---|---|
IReadOnlyList<IDotNetInterface> |
IDotNetSource.NamespaceReferences
The namespaces that are used as references to access other libraries not hosted in the source document.
Declaration
IReadOnlyList<IDotNetNamespaceReference> IDotNetSource.NamespaceReferences { get; }
Returns
Type | Description |
---|---|
IReadOnlyList<IDotNetNamespaceReference> |
IDotNetSource.Namespaces
The namespaces that were defined in the source.
Declaration
IReadOnlyList<IDotNetNamespace> IDotNetSource.Namespaces { get; }
Returns
Type | Description |
---|---|
IReadOnlyList<IDotNetNamespace> |
IDotNetSource.Records
The records that were defined in the source.
Declaration
IReadOnlyList<IDotNetRecord> IDotNetSource.Records { get; }
Returns
Type | Description |
---|---|
IReadOnlyList<IDotNetRecord> |
IDotNetSource.RecordStructures
The record structures that were defined in the source.
Declaration
IReadOnlyList<IDotNetRecordStructure> IDotNetSource.RecordStructures { get; }
Returns
Type | Description |
---|---|
IReadOnlyList<IDotNetRecordStructure> |
IDotNetSource.Structures
The structures that were defined in the source.
Declaration
IReadOnlyList<IDotNetStructure> IDotNetSource.Structures { get; }
Returns
Type | Description |
---|---|
IReadOnlyList<IDotNetStructure> |
IParent.Parent
The parent to the current model. This will return null if there is no parent for this model, or the parent could not be located.
Declaration
IDotNetModel IParent.Parent { get; }
Returns
Type | Description |
---|---|
IDotNetModel |