LibreCAD
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
lc::CustomEntityStorage Class Reference

Class for storage of components of custom entities Child of Block for compatibility with other CAD software. More...

#include <customentitystorage.h>

Inheritance diagram for lc::CustomEntityStorage:
Collaboration diagram for lc::CustomEntityStorage:

Public Member Functions

 CustomEntityStorage (const std::string &pluginName, const std::string &entityName, const geo::Coordinate &base, const std::map< std::string, std::string > params=std::map< std::string, std::string >())
 
const std::string & pluginName () const
 
const std::string & entityName () const
 
CustomEntityStorage_CSPtr setParam (const std::string &param, const std::string &value) const
 
std::string param (const std::string &param) const
 
const std::map< std::string,
std::string > & 
params () const
 
- Public Member Functions inherited from lc::Block
 Block (std::string name, geo::Coordinate base)
 
const std::string id () const override
 
const std::string name () const override
 
const geo::Coordinatebase () const
 
- Public Member Functions inherited from lc::MetaType
 MetaType ()
 
virtual ~MetaType ()=default
 

Private Attributes

std::string _pluginName
 
std::string _entityName
 
std::map< std::string,
std::string > 
_params
 

Detailed Description

Class for storage of components of custom entities Child of Block for compatibility with other CAD software.

Definition at line 14 of file customentitystorage.h.

Constructor & Destructor Documentation

CustomEntityStorage::CustomEntityStorage ( const std::string &  pluginName,
const std::string &  entityName,
const geo::Coordinate base,
const std::map< std::string, std::string >  params = std::map<std::string, std::string>() 
)

Definition at line 7 of file customentitystorage.cpp.

10  :
11  Block("LC_" + std::to_string(rand()), base),
14  _params(params) {
15 
16 }
const std::string & entityName() const
const std::map< std::string, std::string > & params() const
Block(std::string name, geo::Coordinate base)
Definition: block.cpp:3
std::map< std::string, std::string > _params
const std::string & pluginName() const

Member Function Documentation

const std::string & CustomEntityStorage::entityName ( ) const

Definition at line 22 of file customentitystorage.cpp.

22  {
23  return _entityName;
24 }
std::string CustomEntityStorage::param ( const std::string &  param) const

Definition at line 33 of file customentitystorage.cpp.

33  {
34  try {
35  return _params.at(param);
36  }
37  catch (std::out_of_range& e) {
38  return "";
39  }
40 }
std::string param(const std::string &param) const
std::map< std::string, std::string > _params
const std::map< std::string, std::string > & CustomEntityStorage::params ( ) const

Definition at line 42 of file customentitystorage.cpp.

42  {
43  return _params;
44 }
std::map< std::string, std::string > _params
const std::string & CustomEntityStorage::pluginName ( ) const

Definition at line 18 of file customentitystorage.cpp.

18  {
19  return _pluginName;
20 }
CustomEntityStorage_CSPtr CustomEntityStorage::setParam ( const std::string &  param,
const std::string &  value 
) const

Definition at line 26 of file customentitystorage.cpp.

26  {
27  auto ces = std::make_shared<CustomEntityStorage>(_pluginName, _entityName, base(), _params);
28  ces->_params[param] = value;
29 
30  return ces;
31 }
const geo::Coordinate & base() const
Definition: block.cpp:16
std::string param(const std::string &param) const
std::map< std::string, std::string > _params

Member Data Documentation

std::string lc::CustomEntityStorage::_entityName
private

Definition at line 31 of file customentitystorage.h.

std::map<std::string, std::string> lc::CustomEntityStorage::_params
private

Definition at line 32 of file customentitystorage.h.

std::string lc::CustomEntityStorage::_pluginName
private

Definition at line 30 of file customentitystorage.h.


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