|
KiCad PCB EDA Suite
|
A text evaluation frame with one frozen clock and memoized external queries. More...
#include <text_eval_environment.h>
Classes | |
| struct | CROSS_REFERENCE_VALUE |
| struct | SOURCE_VALUES |
| struct | VCS_VALUE |
Public Types | |
| enum class | VCS_QUERY { HEAD , HASH , DESCRIPTION , SIGNATURE , BRANCH , DIRTY , TIMESTAMP } |
| using | VCS_KEY = std::tuple<VCS_QUERY, wxString, std::string, int, bool> |
| Query, absolute path (Git directory for HEAD), selector or pattern, options, and whether the context is a file. | |
| using | CROSS_REFERENCE_KEY = std::pair<wxString, int> |
Public Member Functions | |
| ENVIRONMENT (const wxDateTime &aTime=wxDateTime::Now()) | |
| ENVIRONMENT (const ENVIRONMENT &)=delete | |
| ENVIRONMENT & | operator= (const ENVIRONMENT &)=delete |
| ~ENVIRONMENT () | |
| void | RecordEnvironmentVariable (const wxString &aName, const std::optional< wxString > &aValue) |
| void | RecordRandomUse () |
| void | RecordCrossReference (const CROSS_REFERENCE_KEY &aKey, const CROSS_REFERENCE_VALUE &aValue) |
| bool | IsCollectingSources () const |
| const wxString & | GitHash (const wxString &aPath, const std::function< wxString()> &aRead) |
| Return the value memoized for this frame. | |
| const VCS_VALUE & | VcsValue (const VCS_KEY &aKey, const std::function< VCS_VALUE()> &aRead) |
Static Public Member Functions | |
| static ENVIRONMENT * | Current () |
| static wxDateTime | CurrentTime () |
Private Attributes | |
| wxDateTime | m_time |
| std::map< wxString, wxString > | m_gitHashes |
| std::map< VCS_KEY, VCS_VALUE > | m_vcsValues |
| SOURCE_SCOPE * | m_sources = nullptr |
Friends | |
| class | SOURCE_SCOPE |
A text evaluation frame with one frozen clock and memoized external queries.
Owned and used by a single thread. Reads made while a SOURCE_SCOPE is open are recorded so a cache can tell whether evaluated text depends on anything outside the document.
Definition at line 43 of file text_eval_environment.h.
| using TEXT_EVAL::ENVIRONMENT::CROSS_REFERENCE_KEY = std::pair<wxString, int> |
Definition at line 68 of file text_eval_environment.h.
| using TEXT_EVAL::ENVIRONMENT::VCS_KEY = std::tuple<VCS_QUERY, wxString, std::string, int, bool> |
Query, absolute path (Git directory for HEAD), selector or pattern, options, and whether the context is a file.
Definition at line 58 of file text_eval_environment.h.
|
strong |
| Enumerator | |
|---|---|
| HEAD | |
| HASH | |
| DESCRIPTION | |
| SIGNATURE | |
| BRANCH | |
| DIRTY | |
| TIMESTAMP | |
Definition at line 46 of file text_eval_environment.h.
|
inlineexplicit |
Definition at line 90 of file text_eval_environment.h.
References m_time.
Referenced by Current(), ENVIRONMENT(), and operator=().
|
delete |
References ENVIRONMENT().
| TEXT_EVAL::ENVIRONMENT::~ENVIRONMENT | ( | ) |
Definition at line 32 of file text_eval_environment.cpp.
References m_sources.
|
static |
Definition at line 39 of file text_eval_environment.cpp.
References ENVIRONMENT().
Referenced by BOOST_AUTO_TEST_CASE(), calc_parser::EVAL_VISITOR::evaluateFunction(), KIGIT::PROJECT_GIT_UTILS::GetCurrentHash(), KIwxExpandEnvVars(), operator=(), TEXT_EVAL_VCS::ReadSource(), and SCHEMATIC::ResolveCrossReference().
|
static |
Definition at line 45 of file text_eval_environment.cpp.
References SOURCE_SCOPE.
Referenced by TITLE_BLOCK::GetCurrentDate(), calc_parser::DATE_UTILS::GetCurrentDays(), TITLE_BLOCK::GetCurrentTimeHHMMSS(), TITLE_BLOCK::GetCurrentTimeLocale(), calc_parser::DATE_UTILS::GetCurrentTimestamp(), and operator=().
| const wxString & TEXT_EVAL::ENVIRONMENT::GitHash | ( | const wxString & | aPath, |
| const std::function< wxString()> & | aRead ) |
Return the value memoized for this frame.
aRead runs only on the first request for a key.
Definition at line 78 of file text_eval_environment.cpp.
References m_gitHashes, m_sources, and SOURCE_SCOPE.
|
inline |
Definition at line 110 of file text_eval_environment.h.
References m_sources.
|
delete |
References Current(), CurrentTime(), ENVIRONMENT(), RecordCrossReference(), RecordEnvironmentVariable(), and RecordRandomUse().
| void TEXT_EVAL::ENVIRONMENT::RecordCrossReference | ( | const CROSS_REFERENCE_KEY & | aKey, |
| const CROSS_REFERENCE_VALUE & | aValue ) |
Definition at line 71 of file text_eval_environment.cpp.
References m_sources, and SOURCE_SCOPE.
Referenced by operator=().
| void TEXT_EVAL::ENVIRONMENT::RecordEnvironmentVariable | ( | const wxString & | aName, |
| const std::optional< wxString > & | aValue ) |
Definition at line 57 of file text_eval_environment.cpp.
References m_sources, and SOURCE_SCOPE.
Referenced by operator=().
| void TEXT_EVAL::ENVIRONMENT::RecordRandomUse | ( | ) |
Definition at line 64 of file text_eval_environment.cpp.
References m_sources, and SOURCE_SCOPE.
Referenced by operator=().
| const ENVIRONMENT::VCS_VALUE & TEXT_EVAL::ENVIRONMENT::VcsValue | ( | const VCS_KEY & | aKey, |
| const std::function< VCS_VALUE()> & | aRead ) |
Definition at line 92 of file text_eval_environment.cpp.
References m_sources, m_vcsValues, and SOURCE_SCOPE.
|
friend |
Definition at line 119 of file text_eval_environment.h.
References SOURCE_SCOPE.
Referenced by CurrentTime(), GitHash(), RecordCrossReference(), RecordEnvironmentVariable(), RecordRandomUse(), SOURCE_SCOPE, and VcsValue().
|
private |
Definition at line 122 of file text_eval_environment.h.
Referenced by GitHash().
|
private |
Definition at line 124 of file text_eval_environment.h.
Referenced by GitHash(), IsCollectingSources(), RecordCrossReference(), RecordEnvironmentVariable(), RecordRandomUse(), VcsValue(), and ~ENVIRONMENT().
|
private |
Definition at line 121 of file text_eval_environment.h.
Referenced by ENVIRONMENT().
Definition at line 123 of file text_eval_environment.h.
Referenced by VcsValue().