LibrePCB Developers Documentation
ProjectAttributeLookup Class Referencefinal

Determine an attribute value of an object within a librepcb::Project. More...

#include <projectattributelookup.h>

+ Collaboration diagram for ProjectAttributeLookup:

Public Member Functions

 ProjectAttributeLookup ()=delete
 
 ProjectAttributeLookup (const ProjectAttributeLookup &other) noexcept
 
 ProjectAttributeLookup (const Project &obj, std::shared_ptr< AssemblyVariant > av) noexcept
 
 ProjectAttributeLookup (const ComponentInstance &obj, QPointer< const BI_Device > device, std::shared_ptr< const Part > part) noexcept
 
 ProjectAttributeLookup (const Schematic &obj, std::shared_ptr< AssemblyVariant > av) noexcept
 
 ProjectAttributeLookup (const Board &obj, std::shared_ptr< AssemblyVariant > av) noexcept
 
 ProjectAttributeLookup (const SI_Symbol &obj, QPointer< const BI_Device > device, std::shared_ptr< const Part > part, std::shared_ptr< AssemblyVariant > av) noexcept
 
 ProjectAttributeLookup (const BI_Device &obj, std::shared_ptr< const Part > part) noexcept
 
 ~ProjectAttributeLookup () noexcept
 
QString operator() (const QString &key) const noexcept
 Get the value of a specific attribute key. More...
 
ProjectAttributeLookupoperator= (const ProjectAttributeLookup &rhs) noexcept
 

Private Types

typedef std::function< QString(const QString &)> LookupFunction
 

Static Private Member Functions

static bool query (const Project &project, const QString &key, QString &value) noexcept
 
static bool query (const AssemblyVariant &av, const Circuit &circuit, const QString &key, QString &value) noexcept
 
static bool query (const ComponentInstance &cmp, const QString &key, QString &value) noexcept
 
static bool query (const Schematic &schematic, const QString &key, QString &value) noexcept
 
static bool query (const Board &board, const QString &key, QString &value) noexcept
 
static bool query (const SI_Symbol &symbol, const QString &key, QString &value) noexcept
 
static bool query (const BI_Device &device, const QString &key, QString &value) noexcept
 
static bool query (const Part &part, const QString &key, QString &value) noexcept
 

Private Attributes

LookupFunction mFunction
 

Detailed Description

Determine an attribute value of an object within a librepcb::Project.

Provides access to built-in and user-defined attributes (librepcb::Attribute) of objects within a project (e.g. symbols).

Please read the documentation about the Attributes System to get an idea how the Attributes System works in detail.

Usage:

  1. Call the constructor with passing the object to query attributes from.
  2. Call operator()() to get the value of a specific attribute key.
See also
librepcb::AttributeSubstitutor
Attributes System

Member Typedef Documentation

◆ LookupFunction

typedef std::function<QString(const QString&)> LookupFunction
private

Constructor & Destructor Documentation

◆ ProjectAttributeLookup() [1/8]

◆ ProjectAttributeLookup() [2/8]

ProjectAttributeLookup ( const ProjectAttributeLookup other)
noexcept

◆ ProjectAttributeLookup() [3/8]

ProjectAttributeLookup ( const Project obj,
std::shared_ptr< AssemblyVariant av 
)
noexcept

◆ ProjectAttributeLookup() [4/8]

ProjectAttributeLookup ( const ComponentInstance obj,
QPointer< const BI_Device device,
std::shared_ptr< const Part part 
)
noexcept

◆ ProjectAttributeLookup() [5/8]

ProjectAttributeLookup ( const Schematic obj,
std::shared_ptr< AssemblyVariant av 
)
noexcept
+ Here is the call graph for this function:

◆ ProjectAttributeLookup() [6/8]

ProjectAttributeLookup ( const Board obj,
std::shared_ptr< AssemblyVariant av 
)
noexcept
+ Here is the call graph for this function:

◆ ProjectAttributeLookup() [7/8]

ProjectAttributeLookup ( const SI_Symbol obj,
QPointer< const BI_Device device,
std::shared_ptr< const Part part,
std::shared_ptr< AssemblyVariant av 
)
noexcept

◆ ProjectAttributeLookup() [8/8]

ProjectAttributeLookup ( const BI_Device obj,
std::shared_ptr< const Part part 
)
noexcept

◆ ~ProjectAttributeLookup()

~ProjectAttributeLookup ( )
noexcept

Member Function Documentation

◆ operator()()

QString operator() ( const QString &  key) const
noexcept

Get the value of a specific attribute key.

Parameters
keyAttribute key (built-in or user-defined)
Returns
Attribute value. A null (empty) QString is returned if the requested attribute does not exist.

◆ operator=()

ProjectAttributeLookup & operator= ( const ProjectAttributeLookup rhs)
noexcept

◆ query() [1/8]

bool query ( const Project project,
const QString &  key,
QString &  value 
)
staticprivatenoexcept

◆ query() [2/8]

bool query ( const AssemblyVariant av,
const Circuit circuit,
const QString &  key,
QString &  value 
)
staticprivatenoexcept

◆ query() [3/8]

bool query ( const ComponentInstance cmp,
const QString &  key,
QString &  value 
)
staticprivatenoexcept

◆ query() [4/8]

bool query ( const Schematic schematic,
const QString &  key,
QString &  value 
)
staticprivatenoexcept

◆ query() [5/8]

bool query ( const Board board,
const QString &  key,
QString &  value 
)
staticprivatenoexcept

◆ query() [6/8]

bool query ( const SI_Symbol symbol,
const QString &  key,
QString &  value 
)
staticprivatenoexcept

◆ query() [7/8]

bool query ( const BI_Device device,
const QString &  key,
QString &  value 
)
staticprivatenoexcept

◆ query() [8/8]

bool query ( const Part part,
const QString &  key,
QString &  value 
)
staticprivatenoexcept

Member Data Documentation

◆ mFunction

LookupFunction mFunction
private

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