0.6.0
C++ to UML diagram generator based on Clang
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Private Attributes | List of all members
clanguml::common::generators::diagram_fronted_action< DiagramModel, DiagramConfig, DiagramVisitor > Class Template Reference

Specialization of clang::ASTFrontendAction More...

Detailed Description

template<typename DiagramModel, typename DiagramConfig, typename DiagramVisitor>
class clanguml::common::generators::diagram_fronted_action< DiagramModel, DiagramConfig, DiagramVisitor >

Specialization of clang::ASTFrontendAction

This class overrides the BeginSourceFileAction() and CreateASTConsumer() methods to create and setup an appropriate diagram_ast_consumer instance.

Template Parameters
DiagramModelType of diagram_model
DiagramConfigType of diagram_config
TranslationUnitVisitorType of translation_unit_visitor

Definition at line 313 of file generators.h.

#include <generators.h>

Public Member Functions

 diagram_fronted_action (DiagramModel &diagram, const DiagramConfig &config, std::function< void()> progress)
 
std::unique_ptr< clang::ASTConsumer > CreateASTConsumer (clang::CompilerInstance &CI, clang::StringRef) override
 

Protected Member Functions

bool BeginSourceFileAction (clang::CompilerInstance &ci) override
 

Private Attributes

DiagramModel & diagram_
 
const DiagramConfig & config_
 
std::function< void()> progress_
 

Constructor & Destructor Documentation

◆ diagram_fronted_action()

template<typename DiagramModel , typename DiagramConfig , typename DiagramVisitor >
clanguml::common::generators::diagram_fronted_action< DiagramModel, DiagramConfig, DiagramVisitor >::diagram_fronted_action ( DiagramModel &  diagram,
const DiagramConfig &  config,
std::function< void()>  progress 
)
inlineexplicit

Definition at line 315 of file generators.h.

317 : diagram_{diagram}
318 , config_{config}
319 , progress_{std::move(progress)}
320 {
321 }

Member Function Documentation

◆ BeginSourceFileAction()

template<typename DiagramModel , typename DiagramConfig , typename DiagramVisitor >
bool clanguml::common::generators::diagram_fronted_action< DiagramModel, DiagramConfig, DiagramVisitor >::BeginSourceFileAction ( clang::CompilerInstance &  ci)
inlineoverrideprotected

Definition at line 339 of file generators.h.

340 {
341 LOG_DBG("Visiting source file: {}", getCurrentFile().str());
342
343 // Update progress indicators, if enabled, on each translation
344 // unit
345 if (progress_)
346 progress_();
347
348 if constexpr (std::is_same_v<DiagramModel,
350 auto find_includes_callback =
351 std::make_unique<typename DiagramVisitor::include_visitor>(
352 ci.getSourceManager(), diagram_, config_);
353
354 clang::Preprocessor &pp = ci.getPreprocessor();
355
356 pp.addPPCallbacks(std::move(find_includes_callback));
357 }
358
359 return true;
360 }

◆ CreateASTConsumer()

template<typename DiagramModel , typename DiagramConfig , typename DiagramVisitor >
std::unique_ptr< clang::ASTConsumer > clanguml::common::generators::diagram_fronted_action< DiagramModel, DiagramConfig, DiagramVisitor >::CreateASTConsumer ( clang::CompilerInstance &  CI,
clang::StringRef   
)
inlineoverride

Definition at line 323 of file generators.h.

325 {
326 auto ast_consumer = std::make_unique<
327 diagram_ast_consumer<DiagramModel, DiagramConfig, DiagramVisitor>>(
328 CI, diagram_, config_);
329
330 if constexpr (!std::is_same_v<DiagramModel,
332 ast_consumer->visitor().set_tu_path(getCurrentFile().str());
333 }
334
335 return ast_consumer;
336 }

Member Data Documentation

◆ config_

template<typename DiagramModel , typename DiagramConfig , typename DiagramVisitor >
const DiagramConfig& clanguml::common::generators::diagram_fronted_action< DiagramModel, DiagramConfig, DiagramVisitor >::config_
private

Definition at line 364 of file generators.h.

◆ diagram_

template<typename DiagramModel , typename DiagramConfig , typename DiagramVisitor >
DiagramModel& clanguml::common::generators::diagram_fronted_action< DiagramModel, DiagramConfig, DiagramVisitor >::diagram_
private

Definition at line 363 of file generators.h.

◆ progress_

template<typename DiagramModel , typename DiagramConfig , typename DiagramVisitor >
std::function<void()> clanguml::common::generators::diagram_fronted_action< DiagramModel, DiagramConfig, DiagramVisitor >::progress_
private

Definition at line 365 of file generators.h.


The documentation for this class was generated from the following file: