mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-26 16:04:34 +00:00
Expose source substitution interface.
This commit is contained in:
parent
5f22e35c26
commit
47cfb4ae35
@ -12949,16 +12949,9 @@ void View::DrawInfo()
|
||||
static char test[1024] = {};
|
||||
ImGui::SetNextItemWidth( -1 );
|
||||
ImGui::InputTextWithHint( "##srcSubstTest", "Enter example source location to test substitutions", test, 1024 );
|
||||
std::string res = test;
|
||||
std::string tmp;
|
||||
if( m_sourceRegexValid )
|
||||
{
|
||||
for( auto& v : m_sourceSubstitutions )
|
||||
{
|
||||
tmp = std::regex_replace( res, v.regex, v.target );
|
||||
std::swap( tmp, res );
|
||||
}
|
||||
TextFocused( "Result:", res.c_str() );
|
||||
TextFocused( "Result:", SourceSubstitution( test ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -16122,4 +16115,17 @@ bool View::GetZoneRunningTime( const ContextSwitch* ctx, const ZoneEvent& ev, in
|
||||
return true;
|
||||
}
|
||||
|
||||
const char* View::SourceSubstitution( const char* srcFile ) const
|
||||
{
|
||||
if( !m_sourceRegexValid || m_sourceSubstitutions.empty() ) return srcFile;
|
||||
static std::string res, tmp;
|
||||
res.assign( srcFile );
|
||||
for( auto& v : m_sourceSubstitutions )
|
||||
{
|
||||
tmp = std::regex_replace( res, v.regex, v.target );
|
||||
std::swap( tmp, res );
|
||||
}
|
||||
return res.c_str();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -89,6 +89,8 @@ public:
|
||||
std::string GetAddress() const { return m_worker.GetAddr(); }
|
||||
int GetPort() const { return m_worker.GetPort(); }
|
||||
|
||||
const char* SourceSubstitution( const char* srcFile ) const;
|
||||
|
||||
private:
|
||||
enum class Namespace : uint8_t
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user