Envision
A visual programming IDE for object-oriented languages
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
CppImport::CppImportUtilities Class Reference

This is a helper class for translation of types operators type arguments and similar simple constructs. More...

Public Types

enum class  OverloadKind : int { Unsupported , Unary , Binary , Assign , MethodCall , ReferenceExpr , Comma }
 

Public Member Functions

 CppImportUtilities (CppImportLogger *logger, ExpressionVisitor *visitor, ClangHelpers &clang)
 
OOModel::ExpressioncreateErrorExpression (const QString &reason, clang::SourceRange sourceRange)
 Creates an error expression which is clearly visible inside envision In envision it is represented as a red # and the reason string. More...
 
OverloadKind getOverloadKind (const clang::OverloadedOperatorKind &overloadOpKind, unsigned numArgs)
 Determines the kind of an overload operation. More...
 
OOModel::ReferenceExpressionsetReferencePrefix (OOModel::ReferenceExpression *reference, clang::NestedNameSpecifierLoc nestedNameSpecifierLoc, clang::Expr *base=nullptr)
 
OOModel::Modifier::ModifierFlag translateAccessSpecifier (const clang::AccessSpecifier &acessSpecifier)
 
OOModel::AssignmentExpression::AssignmentTypes translateAssignOp (const clang::BinaryOperatorKind &assignOpKind)
 
OOModel::AssignmentExpression::AssignmentTypes translateAssignOverloadOp (const clang::OverloadedOperatorKind &overloadOpKind)
 
OOModel::BinaryOperation::OperatorTypes translateBinaryOp (const clang::BinaryOperatorKind &binaryOpKind)
 
OOModel::BinaryOperation::OperatorTypes translateBinaryOverloadOp (const clang::OverloadedOperatorKind &overloadOpKind)
 
OOModel::MemberInitializertranslateMemberInit (const clang::CXXCtorInitializer *initializer)
 
OOModel::ExpressiontranslateNestedNameSpecifier (const clang::NestedNameSpecifierLoc nestedNameLoc, clang::Expr *base=nullptr)
 Translates nested name specifiers. More...
 
OOModel::ExpressiontranslateQualifiedType (clang::TypeLoc typeLoc)
 Translates a qualified type to the corresponding Envision type expression. More...
 
OOModel::Modifier::ModifierFlag translateStorageSpecifier (const clang::StorageClass &storageClass)
 
OOModel::ExpressiontranslateTemplateArgument (const clang::TemplateArgumentLoc &templateArgLoc)
 
OOModel::UnaryOperation::OperatorTypes translateUnaryOp (const clang::UnaryOperatorKind &unaryOpKind)
 
OOModel::UnaryOperation::OperatorTypes translateUnaryOverloadOp (const clang::OverloadedOperatorKind &overloadOpKind, const unsigned numArgs)
 

Static Public Member Functions

static QString overloadOperatorToString (const clang::OverloadedOperatorKind &overloadOpKind)
 

Private Member Functions

clang::SourceRange calculateSourceRangeWithQualifier (QString qualifier, clang::QualifiedTypeLoc qualifiedTypeLoc)
 
OOModel::ExpressiontranslateBuiltInClangType (const clang::BuiltinTypeLoc typeLoc)
 Translates type to the nearest primitive OOModel type. More...
 
OOModel::ExpressiontranslateTypePtr (const clang::TypeLoc typeLoc)
 

Private Attributes

ClangHelpersclang_
 
const QString className_ {"CppImportUtilities"}
 
ExpressionVisitorexprVisitor_ {}
 
CppImportLoggerlog_
 

Detailed Description

This is a helper class for translation of types operators type arguments and similar simple constructs.

Member Enumeration Documentation

◆ OverloadKind

Enumerator
Unsupported 
Unary 
Binary 
Assign 
MethodCall 
ReferenceExpr 
Comma 

Constructor & Destructor Documentation

◆ CppImportUtilities()

CppImport::CppImportUtilities::CppImportUtilities ( CppImportLogger logger,
ExpressionVisitor visitor,
ClangHelpers clang 
)

Member Function Documentation

◆ calculateSourceRangeWithQualifier()

clang::SourceRange CppImport::CppImportUtilities::calculateSourceRangeWithQualifier ( QString  qualifier,
clang::QualifiedTypeLoc  qualifiedTypeLoc 
)
private

◆ createErrorExpression()

OOModel::Expression * CppImport::CppImportUtilities::createErrorExpression ( const QString &  reason,
clang::SourceRange  sourceRange 
)

