Public Scanner is a new OLE PUBLIC class, which makes it possible to empower your VFP projects with +CodeInspector functionality. Now you can perform fully automated error scan of source codes right from your own projects.
The most useful and appropriate application of Public Scanner can be found in the case of group project development. Usually, it is required to use special tools for storing and accessing source files of the project to manage modifications that are made by each developer. But, these tools (concerning VFP) can not inspect each modified file for errors or warnings. It is quite a difficult task to monitor changes that were made and keep current version of end project error-proof.
We provide you with an opportunity to solve this problem through our new Public Scanner. Imaging, that each time a source code from the shared storage is changed by one developer and saved, it is instantly being checked with +CodeInspector scanner to reveal errors. You check every part of the project each time anyone modifies it. As the result, you can control changes in the whole project and you can be sure that it contains no errors.
That is just an example of how you can integrate Public Scanner in your projects. Your ideas will surely open new ways of application. We sincerely wish you the best of luck and guarantee our assistance on using +CodeInspector!
Below you'll find: Example 1 | Example 2 | Developer Reference (Properties, Mehtods)
public oInspector
oInspector = null
oInspector = CreateObject("FoxMasters.CodeInspectorScanner")
if !isnull( oInspector )
oInspector.oVfpApplication = _VFP
do case
case val( version(4) ) = 9
oInspector.LoadCodeFromFile("c:\Program Files\Microsoft Visual FoxPro 9\Ffc\_system.vcx")
case val( version(4) ) = 8
oInspector.LoadCodeFromFile("c:\Program Files\Microsoft Visual FoxPro 8\Ffc\_system.vcx")
case val( version(4) ) = 7
oInspector.LoadCodeFromFile("c:\Program Files\Microsoft Visual FoxPro 7\Ffc\_system.vcx")
case val( version(4) ) = 6
oInspector.LoadCodeFromFile("c:\Program Files\Microsoft Visual FoxPro 6\Ffc\_system.vcx")
endcase
oInspector.Scan()
oInspector.ShowMessage(0)
endif
public oInspector
oInspector = null
oInspector = NewObject("CodeInspectorScanner","poci_publicscanner.prg",
"C:\Program Files\FoxMasters\+CodeInspector 4.0\+CodeInspector.exe" )
if !isnull( oInspector )
oInspector.oVfpApplication = _VFP
do case
case val( version(4) ) = 9
oInspector.LoadCodeFromFile("c:\Program Files\Microsoft Visual FoxPro 9\Ffc\_system.vcx")
case val( version(4) ) = 8
oInspector.LoadCodeFromFile("c:\Program Files\Microsoft Visual FoxPro 8\Ffc\_system.vcx")
case val( version(4) ) = 7
oInspector.LoadCodeFromFile("c:\Program Files\Microsoft Visual FoxPro 7\Ffc\_system.vcx")
case val( version(4) ) = 6
oInspector.LoadCodeFromFile("c:\Program Files\Microsoft Visual FoxPro 6\Ffc\_system.vcx")
endcase
oInspector.Scan()
oInspector.ShowMessage(0)
endif
| Property Name | Description | Type | Values | Access |
| ScanCode | Contains code to be checked. Can be set manually or using methods: LoadCodeFromFile, LoadCodeFromObject | Character | - | Read/Write |
| ErrorCount | Contains the number of errors found in the ScanCode during the Scan method. | Numeric | 0, >0 | Read/Write |
| WarningCount | Contains the number of warnings of level 2 (coding style notes) found in the ScanCode during the Scan method. | Numeric | 0, >0 | Read/Write |
| RubbishCount | Contains the number of warnings of level 2 (never used variables) found in the ScanCode during the Scan method. | Numeric | 0, >0 | Read/Write |
| MessageHtml | Contains HTML source code of the report file for the ScanCode. | Character | - | Read/Write |
| FileName | Contains path to the file being scanned. Can be set manually or using LoadCodeFromFile method. Note: if this property is empty, you won't be able to open file for editing from the scan report. | Character | - | Read/Write |
| PublicVariables | Contains the list of global variables or their masks, which are used in file being scanned. These variables wonÒt be checked. | Character | [ |
Read/Write |
| ScanResult | Contains the result of file scanning. If it is equal to 0, scan was successful, otherwise contains internal error code. | Numeric | 0, >0 | Read/Write |
| ScanDateTime | Contains the date and time of scanning. Being set in the Scan method. | DateTime | - | Read/Write |
| oVfpApplication | Must be specified manually by linking to _VFP object. Required to open files in VFP for editing right from the scan report dialog. | Object | Null | Read/Write |
| Name and Syntax | Parameters | Returns | Description |
| .LoadCodeFromFile( |
FileName - Full Path and File Name | =0, success <0, error code |
Gets the code form (PRG, SCX or SCT, VCX or VCT) files and fills ScanCode and FileName properties |
| .LoadCodeFromObject( |
oObject - Link to an object | =0, success <0, error code |
Gets the code out of the object using ReadExpression and ReadMethod. Available in VFP only after using NewObject( "CodeInspectorScanner", "poci_publicscanner.prg", " |
| .Scan() | n/a | =0, success <0, error code |
Gets code from ScanCode, checks it and fills properties: ErrorCount, RubbishCount, WarningCount, ScanDateTime, MessageHtml. |
| .ShowMessage ([ |
nMode - Appearance Mode | =0, success <0, error code |
Gets code out of PRG, SCX(SCT), VCX(VCT) files, and fills ScanCode and FileName properties. |
| .GetRubbish ([<@aRubbish>]) | aRubbish - returnable array of declared but never used variables. | =0, no unused variables >0, variable count <0, error code |
Returns an array with a list of unused variables. Structure: [x,1] - Variable name [x,2] - Method name [x,3] - Comma-separated list of line numbers containing variable Available only in registered version of +CodeInspector. |
| .GetWarnings ([<@aWarnings>]) | aWarnings - returnable array of warnings. | =0, no warnings >0, warning count <0, error code |
Returns an array of warnings found in the code. Structure: [x,1] - Warning line number [x,2] - Method name [x,3] - Comma-separated list of line numbers with warning. Available only in registered version of +CodeInspector. |
| .GetErrors ([<@aErrors>]) | aErrors - returnable array of undeclared variables. | =0, no undeclared variables >0, variable count <0, error code |
Returns an array with a list of undeclared variables. Structure: [x,1] - Variable name [x,2] - Method name [x,3] - List of comma-separated line numbers containing variable Available only in registered version of +CodeInspector. |