| 237 | ]; |
| 238 | |
| 239 | class CPlusPlusRenderer extends ConvenienceRenderer { |
| 240 | private readonly _typeNameStyle: (rawName: string) => string; |
| 241 | private readonly _typeNamingFunction: Namer; |
| 242 | private readonly _memberNamingFunction: Namer; |
| 243 | private readonly _caseNamingFunction: Namer; |
| 244 | private readonly _optionalType: string; |
| 245 | |
| 246 | constructor( |
| 247 | graph: TypeGraph, |
| 248 | private readonly _namespaceName: string, |
| 249 | _typeNamingStyle: NamingStyle, |
| 250 | _memberNamingStyle: NamingStyle, |
| 251 | _enumeratorNamingStyle: NamingStyle, |
| 252 | private readonly _uniquePtr: boolean |
| 253 | ) { |
| 254 | super(graph); |
| 255 | |
| 256 | this._typeNameStyle = cppNameStyle(_typeNamingStyle); |
| 257 | this._typeNamingFunction = funPrefixNamer(this._typeNameStyle); |
| 258 | this._memberNamingFunction = funPrefixNamer(cppNameStyle(_memberNamingStyle)); |
| 259 | this._caseNamingFunction = funPrefixNamer(cppNameStyle(_enumeratorNamingStyle)); |
| 260 | this._optionalType = _uniquePtr ? "std::unique_ptr" : "boost::optional"; |
| 261 | } |
| 262 | |
| 263 | protected get forbiddenNamesForGlobalNamespace(): string[] { |
| 264 | return keywords; |
| 265 | } |
| 266 | |
| 267 | protected forbiddenForClassProperties( |
| 268 | _c: ClassType, |
| 269 | _classNamed: Name |
| 270 | ): { names: Name[]; namespaces: Namespace[] } { |
| 271 | return { names: [], namespaces: [this.globalNamespace] }; |
| 272 | } |
| 273 | |
| 274 | protected forbiddenForEnumCases(_e: EnumType, _enumNamed: Name): { names: Name[]; namespaces: Namespace[] } { |
| 275 | return { names: [], namespaces: [this.globalNamespace] }; |
| 276 | } |
| 277 | |
| 278 | protected topLevelNameStyle(rawName: string): string { |
| 279 | return this._typeNameStyle(rawName); |
| 280 | } |
| 281 | |
| 282 | protected get namedTypeNamer(): Namer { |
| 283 | return this._typeNamingFunction; |
| 284 | } |
| 285 | |
| 286 | protected get classPropertyNamer(): Namer { |
| 287 | return this._memberNamingFunction; |
| 288 | } |
| 289 | |
| 290 | protected get unionMemberNamer(): null { |
| 291 | return null; |
| 292 | } |
| 293 | |
| 294 | protected get enumCaseNamer(): Namer { |
| 295 | return this._caseNamingFunction; |
| 296 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…