mac-sandboxing: also exclude AppleRemote when using --enable-mergelibs
[LibreOffice.git] / l10ntools / source / treex.cxx
blob4e8fe0b2641488249774a85be8245fb3165e204c
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
10 #include <iostream>
11 #include <cstring>
12 #include <sal/main.h>
14 #include <common.hxx>
15 #include <treemerge.hxx>
17 static void WriteUsage()
19 std::cout
20 << ("Syntax: Treex [-r Root] -i FileIn -o FileOut"
21 " [-m DataBase] [-l Lang]\n"
22 " Root: Path to root of localized xhp files\n"
23 " FileIn: Source files (*.tree)\n"
24 " FileOut: Destination file (*.*)\n"
25 " DataBase: Mergedata (*.po)\n"
26 " Lang: Restrict the handled languages; one element of\n"
27 " (de, en-US, ...) or all\n");
31 SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
33 OString sXHPRoot;
34 for (int nIndex = 1; nIndex != argc; ++nIndex)
36 if (std::strcmp(argv[nIndex], "-r") == 0)
38 sXHPRoot = OString( argv[nIndex + 1] );
39 for( int nIndex2 = nIndex+3; nIndex2 < argc; nIndex2 = nIndex2 + 2 )
41 argv[nIndex-3] = argv[nIndex-1];
42 argv[nIndex-2] = argv[nIndex];
44 argc = argc - 2;
45 break;
48 common::HandledArgs aArgs;
49 if( !common::handleArguments(argc, argv, aArgs) )
51 WriteUsage();
52 return 1;
55 TreeParser aParser(aArgs.m_sInputFile, aArgs.m_sLanguage );
56 if( !aParser.isInitialized() )
58 return 1;
61 if( aArgs.m_bMergeMode || !sXHPRoot.isEmpty() )
63 aParser.Merge( aArgs.m_sMergeSrc, aArgs.m_sOutputFile, sXHPRoot );
65 else
67 aParser.Extract( aArgs.m_sOutputFile );
69 return 0;
72 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */