ClassInspector GitHub

📊 Overview: 10 Properties 1 Constructor 14 Functions

📝 Description

ClassInspector - Analyzes 4D class files and extracts comprehensive metadata Usage: var $Inspector : cs.ClassInspector := cs.ClassInspector.new($File)

🕐 Last updated: 2025-11-14T16:53:00.138Z


📑 Table of Contents


Properties

Property Type Default Description
ClassName Text - ClassInspector - Analyzes 4D class files and extracts comprehensive metadata
Usage: var $Inspector : cs.ClassInspector := cs.ClassInspector.new($File)      
SuperClass Text - -
ClassAutoComment Text - Comment extracted from top of class file
ClassManualComment Text - User-entered class documentation
Properties Collection - Collection of property objects
Functions Collection - Collection of function objects
Source Text - -
OutputFolder 4D.Folder - Folder for JSON output
ExistingJSON Object - Previously saved JSON for comment merging
Changes Collection - List of changes detected

Constructor

constructor

[🏗️ constructor]

Class constructor($File : 4D.File)

Parameters:

Name Type Optional Description
$File 4D.File - -

Functions

Regular Functions

_parse

Function _parse

Main parsing function - processes the entire class file


_extractInlineComment

Function _extractInlineComment($Line : Text) -> Text

Extract inline comment from a line (everything after //)

Parameters:

Name Type Optional Description
$Line Text - -

Returns: Text


_removeInlineComment

Function _removeInlineComment($Line : Text) -> Text

Remove inline comment from a line

Parameters:

Name Type Optional Description
$Line Text - -

Returns: Text


_extractParameterComments

Function _extractParameterComments($Lines : Collection; $FuncStartIdx : Integer) -> Object

Extract parameter comments from lines following function declaration

Parameters:

Name Type Optional Description
$Lines Collection - -
$FuncStartIdx Integer - -

Returns: Object


_loadExistingJSON

Function _loadExistingJSON

Load existing JSON file to preserve comments


_mergeExistingPropertyComment

Function _mergeExistingPropertyComment($Prop : Object)

Merge existing property comment if available

Parameters:

Name Type Optional Description
$Prop Object - -

_mergeExistingClassComment

Function _mergeExistingClassComment

Merge existing class comment if available


_preserveExistingExamples

Function _preserveExistingExamples

Initialize examples array


_mergeExistingFunctionComment

Function _mergeExistingFunctionComment($Func : Object)

Merge existing function comment if available

Parameters:

Name Type Optional Description
$Func Object - -

_mergeExistingParameterComment

Function _mergeExistingParameterComment($Param : Object; $FunctionName : Text)

Merge existing parameter comment if available

Parameters:

Name Type Optional Description
$Param Object - -
$FunctionName Text - -

_recordChange

Function _recordChange($ChangeDescription : Text)

Record a change

Parameters:

Name Type Optional Description
$ChangeDescription Text - -

toObject

Function toObject -> Object

Export to JSON object

Returns: Object


toJSON

Function toJSON -> Text

Export to JSON string

Returns: Text


saveToFile

Function saveToFile -> 4D.File

Save JSON to file in Documentation\Classes folder

Returns: 4D.File



Generated from ClassInspector.4dm