Creates an error expression which is clearly visible inside envision In envision it is represented as a red # and the reason string.

◆ getOverloadKind()

CppImportUtilities::OverloadKind CppImport::CppImportUtilities::getOverloadKind ( const clang::OverloadedOperatorKind &  overloadOpKind,
unsigned  numArgs 
)

Determines the kind of an overload operation.

e.g. an arrow will return ReferenceExpr

◆ overloadOperatorToString()

QString CppImport::CppImportUtilities::overloadOperatorToString ( const clang::OverloadedOperatorKind &  overloadOpKind)
static

◆ setReferencePrefix()

OOModel::ReferenceExpression * CppImport::CppImportUtilities::setReferencePrefix ( OOModel::ReferenceExpression reference,
clang::NestedNameSpecifierLoc  nestedNameSpecifierLoc,
clang::Expr *  base = nullptr 
)

◆ translateAccessSpecifier()

OOModel::Modifier::ModifierFlag CppImport::CppImportUtilities::translateAccessSpecifier ( const clang::AccessSpecifier &  acessSpecifier)

◆ translateAssignOp()

OOModel::AssignmentExpression::AssignmentTypes CppImport::CppImportUtilities::translateAssignOp ( const clang::BinaryOperatorKind &  assignOpKind)

◆ translateAssignOverloadOp()

OOModel::AssignmentExpression::AssignmentTypes CppImport::CppImportUtilities::translateAssignOverloadOp ( const clang::OverloadedOperatorKind &  overloadOpKind)

◆ translateBinaryOp()

OOModel::BinaryOperation::OperatorTypes CppImport::CppImportUtilities::translateBinaryOp ( const clang::BinaryOperatorKind &  binaryOpKind)

◆ translateBinaryOverloadOp()

OOModel::BinaryOperation::OperatorTypes CppImport::CppImportUtilities::translateBinaryOverloadOp ( const clang::OverloadedOperatorKind &  overloadOpKind)

◆ translateBuiltInClangType()

OOModel::Expression * CppImport::CppImportUtilities::translateBuiltInClangType ( const clang::BuiltinTypeLoc  typeLoc)
private

Translates type to the nearest primitive OOModel type.

◆ translateMemberInit()

OOModel::MemberInitializer * CppImport::CppImportUtilities::translateMemberInit ( const clang::CXXCtorInitializer *  initializer)

◆ translateNestedNameSpecifier()

OOModel::Expression * CppImport::CppImportUtilities::translateNestedNameSpecifier ( const clang::NestedNameSpecifierLoc  nestedNameLoc,
clang::Expr *  base = nullptr 
)

Translates nested name specifiers.

If there is abase specified it will be put as a prefix of the first namespecifier e.g. { obj.A::ref } here obj would be the base and A the nestedName

◆ translateQualifiedType()

OOModel::Expression * CppImport::CppImportUtilities::translateQualifiedType ( clang::TypeLoc  typeLoc)

Translates a qualified type to the corresponding Envision type expression.

The location is used for warnings whenever translation fails, to report the file and line of the location.

◆ translateStorageSpecifier()

OOModel::Modifier::ModifierFlag CppImport::CppImportUtilities::translateStorageSpecifier ( const clang::StorageClass &  storageClass)

◆ translateTemplateArgument()

OOModel::Expression * CppImport::CppImportUtilities::translateTemplateArgument ( const clang::TemplateArgumentLoc &  templateArgLoc)

◆ translateTypePtr()

OOModel::Expression * CppImport::CppImportUtilities::translateTypePtr ( const clang::TypeLoc  typeLoc)
private

◆ translateUnaryOp()

OOModel::UnaryOperation::OperatorTypes CppImport::CppImportUtilities::translateUnaryOp ( const clang::UnaryOperatorKind &  unaryOpKind)

◆ translateUnaryOverloadOp()

OOModel::UnaryOperation::OperatorTypes CppImport::CppImportUtilities::translateUnaryOverloadOp ( const clang::OverloadedOperatorKind &  overloadOpKind,
const unsigned  numArgs 
)

Member Data Documentation

◆ clang_

ClangHelpers& CppImport::CppImportUtilities::clang_
private

◆ className_

const QString CppImport::CppImportUtilities::className_ {"CppImportUtilities"}
private

◆ exprVisitor_

ExpressionVisitor* CppImport::CppImportUtilities::exprVisitor_ {}
private

◆ log_

CppImportLogger* CppImport::CppImportUtilities::log_
private