build fix
[LibreOffice.git] / connectivity / source / drivers / mork / mork_helper.cxx
blob7ef3a5f760070e822ce1e499398d738cab4e4527
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 #include "MorkParser.hxx"
4 #include <iostream>
6 bool openAddressBook(const std::string& path)
8 MorkParser mork;
9 // Open and parse mork file
10 if (!mork.open(path))
12 return false;
14 const int defaultScope = 0x80;
15 MorkTableMap::Map::const_iterator tableIter;
16 MorkTableMap *Tables = mork.getTables( defaultScope );
17 if ( Tables )
19 // Iterate all tables
20 for ( tableIter = Tables->map.begin(); tableIter != Tables->map.end(); ++tableIter )
22 if ( 0 == tableIter->first ) continue;
23 SAL_INFO("connectivity.mork", "table->first : " << tableIter->first);
24 std::string column = mork.getColumn( tableIter->first );
25 std::string value = mork.getValue( tableIter->first );
26 SAL_INFO("connectivity.mork", "table.column : " << column);
27 SAL_INFO("connectivity.mork", "table.value : " << value);
31 mork.dump();
33 return true;
36 int main(int argc, char* argv[])
38 if (argc < 2)
40 std::cerr << "Usage: " << argv[0] << " <path-to>/abook.mab" << std::endl;
41 std::cerr << "Example: " << argv[0] << " /home/johndoe/.thunderbird/m0tpqlky.default/abook.mab" << std::endl;
43 return 1;
46 OString aOString(argv[1]);
47 SAL_INFO("connectivity.mork", "abook.mab: " << aOString);
48 openAddressBook(aOString.getStr());
50 return 0;
53 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */