PLaSK library
Loading...
Searching...
No Matches
plask::Material::StringBuilder Struct Reference

Helper class for easy constructing string representations of complex materials. More...

#include <plask/material/material.hpp>

Collaboration diagram for plask::Material::StringBuilder:
[legend]

Public Member Functions

 operator std::string () const
 Cast to string operator.
 
StringBuilderoperator() (const std::string &objectName)
 Append name of object (without ammount) to built string.
 
 StringBuilder (const std::string &objectName)
 Construct builder and append name of object (without ammount) to built string.
 
StringBuilderoperator() (const std::string &objectName, double ammount)
 Append name of object (with ammount) to built string.
 
 StringBuilder (const std::string &objectName, double ammount)
 Construct builder and append name of object (with ammount) to built string.
 
std::string dopant (const std::string &dopant, double dopantConcentration)
 Append information about doping to built string.
 

Public Attributes

std::stringstream str
 Part of name which has been already built.
 

Detailed Description

Helper class for easy constructing string representations of complex materials.

Typically this is used to implement str() method.

Example:

double Al = 0.6;
double Mg = 0.1;
std::string str = StringBuilder("Al", Al)("Ga")("N").dopant("Mg", Mg);
//str is "Al(0.6)GaN:Mg=0.1"

Definition at line 238 of file material.hpp.

Constructor & Destructor Documentation

◆ StringBuilder() [1/2]

plask::Material::StringBuilder::StringBuilder ( const std::string &  objectName)
inline

Construct builder and append name of object (without ammount) to built string.

Parameters
objectNamename of object to add

Definition at line 260 of file material.hpp.

◆ StringBuilder() [2/2]

plask::Material::StringBuilder::StringBuilder ( const std::string &  objectName,
double  ammount 
)
inline

Construct builder and append name of object (with ammount) to built string.

Parameters
objectNamename of object to add
ammountammount of added object

Definition at line 277 of file material.hpp.

Member Function Documentation

◆ dopant()

std::string plask::Material::StringBuilder::dopant ( const std::string &  dopant,
double  dopantConcentration 
)

Append information about doping to built string.

Parameters
dopantname of dopant
dopantConcentrationdopant concentration
Returns
built material name

Definition at line 77 of file material.cpp.

◆ operator std::string()

plask::Material::StringBuilder::operator std::string ( ) const
inline

Cast to string operator.

Returns
part of name which has been already built

Definition at line 247 of file material.hpp.

◆ operator()() [1/2]

StringBuilder & plask::Material::StringBuilder::operator() ( const std::string &  objectName)
inline

Append name of object (without ammount) to built string.

Parameters
objectNamename of object to add
Returns
*this

Definition at line 254 of file material.hpp.

◆ operator()() [2/2]

Material::StringBuilder & plask::Material::StringBuilder::operator() ( const std::string &  objectName,
double  ammount 
)

Append name of object (with ammount) to built string.

Parameters
objectNamename of object to add
ammountammount of added object
Returns
*this

Definition at line 69 of file material.cpp.

Member Data Documentation

◆ str

std::stringstream plask::Material::StringBuilder::str

Part of name which has been already built.

Definition at line 241 of file material.hpp.


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