1 #ifndef GAUDIALG_HBOOKNAME_H
2 #define GAUDIALG_HBOOKNAME_H 1
32 inline std::string dirHbookName
33 (
const std::string& addr ,
34 const int maxLen = 16 )
37 if( addr.empty() ) {
return std::string(); }
39 std::string old( addr );
41 if( 0 < maxLen && maxLen < (
int) old.size() )
43 auto p1 = old.begin();
45 while( old.end() != p1 )
50 [&](
const char&
c) {
return c!=sep; } );
51 auto p2 = std::find( p1 , old.end() , sep ) ;
52 if( ( p2 - p1 ) <= (int) maxLen ) { p1 = p2 ; continue ; }
53 old.insert( p1 + maxLen , sep ) ;
66 #endif // GAUDIALG_HBOOKNAME_H