KiCad PCB EDA Suite
Loading...
Searching...
No Matches
db_backend_support.cpp File Reference
#include "db_backend_support.h"
#include <cctype>
#include <cstddef>
#include <utility>
#include <wx/intl.h>
#include <wx/string.h>

Go to the source code of this file.

Functions

DB_WORKER_FAILURE DescribeWorkerOutcome (DB_WORKER_THREAD::OUTCOME aOutcome, const std::string &aPath)
 Maps the outcome of a call that returned no result to a failure and a connection decision.
 
std::string ScrubSecret (std::string aText, const std::string &aSecret)
 Replaces a secret in a message, as ***.
 
std::string RedactDetail (const std::string &aDetail, const std::string &aSecret)
 The provider text to show for a call made with aSecret, which is nothing at all when the secret is short.
 

Function Documentation

◆ DescribeWorkerOutcome()

DB_WORKER_FAILURE DescribeWorkerOutcome ( DB_WORKER_THREAD::OUTCOME aOutcome,
const std::string & aPath )

◆ RedactDetail()

std::string RedactDetail ( const std::string & aDetail,
const std::string & aSecret )

The provider text to show for a call made with aSecret, which is nothing at all when the secret is short.

Definition at line 148 of file db_backend_support.cpp.

References ScrubSecret().

Referenced by describeFailure().

◆ ScrubSecret()

std::string ScrubSecret ( std::string aText,
const std::string & aSecret )

Replaces a secret in a message, as ***.

The doubled-quote form that an initialization string holds for a secret containing a quote goes too.

A secret of four or more characters goes wherever it occurs. A shorter one goes only where it stands apart from letters, digits and non-ASCII bytes, since replacing a one-character secret inside words would leave the message unreadable. That leaves a short secret hiding inside a longer word, so provider text that may echo a short secret must go through RedactDetail instead.

Definition at line 95 of file db_backend_support.cpp.

References end.

Referenced by ACE_BACKEND::fail(), and RedactDetail().