retdec
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
retdec::llvmir2hll::VarNameGen Class Referenceabstract

A base class for all generators of variable names. More...

#include <var_name_gen.h>

Inheritance diagram for retdec::llvmir2hll::VarNameGen:
Inheritance graph
[legend]
Collaboration diagram for retdec::llvmir2hll::VarNameGen:
Collaboration graph
[legend]

Public Member Functions

virtual ~VarNameGen ()=default
 
virtual std::string getId () const =0
 Returns the ID of the generator. More...
 
virtual void restart ()=0
 Restarts the generator to start returning variable names from the beginning. More...
 
virtual std::string getNextVarName ()=0
 Returns a next variable name. More...
 
const std::string & getPrefix () const
 Returns the prefix used by the generator. More...
 

Protected Member Functions

 VarNameGen (std::string prefix="")
 Constructs a new variable name generator. More...
 

Protected Attributes

const std::string prefix
 The prefix of all returned variable names. More...
 

Additional Inherited Members

- Private Member Functions inherited from retdec::utils::NonCopyable
 NonCopyable (const NonCopyable &)=delete
 
NonCopyableoperator= (const NonCopyable &)=delete
 
 NonCopyable ()=default
 
 ~NonCopyable ()=default
 

Detailed Description

A base class for all generators of variable names.

This class should be used as a base class for all generators of variable names. These are classes which can generate names of anonymous local variables.

Instances of this class have reference object semantics.

Constructor & Destructor Documentation

◆ ~VarNameGen()

virtual retdec::llvmir2hll::VarNameGen::~VarNameGen ( )
virtualdefault

◆ VarNameGen()

retdec::llvmir2hll::VarNameGen::VarNameGen ( std::string  prefix = "")
protected

Constructs a new variable name generator.

Parameters
[in]prefixPrefix of all returned names.

Member Function Documentation

◆ getId()

virtual std::string retdec::llvmir2hll::VarNameGen::getId ( ) const
pure virtual

◆ getNextVarName()

virtual std::string retdec::llvmir2hll::VarNameGen::getNextVarName ( )
pure virtual

Returns a next variable name.

If there is no next variable name available, the generator starts generating names from the beginning.

Implemented in retdec::llvmir2hll::WordVarNameGen, retdec::llvmir2hll::NumVarNameGen, and retdec::llvmir2hll::FruitVarNameGen.

◆ getPrefix()

const std::string & retdec::llvmir2hll::VarNameGen::getPrefix ( ) const

Returns the prefix used by the generator.

◆ restart()

virtual void retdec::llvmir2hll::VarNameGen::restart ( )
pure virtual

Restarts the generator to start returning variable names from the beginning.

Note that there is no requirement for this class to return variable names in the same order between consecutive calls to this function.

Implemented in retdec::llvmir2hll::WordVarNameGen, retdec::llvmir2hll::NumVarNameGen, and retdec::llvmir2hll::FruitVarNameGen.

Member Data Documentation

◆ prefix

const std::string retdec::llvmir2hll::VarNameGen::prefix
protected

The prefix of all returned variable names.


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