Changeset 1599:b3d6c00c911e
- Timestamp:
- 03/02/10 06:28:22 (5 months ago)
- Branch:
- default
- File:
-
- 1 edited
-
apps/las2oci.cpp (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
apps/las2oci.cpp
r1598 r1599 83 83 84 84 85 std::istream* OpenInput(std::string filename) 86 { 87 std::ios::openmode const mode = std::ios::in | std::ios::binary; 85 std::istream* OpenInput(std::string filename, bool bEnd) 86 { 87 std::ios::openmode mode = std::ios::in | std::ios::binary; 88 if (bEnd == true) { 89 mode = mode | std::ios::ate; 90 } 88 91 std::istream* istrm; 89 92 if (compare_no_case(filename.c_str(),"STDIN",5) == 0) … … 103 106 } 104 107 return istrm; 108 } 109 110 std::string ReadSQLData(char* filename) 111 { 112 std::istream* infile = OpenInput(filename, true); 113 ifstream::pos_type size; 114 char* data; 115 if (infile->good()){ 116 size = infile->tellg(); 117 data = new char [size]; 118 infile->seekg (0, ios::beg); 119 infile->read (data, size); 120 // infile->close(); 121 122 std::string output = std::string(data); 123 delete[] data; 124 delete infile; 125 return output; 126 } 127 else 128 { 129 delete infile; 130 return std::string(""); 131 } 105 132 } 106 133 … … 1349 1376 { 1350 1377 i++; 1351 pre_sql = std::string(argv[i]); 1378 try { 1379 pre_sql = ReadSQLData(argv[i]); 1380 } catch (std::runtime_error const& e) { 1381 pre_sql = std::string(argv[i]); 1382 } 1352 1383 } 1353 1384 else if ( strcmp(argv[i],"--post-sql") == 0 || … … 1356 1387 { 1357 1388 i++; 1358 post_sql = std::string(argv[i]); 1389 try { 1390 post_sql = ReadSQLData(argv[i]); 1391 } catch (std::runtime_error const& e) { 1392 post_sql = std::string(argv[i]); 1393 } 1359 1394 } 1360 1395 else if ( strcmp(argv[i],"--pre-block-sql") == 0 || … … 1363 1398 { 1364 1399 i++; 1365 pre_block_sql = std::string(argv[i]); 1400 try { 1401 pre_block_sql = ReadSQLData(argv[i]); 1402 } catch (std::runtime_error const& e) { 1403 pre_block_sql = std::string(argv[i]); 1404 } 1366 1405 } 1367 1406 else if ( strcmp(argv[i],"--aux-columns") == 0 || … … 1519 1558 std::istream* istrm; 1520 1559 try { 1521 istrm = OpenInput(input );1560 istrm = OpenInput(input, false); 1522 1561 } catch (std::exception const& e) 1523 1562 { … … 1580 1619 os << input << ".kdx" ; 1581 1620 1582 std::istream* kdx = OpenInput(os.str() );1621 std::istream* kdx = OpenInput(os.str(), false); 1583 1622 query = new LASQuery(*kdx); 1584 1623 } … … 1589 1628 1590 1629 std::istream* istrm2; 1591 istrm2 = OpenInput(input );1630 istrm2 = OpenInput(input, false); 1592 1631 LASReader* reader2 = new LASReader(*istrm2); 1593 1632
Note: See TracChangeset
for help on using the changeset viewer.
