| 79 | // Raise an exception if it can't be loaded. |
| 80 | |
| 81 | CachedFileRcPtr LocalFileFormat::read(std::istream & istream, |
| 82 | const std::string & fileName, |
| 83 | Interpolation /*interp*/) const |
| 84 | { |
| 85 | LocalCachedFileRcPtr cachedFile = LocalCachedFileRcPtr(new LocalCachedFile()); |
| 86 | |
| 87 | CDLParser parser(fileName); |
| 88 | try |
| 89 | { |
| 90 | parser.parse(istream); |
| 91 | parser.getCDLTransform(cachedFile->m_transform); |
| 92 | } |
| 93 | catch(Exception & e) |
| 94 | { |
| 95 | std::ostringstream os; |
| 96 | os << "Error parsing .cc file. "; |
| 97 | os << "Does not appear to contain a valid ASC CDL XML:"; |
| 98 | os << e.what(); |
| 99 | throw Exception(os.str().c_str()); |
| 100 | } |
| 101 | if (!parser.isCC()) |
| 102 | { |
| 103 | std::ostringstream os; |
| 104 | os << "File '" << fileName << "' is not a .cc file."; |
| 105 | throw Exception(os.str().c_str()); |
| 106 | } |
| 107 | |
| 108 | return cachedFile; |
| 109 | } |
| 110 | |
| 111 | void LocalFileFormat::write(const ConstConfigRcPtr & /*config*/, |
| 112 | const ConstContextRcPtr & /*context*/, |
nothing calls this directly
no test coverage detected