MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / printClassHeader

Function printClassHeader

Engine/source/console/consoleDoc.cpp:78–162  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

76};
77
78void printClassHeader(const char* usage, const char * className, const char * superClassName, const bool stub)
79{
80 if(stub)
81 {
82 Con::printf("/// Stub class");
83 Con::printf("/// ");
84 Con::printf("/// @note This is a stub class to ensure a proper class hierarchy. No ");
85 Con::printf("/// information was available for this class.");
86 }
87
88 if((usage != NULL) && strlen(usage))
89 {
90 // Copy Usage Document
91 S32 usageLen = dStrlen( usage ) + 1;
92 FrameTemp<char> usageStr( usageLen );
93 dStrcpy( usageStr, usage, usageLen );
94
95 // Print Header
96 Con::printf( "/*!" );
97
98 // Print line by line, skipping the @field lines.
99 //
100 // fetch first line end
101 char *newLine = dStrchr( usageStr, '\n' );
102 char *usagePtr = usageStr;
103 do
104 {
105 // Copy of one line
106 static char lineStr[2048] = {0};
107 // Keyword will hold the last keyword (word following '@' or '\') encountered.
108 static char keyword[8] = {0};
109
110 S32 lineLen = 0;
111
112 // If not the last line, increment pointer
113 if( newLine != NULL )
114 {
115 *newLine = '\0';
116 newLine ++;
117 }
118
119 // Copy line and update usagePtr
120 dStrcpy( lineStr, usagePtr, 2048 );
121 usagePtr = (newLine != NULL ) ? newLine : usagePtr;
122 lineLen = dStrlen( lineStr );
123
124 // Get the keyword. This is the first word after an '@' or '\'.
125 const char* tempkw = dStrchr( lineStr, '@' );
126 if( !tempkw )
127 tempkw = dStrchr( lineStr, '\\' );
128
129 // If we found a new keyword, set it, otherwise, keep using the
130 // most recently found.
131 if( tempkw )
132 {
133 dStrncpy( keyword, tempkw + 1, 5 );
134 keyword[5] = '\0';
135 }

Callers 2

dumpClassesMethod · 0.85
dumpFunctionsMethod · 0.85

Calls 6

printfFunction · 0.85
dStrcpyFunction · 0.85
dStrncpyFunction · 0.85
compareFunction · 0.85
dStrlenFunction · 0.50
dStrchrFunction · 0.50

Tested by

no test coverage detected