| 53 | |
| 54 | template<> |
| 55 | void PathMatcherData::save( SaveContext *context ) const |
| 56 | { |
| 57 | Data::save( context ); |
| 58 | IndexedIOPtr container = context->container( staticTypeName(), g_ioVersion ); |
| 59 | |
| 60 | std::vector<InternedString> strings; |
| 61 | std::vector<unsigned int> pathLengths; |
| 62 | std::vector<unsigned char> exactMatches; |
| 63 | |
| 64 | for( PathMatcher::RawIterator it = readable().begin(), eIt = readable().end(); it != eIt; ++it ) |
| 65 | { |
| 66 | pathLengths.push_back( it->size() ); |
| 67 | if( it->size() ) |
| 68 | { |
| 69 | strings.push_back( it->back() ); |
| 70 | } |
| 71 | exactMatches.push_back( it.exactMatch() ); |
| 72 | } |
| 73 | |
| 74 | container->write( "strings", strings.data(), strings.size() ); |
| 75 | container->write( "pathLengths", pathLengths.data(), pathLengths.size() ); |
| 76 | container->write( "exactMatches", exactMatches.data(), exactMatches.size() ); |
| 77 | } |
| 78 | |
| 79 | template<> |
| 80 | void PathMatcherData::load( LoadContextPtr context ) |