Doxygen
Loading...
Searching...
No Matches
aliases.h File Reference
#include <string>
#include <string_view>
+ Include dependency graph for aliases.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

std::string resolveAliasCmd (std::string_view aliasCmd)
 
bool isAliasCmd (std::string_view aliasCmd)
 
void readAliases ()
 

Function Documentation

◆ isAliasCmd()

bool isAliasCmd ( std::string_view aliasCmd)

Definition at line 528 of file aliases.cpp.

529{
530 return g_aliasInfoMap.find(std::string{aliasCmd}) != g_aliasInfoMap.end();
531}
static AliasInfoMap g_aliasInfoMap
Definition aliases.cpp:52

References g_aliasInfoMap.

Referenced by DocPara::handleCommand().

◆ readAliases()

void readAliases ( )

Definition at line 170 of file aliases.cpp.

171{
172 // add aliases to a dictionary
173 const StringVector &aliasList = Config_getList(ALIASES);
174 for (const auto &al : aliasList)
175 {
177 }
178 for (auto &[name,overloads] : g_aliasInfoMap)
179 {
180 for (auto &[numParams,aliasInfo] : overloads)
181 {
182 aliasInfo.value = expandAlias(name+":"+std::to_string(numParams),aliasInfo.value);
183 }
184 }
185 for (auto &[name,overloads] : g_aliasInfoMap)
186 {
187 for (auto &[numParams,aliasInfo] : overloads)
188 {
189 aliasInfo.value = escapeAlias(aliasInfo.value);
190 }
191 }
192}
static std::string expandAlias(std::string_view aliasName, std::string_view aliasValue)
Definition aliases.cpp:514
static void addValidAliasToMap(std::string_view alias)
Definition aliases.cpp:56
static std::string escapeAlias(std::string_view value)
Definition aliases.cpp:160
#define Config_getList(name)
Definition config.h:38
std::vector< std::string > StringVector
Definition containers.h:33

References addValidAliasToMap(), Config_getList, escapeAlias(), expandAlias(), and g_aliasInfoMap.

Referenced by adjustConfiguration().

◆ resolveAliasCmd()

std::string resolveAliasCmd ( std::string_view aliasCmd)

Definition at line 504 of file aliases.cpp.

505{
506 StringUnorderedSet aliasesProcessed;
507 //printf("Expanding: '%s'\n",qPrint(aliasCmd));
508 std::string result = expandAliasRec(aliasesProcessed,aliasCmd);
509 //printf("Expanding result: '%s'->'%s'\n",qPrint(aliasCmd),qPrint(result));
510 Debug::print(Debug::Alias,0,"Resolving alias: cmd='%s' result='%s'\n",qPrint(std::string{aliasCmd}),qPrint(result));
511 return result;
512}
static std::string expandAliasRec(StringUnorderedSet &aliasesProcessed, std::string_view s, bool allowRecursion=FALSE)
Definition aliases.cpp:344
@ Alias
Definition debug.h:45
static void print(DebugMask mask, int prio, const char *fmt,...)
Definition debug.cpp:81
std::unordered_set< std::string > StringUnorderedSet
Definition containers.h:29
const char * qPrint(const char *s)
Definition qcstring.h:672

References Debug::Alias, expandAliasRec(), Debug::print(), and qPrint().

Referenced by replaceAliases().