42 std::stringstream lStr;
43 lStr <<
"[" << aIndex <<
"]";
49 std::stringstream lStr;
50 lStr <<
"#" << aIndex;
56 std::stringstream lStr;
57 lStr <<
"T" << aIndex;
73 std::stringstream lStr;
75 std::vector< std::string >::iterator lTypesIt (
mTypes.end() );
76 lStr << * ( --lTypesIt );
78 while ( --lTypesIt >=
mTypes.begin() )
80 lStr <<
"\n" <<
mIndent << ( *mStyling ) ( lTypesIt -
mTypes.begin() ) <<
" = " << *lTypesIt;
90 while ( * ( aEnd-1 ) ==
' ' )
101 std::stringstream lStr;
102 std::string::const_iterator lStart;
103 uint32_t lCounter ( 0 );
106 for ( ; aIt != aEnd ; ++aIt )
113 if ( lCounter++ == 0 )
123 if ( --lCounter == 0 )
125 if ( aIt - lStart > 1 )
127 lStr <<
" " << ( *mStyling ) (
RecursiveClean ( lStart, aIt ) ) <<
" ";
138 if ( aIt - lStart > 1 )
140 lStr <<
" " << ( *mStyling ) (
RecursiveClean ( lStart, aIt ) ) <<
" ";
153 lStr <<
" " << ( *mStyling ) (
RecursiveClean ( lStart, aIt ) ) << *aIt <<
" ";
162 if ( ( *aIt !=
' ' ) || ( aIt+1 == aEnd ) || ( * ( aIt+1 ) !=
' ' ) )
173 std::string lTemp ( lStr.str() );
174 std::vector< std::string >::iterator lTypesIt = std::find (
mTypes.begin() ,
mTypes.end() , lTemp );
176 if ( lTypesIt !=
mTypes.end() )
178 return lTypesIt -
mTypes.begin();
182 mTypes.push_back ( lTemp );
GccOutputCleaner(const uint32_t &aIndent=2, std::string(*aStyling)(const uint32_t &)=&GccOutputCleaner::SquareBracketStyle)
Constructor.
static std::string TStyle(const uint32_t &aIndex)
Prefix the type-substitution index with a T
std::vector< std::string > mTypes
A vector of known types, the position of which into this list becomes the substitution index...
std::string(* mStyling)(const uint32_t &)
The functor for styling the type-substitution index.
virtual ~GccOutputCleaner()
Destructor.
uint32_t RecursiveClean(std::string::const_iterator aIt, std::string::const_iterator aEnd)
Recursively perform sub-term extraction from the string.
static std::string HashStyle(const uint32_t &aIndex)
Prefix the type-substitution index with a #
std::string mIndent
The number of spaces by which to indent the lines.
std::string operator()(const std::string &aStr)
Functor implementation.
static std::string SquareBracketStyle(const uint32_t &aIndex)
Wrap the type-substitution index in square braces.