| 78 | } |
| 79 | |
| 80 | FrameListPtr FrameList::parse( const std::string &frameList ) |
| 81 | { |
| 82 | std::string s; |
| 83 | |
| 84 | /// Strip whitespace |
| 85 | for ( std::string::const_iterator it = frameList.begin(); it != frameList.end(); ++it ) |
| 86 | { |
| 87 | if ( *it == ' ' || *it == '\n' || *it == '\r' || *it == '\n' ) |
| 88 | { |
| 89 | continue; |
| 90 | } |
| 91 | |
| 92 | s += *it; |
| 93 | } |
| 94 | |
| 95 | /// Strip enclosing brackets |
| 96 | if ( s.size() >= 2 && s[0] == '(' && s[ s.size() - 1 ] == ')' ) |
| 97 | { |
| 98 | s = s.substr( 1, s.size() - 2 ); |
| 99 | } |
| 100 | |
| 101 | ParserList *l = parserList(); |
| 102 | for ( ParserList::const_iterator it = l->begin(); it != l->end(); ++it ) |
| 103 | { |
| 104 | FrameListPtr f = (*it)( s ); |
| 105 | if ( f ) |
| 106 | { |
| 107 | return f; |
| 108 | } |
| 109 | } |
| 110 | |
| 111 | throw Exception( ( boost::format( "\"%s\" does not define a valid frame list." ) % ( frameList ) ).str() ); |
| 112 | } |
| 113 | |
| 114 | bool FrameList::isEqualTo( ConstFrameListPtr other ) const |
| 115 | { |