| 63 | } |
| 64 | |
| 65 | bool ObjectReader::canRead( const std::string &fileName ) |
| 66 | { |
| 67 | // Ideally we'd like to look inside the file and see if it contains one object only |
| 68 | // but for efficiency purposes we'll just try and open the file as a database and |
| 69 | // see if that succeeds. We could possibly query the structure of the database and |
| 70 | // check that it matches the signature of a one-object cache without needing to |
| 71 | // actually read the data. |
| 72 | IndexedIOPtr io = nullptr; |
| 73 | |
| 74 | try |
| 75 | { |
| 76 | if ( FileIndexedIO::canRead( fileName ) ) |
| 77 | { |
| 78 | return true; |
| 79 | } |
| 80 | |
| 81 | io = open(fileName); |
| 82 | return true; |
| 83 | } |
| 84 | |
| 85 | catch (Exception &) |
| 86 | { |
| 87 | return false; |
| 88 | } |
| 89 | |
| 90 | } |
| 91 | |
| 92 | ObjectPtr ObjectReader::doOperation( const CompoundObject * operands ) |
| 93 | { |
no outgoing calls