mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-10 10:41:50 +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] = {};
|
static char test[1024] = {};
|
||||||
ImGui::SetNextItemWidth( -1 );
|
ImGui::SetNextItemWidth( -1 );
|
||||||
ImGui::InputTextWithHint( "##srcSubstTest", "Enter example source location to test substitutions", test, 1024 );
|
ImGui::InputTextWithHint( "##srcSubstTest", "Enter example source location to test substitutions", test, 1024 );
|
||||||
std::string res = test;
|
|
||||||
std::string tmp;
|
|
||||||
if( m_sourceRegexValid )
|
if( m_sourceRegexValid )
|
||||||
{
|
{
|
||||||
for( auto& v : m_sourceSubstitutions )
|
TextFocused( "Result:", SourceSubstitution( test ) );
|
||||||
{
|
|
||||||
tmp = std::regex_replace( res, v.regex, v.target );
|
|
||||||
std::swap( tmp, res );
|
|
||||||
}
|
|
||||||
TextFocused( "Result:", res.c_str() );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -16122,4 +16115,17 @@ bool View::GetZoneRunningTime( const ContextSwitch* ctx, const ZoneEvent& ev, in
|
|||||||
return true;
|
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(); }
|
std::string GetAddress() const { return m_worker.GetAddr(); }
|
||||||
int GetPort() const { return m_worker.GetPort(); }
|
int GetPort() const { return m_worker.GetPort(); }
|
||||||
|
|
||||||
|
const char* SourceSubstitution( const char* srcFile ) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum class Namespace : uint8_t
|
enum class Namespace : uint8_t
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user