122 int passbegin,
int passend )
128 set_S::iterator notyet = tried.end();
140 = FileUtil::uriFilename(
_datasourceinfo->list().dataSource()->url() );
143 if( urioptions.
get() ) {
146 options->copyProperties( urioptions );
150 options->getProperty(
"format", format );
151 localMsg(
"format hint: " + format );
152 bool exactformat =
false;
155 carto::Object exact = options->getProperty(
"exact_format" );
156 exactformat = exact->getScalar();
163 if( passbegin <= 1 && passend >= 1 && !format.empty() )
171 localMsg(
"1. try writer " + format );
185 catch( std::exception & e )
187 localMsg(
"1. " + format +
" failed" );
193 tried.insert( format );
195 else if( exactformat )
203 multi_S::const_iterator ie, ee;
207 if( passbegin <= 2 && passend >= 2 )
210 iext = extensions.equal_range( ext );
211 for( ie=iext.first, ee=iext.second; ie!=ee; ++ie )
212 if( tried.find( ie->second ) == notyet ) {
218 localMsg(
"2. try writer " + ie->second );
221 localMsg(
"2. " + ie->second +
" OK" );
232 catch( std::exception & e )
234 localMsg(
" 2. " + ie->second +
" failed" );
240 tried.insert( ie->second );
246 if( passbegin <= 3 && passend >= 3 && !ext.empty() )
249 iext = extensions.equal_range(
"" );
250 for( ie=iext.first, ee=iext.second; ie!=ee; ++ie )
251 if( tried.find( ie->second ) == notyet ) {
257 localMsg(
"3. try writer " + ie->second );
260 localMsg(
"3. " + ie->second +
" OK" );
271 catch( std::exception & e )
273 localMsg(
"3. " + ie->second +
" failed" );
279 tried.insert( ie->second );
285 if( passbegin <= 4 && passend >= 4 )
288 iext.first = extensions.begin();
289 iext.second = extensions.end();
290 for( ie=iext.first, ee=iext.second; ie!=ee; ++ie )
291 if( tried.find( ie->second ) == notyet ) {
297 localMsg(
"4. try writer " + ie->second );
300 localMsg(
"4. " + ie->second +
" OK" );
311 catch( std::exception & e )
313 localMsg(
"4. " + ie->second +
" failed" );
319 tried.insert( ie->second );
326 filename +
" : no matching format" );
virtual bool write(const T &obj, carto::Object options=carto::none(), int passbegin=1, int passend=4)
Finds the correct format and writes the object.