summaryrefslogtreecommitdiffstats
path: root/connectivity/source/drivers/mork/mork_helper.cxx
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 16:51:28 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 16:51:28 +0000
commit940b4d1848e8c70ab7642901a68594e8016caffc (patch)
treeeb72f344ee6c3d9b80a7ecc079ea79e9fba8676d /connectivity/source/drivers/mork/mork_helper.cxx
parentInitial commit. (diff)
downloadlibreoffice-upstream.tar.xz
libreoffice-upstream.zip
Adding upstream version 1:7.0.4.upstream/1%7.0.4upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'connectivity/source/drivers/mork/mork_helper.cxx')
-rw-r--r--connectivity/source/drivers/mork/mork_helper.cxx54
1 files changed, 54 insertions, 0 deletions
diff --git a/connectivity/source/drivers/mork/mork_helper.cxx b/connectivity/source/drivers/mork/mork_helper.cxx
new file mode 100644
index 000000000..4cb11864f
--- /dev/null
+++ b/connectivity/source/drivers/mork/mork_helper.cxx
@@ -0,0 +1,54 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+
+#include "MorkParser.hxx"
+#include <iostream>
+#include <sal/log.hxx>
+
+static bool openAddressBook(const std::string& path)
+{
+ MorkParser mork;
+ // Open and parse mork file
+ if (!mork.open(path))
+ {
+ return false;
+ }
+
+ const int defaultScope = 0x80;
+ MorkTableMap *Tables = mork.getTables( defaultScope );
+ if ( Tables )
+ {
+ // Iterate all tables
+ for (auto const& table : Tables->map)
+ {
+ if ( 0 == table.first ) continue;
+ SAL_INFO("connectivity.mork", "table->first : " << table.first);
+ std::string column = mork.getColumn( table.first );
+ std::string value = mork.getValue( table.first );
+ SAL_INFO("connectivity.mork", "table.column : " << column);
+ SAL_INFO("connectivity.mork", "table.value : " << value);
+ }
+ }
+
+ mork.dump();
+
+ return true;
+}
+
+int main(int argc, char* argv[])
+{
+ if (argc < 2)
+ {
+ std::cerr << "Usage: " << argv[0] << " <path-to>/abook.mab" << std::endl;
+ std::cerr << "Example: " << argv[0] << " /home/johndoe/.thunderbird/m0tpqlky.default/abook.mab" << std::endl;
+
+ return 1;
+ }
+
+ OString aOString(argv[1]);
+ SAL_INFO("connectivity.mork", "abook.mab: " << aOString);
+ openAddressBook(aOString.getStr());
+
+ return 0;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */