| 170 | } |
| 171 | |
| 172 | void ClassCompiler::HandleClass(const Klass& klass, const ClassDebugInfo&) |
| 173 | { |
| 174 | /* forward declaration */ |
| 175 | if (klass.Name.find_first_of(':') == std::string::npos) |
| 176 | m_Header << "class " << klass.Name << ";" << std::endl << std::endl; |
| 177 | |
| 178 | /* TypeHelper */ |
| 179 | if (klass.Attributes & TAAbstract) { |
| 180 | m_Header << "template<>" << std::endl |
| 181 | << "struct TypeHelper<" << klass.Name << ", " << ((klass.Attributes & TAVarArgConstructor) ? "true" : "false") << ">" << std::endl |
| 182 | << "{" << std::endl |
| 183 | << "\t" << "static ObjectFactory GetFactory()" << std::endl |
| 184 | << "\t" << "{" << std::endl |
| 185 | << "\t\t" << "return nullptr;" << std::endl |
| 186 | << "\t" << "}" << std::endl |
| 187 | << "};" << std::endl << std::endl; |
| 188 | } |
| 189 | |
| 190 | /* TypeImpl */ |
| 191 | m_Header << "template<>" << std::endl |
| 192 | << "class TypeImpl<" << klass.Name << ">" |
| 193 | << " : public Type"; |
| 194 | |
| 195 | if (!klass.Parent.empty()) |
| 196 | m_Header << "Impl<" << klass.Parent << ">"; |
| 197 | |
| 198 | if (!klass.TypeBase.empty()) |
| 199 | m_Header << ", public " + klass.TypeBase; |
| 200 | |
| 201 | m_Header << std::endl |
| 202 | << "{" << std::endl |
| 203 | << "public:" << std::endl |
| 204 | << "\t" << "DECLARE_PTR_TYPEDEFS(TypeImpl<" << klass.Name << ">);" << std::endl << std::endl |
| 205 | << "\t" << "TypeImpl();" << std::endl |
| 206 | << "\t" << "~TypeImpl() override;" << std::endl << std::endl; |
| 207 | |
| 208 | m_Impl << "TypeImpl<" << klass.Name << ">::TypeImpl()" << std::endl |
| 209 | << "{ }" << std::endl << std::endl |
| 210 | << "TypeImpl<" << klass.Name << ">::~TypeImpl()" << std::endl |
| 211 | << "{ }" << std::endl << std::endl; |
| 212 | |
| 213 | /* GetName */ |
| 214 | m_Header << "\t" << "String GetName() const override;" << std::endl; |
| 215 | |
| 216 | m_Impl << "String TypeImpl<" << klass.Name << ">::GetName() const" << std::endl |
| 217 | << "{" << std::endl |
| 218 | << "\t" << "return \"" << klass.Name << "\";" << std::endl |
| 219 | << "}" << std::endl << std::endl; |
| 220 | |
| 221 | /* GetAttributes */ |
| 222 | m_Header << "\t" << "int GetAttributes() const override;" << std::endl; |
| 223 | |
| 224 | m_Impl << "int TypeImpl<" << klass.Name << ">::GetAttributes() const" << std::endl |
| 225 | << "{" << std::endl |
| 226 | << "\t" << "return " << klass.Attributes << ";" << std::endl |
| 227 | << "}" << std::endl << std::endl; |
| 228 | |
| 229 | /* GetBaseType */ |
nothing calls this directly
no test coverage detected