| 109 | } |
| 110 | |
| 111 | static void dumpVariable( Stream& stream, |
| 112 | Dictionary::Entry* entry, |
| 113 | const char* inClass = NULL ) |
| 114 | { |
| 115 | // Skip variables defined in script. |
| 116 | |
| 117 | if( entry->type <= Dictionary::Entry::TypeInternalString ) |
| 118 | return; |
| 119 | |
| 120 | // Skip internals... don't export them. |
| 121 | if ( entry->mUsage && |
| 122 | ( dStrstr( entry->mUsage, "@hide" ) || dStrstr( entry->mUsage, "@internal" ) ) ) |
| 123 | return; |
| 124 | |
| 125 | // Split up qualified name. |
| 126 | |
| 127 | Vector< String > nameComponents; |
| 128 | String( entry->name ).split( "::", nameComponents ); |
| 129 | if( !nameComponents.size() ) // Safety check. |
| 130 | return; |
| 131 | |
| 132 | // Match filter. |
| 133 | |
| 134 | if( inClass ) |
| 135 | { |
| 136 | // Make sure first qualifier in name components is a |
| 137 | // namespace qualifier matching the given class name. |
| 138 | |
| 139 | if( nameComponents.size() <= 1 || dStricmp( nameComponents.first().c_str() + 1, inClass ) != 0 ) // Skip '$'. |
| 140 | return; |
| 141 | } |
| 142 | else |
| 143 | { |
| 144 | // Make sure, this is *not* in a class namespace. |
| 145 | |
| 146 | if( nameComponents.size() > 1 && Con::lookupNamespace( nameComponents.first().c_str() + 1 )->mClassRep ) |
| 147 | return; |
| 148 | } |
| 149 | |
| 150 | // Skip variables for which we can't decipher their type. |
| 151 | |
| 152 | ConsoleBaseType* type = ConsoleBaseType::getType( entry->type ); |
| 153 | if( !type ) |
| 154 | { |
| 155 | Con::errorf( "Can't find type for variable '%s'", entry->name ); |
| 156 | return; |
| 157 | } |
| 158 | |
| 159 | // Write doc comment. |
| 160 | |
| 161 | stream.writeText( "/*!\r\n" ); |
| 162 | |
| 163 | if( !inClass ) |
| 164 | { |
| 165 | stream.writeText( "@var " ); |
| 166 | stream.writeText( type->getTypeClassName() ); |
| 167 | stream.writeText( " " ); |
| 168 | stream.writeText( entry->name ); |
no test coverage detected