retdec
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
retdec::llvmir2hll::FruitVarNameGen Class Reference

A generator of fruit names as variable names. More...

#include <fruit_var_name_gen.h>

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

Public Member Functions

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

Static Public Member Functions

static UPtr< VarNameGencreate (std::string prefix="")
 Creates a generator. More...
 

Private Member Functions

 FruitVarNameGen (std::string prefix)
 Constructs a new generator. More...
 

Private Attributes

std::size_t nextFruitIndex
 Index to the next fruit name. More...
 

Additional Inherited Members

- Protected Member Functions inherited from retdec::llvmir2hll::VarNameGen
 VarNameGen (std::string prefix="")
 Constructs a new variable name generator. More...
 
- Protected Attributes inherited from retdec::llvmir2hll::VarNameGen
const std::string prefix
 The prefix of all returned variable names. More...
 

Detailed Description

A generator of fruit names as variable names.

Use create() to create instances.

At each call of getNextVarName(), a new fruit name is returned. Each returned variable name is prefixed with prefix, where prefix is the parameter of create(). When there are no available names to be returned, getNextVarName() starts returning the names from the beginning.

Constructor & Destructor Documentation

◆ FruitVarNameGen()

retdec::llvmir2hll::FruitVarNameGen::FruitVarNameGen ( std::string  prefix)
private

Constructs a new generator.

For more details, see create().

Member Function Documentation

◆ create()

UPtr< VarNameGen > retdec::llvmir2hll::FruitVarNameGen::create ( std::string  prefix = "")
static

Creates a generator.

Parameters
[in]prefixPrefix of all returned variable names.

◆ getId()

std::string retdec::llvmir2hll::FruitVarNameGen::getId ( ) const
overridevirtual

Returns the ID of the generator.

Implements retdec::llvmir2hll::VarNameGen.

◆ getNextVarName()

std::string retdec::llvmir2hll::FruitVarNameGen::getNextVarName ( )
overridevirtual

Returns a next variable name.

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

Implements retdec::llvmir2hll::VarNameGen.

◆ restart()

void retdec::llvmir2hll::FruitVarNameGen::restart ( )
overridevirtual

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.

Implements retdec::llvmir2hll::VarNameGen.

Member Data Documentation

◆ nextFruitIndex

std::size_t retdec::llvmir2hll::FruitVarNameGen::nextFruitIndex
private

Index to the next fruit name.


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