Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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 : */
9 :
10 : #include <iostream>
11 : #include <cstring>
12 : #include "sal/main.h"
13 :
14 : #include "common.hxx"
15 : #include "treemerge.hxx"
16 :
17 0 : void WriteUsage()
18 : {
19 : std::cout
20 0 : << "Syntax: Treex [-r Root] -i FileIn -o FileOut"
21 0 : << " [-m DataBase] [-l Lang]\n"
22 0 : << " Root: Path to root of localized xhp files\n"
23 0 : << " FileIn: Source files (*.tree)\n"
24 0 : << " FileOut: Destination file (*.*)\n"
25 0 : << " DataBase: Mergedata (*.po)\n"
26 0 : << " Lang: Restrict the handled languages; one element of\n"
27 0 : << " (de, en-US, ...) or all\n";
28 0 : }
29 :
30 :
31 0 : SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
32 : {
33 0 : OString sXHPRoot;
34 0 : for (int nIndex = 1; nIndex != argc; ++nIndex)
35 : {
36 0 : if (std::strcmp(argv[nIndex], "-r") == 0)
37 : {
38 0 : sXHPRoot = OString( argv[nIndex + 1] );
39 0 : for( int nIndex2 = nIndex+3; nIndex2 < argc; nIndex2 = nIndex2 + 2 )
40 : {
41 0 : argv[nIndex-3] = argv[nIndex-1];
42 0 : argv[nIndex-2] = argv[nIndex];
43 : }
44 0 : argc = argc - 2;
45 0 : break;
46 : }
47 : }
48 0 : common::HandledArgs aArgs;
49 0 : if( !common::handleArguments(argc, argv, aArgs) )
50 : {
51 0 : WriteUsage();
52 0 : return 1;
53 : }
54 :
55 0 : TreeParser aParser(aArgs.m_sInputFile, aArgs.m_sLanguage );
56 0 : if( !aParser.isInitialized() )
57 : {
58 0 : return 1;
59 : }
60 :
61 0 : if( aArgs.m_bMergeMode || !sXHPRoot.isEmpty() )
62 : {
63 0 : aParser.Merge( aArgs.m_sMergeSrc, aArgs.m_sOutputFile, sXHPRoot );
64 : }
65 : else
66 : {
67 0 : aParser.Extract( aArgs.m_sOutputFile );
68 : }
69 0 : return 0;
70 0 : }
71 :
72 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|