| # Gaudi Framework, version v25r0 |

Home |  | Generated: Mon Feb 17 2014

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
HbookName.h
Go to the documentation of this file.
1 #ifndef GAUDIALG_HBOOKNAME_H
2 #define GAUDIALG_HBOOKNAME_H 1
3 // Include files
4 #include <string>
5 #include <algorithm>
6
16 namespace
17 {
32 inline std::string dirHbookName
33 ( const std::string& addr ,
34 const int maxLen = 16 )
35 {
36 // ignore empty locations
37 if( addr.empty() ) { return std::string(); }
38 //
39 std::string old( addr );
40 // remove long names
41 if( 0 < maxLen && maxLen < (int) old.size() )
42 {
43 std::string::iterator p1,p2;
44 p1 = old.begin();
45 const char sep('/');
46 while( old.end() != p1 )
47 {
48 p1 =
49 std::find_if( p1 ,
50 old.end() ,
51 std::bind2nd(std::not_equal_to<char>(),sep));
52 p2 = std::find( p1 , old.end() , sep ) ;
53 if( ( p2 - p1 ) <= (int) maxLen ) { p1 = p2 ; continue ; }
54 old.insert( p1 + maxLen , sep ) ;
55 p1 = old.begin() ;
56 }
57 }
59 return old;
60 }
61
62 } // end of anonymous namespace
63
64 // ============================================================================
65 // The END
66 // ============================================================================
67 #endif // GAUDIALG_HBOOKNAME_H
68 // ============================================================================