~ubuntu-branches/debian/squeeze/sword/squeeze

« back to all changes in this revision

Viewing changes to utilities/diatheke/diathekemgr.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Marsden, Jonathan Marsden, Dmitrijs Ledkovs, Closed Bugs
  • Date: 2009-05-30 11:55:55 UTC
  • mfrom: (1.3.1 upstream) (6.1.1 experimental)
  • Revision ID: james.westby@ubuntu.com-20090530115555-r427zsn3amivdpfu
Tags: 1.6.0+dfsg-1
[ Jonathan Marsden ]
* New upstream release. (Closes: #507960) (LP: #320558)
* debian/patches/02_libver.diff:
  - Bump SONAME to 8 -- SWORD 1.6 is not backward compatible with 1.5.11.
* debian/patches/series:
  - Remove 10_diatheke.diff -- included in upstream source.
* debian/patches/:
  - Remove several old unused .diff files.
  - Add 11_regex_only_when_needed.diff to conditionally include regex lib.
  - Add 12_fix_compiler_warnings.diff to remove all compiler warnings.
  - Add 13_fix_osis2mod_compression_default.diff from upstream svn.
  - Add 14_closing_section_not_chapter.diff from upstream svn.
* debian/libsword7.*: 
  - Rename to libsword8.*
  - Change libsword7 to libsword8 within files.
* debian/rules: 
  - SONAME bump to 8.
  - Set library version check to >= 1.6
* debian/control:
  - Change libsword7 to libsword8.
  - Add libsword7 to Conflicts.
  - Fix case of sword to SWORD in package descriptions.
  - Bump Standards-Version to 3.8.1 (no changes needed).
  - Fix section for libsword-dbg to avoid lintian warning.
* debian/rules:
  - Add DFSG get-orig-source target.
* debian/copyright:
  - Fix various mistakes in initial attempt to document copyrights.

[ Dmitrijs Ledkovs ]
* debian/rules: Added utils.mk to use missing-files target and call it on
  each build.
* debian/libsword-dev.install: Added libsword.la, previously missing.
* debian/libsword7.install: Added missing libicu translit files.
* debian/control:
  - Updated all uses of SWORD version to 1.6
  - Added libsword-dbg package
* debian/watch: Fixed a small mistake which was resulting in extra "."
  in final version name.
* debian/rules: simplified manpage processing.
* debian/libsword8.lintian-overrides: added override for module
  installation directory.
* debian/copyright: Updated with information about everyfile.
  Closes: #513448 LP: #322638
* debian/diatheke.examples: moved examples here from the diatheke.install
* debian/rules:
  - enabled shell script based testsuite
  - added commented out cppunit testsuite
* debian/patches/40_missing_includes.diff: 
  - added several missing stdio.h includes to prevent FTBFS of testsuite.

[ Closed Bugs ]
* FTBFS on intrepid (LP: #305172)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
 
3
 *      CrossWire Bible Society
 
4
 *      P. O. Box 2528
 
5
 *      Tempe, AZ  85280-2528
 
6
 *
 
7
 * This program is free software; you can redistribute it and/or modify it
 
8
 * under the terms of the GNU General Public License as published by the
 
9
 * Free Software Foundation version 2.
 
10
 *
 
11
 * This program is distributed in the hope that it will be useful, but
 
12
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
14
 * General Public License for more details.
 
15
 *
 
16
 */
 
17
 
 
18
//---------------------------------------------------------------------------
 
19
#include <swmodule.h>
 
20
 
 
21
#ifdef _ICU_
 
22
#include <utf8arshaping.h>
 
23
#include <utf8bidireorder.h>
 
24
#include <utf8transliterator.h>
 
25
#endif
 
26
 
 
27
#ifdef WIN32
 
28
#include <windows.h>
 
29
#endif
 
30
 
 
31
#include "diathekemgr.h"
 
32
 
 
33
//---------------------------------------------------------------------------
 
34
DiathekeMgr::DiathekeMgr (SWConfig * iconfig, SWConfig * isysconfig, bool autoload, char enc, char mark, bool ibidi, bool ishape)
 
35
        : SWMgr(iconfig, isysconfig, autoload, new DiathekeFilterMgr(mark, enc))
 
36
{
 
37
        bidi = ibidi;
 
38
        shape = ishape;
 
39
 
 
40
#ifdef _ICU_
 
41
        arshaping = new UTF8arShaping();
 
42
        bidireorder = new UTF8BiDiReorder();
 
43
        transliterator = new UTF8Transliterator();
 
44
#endif
 
45
        Load();
 
46
 
 
47
#ifdef WIN32
 
48
        OSVERSIONINFO osvi;
 
49
        memset (&osvi, 0, sizeof(OSVERSIONINFO));
 
50
        osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
 
51
        GetVersionEx(&osvi);
 
52
        platformID = osvi.dwPlatformId;
 
53
#endif
 
54
 
 
55
}
 
56
 
 
57
 
 
58
DiathekeMgr::~DiathekeMgr()
 
59
{
 
60
#ifdef _ICU_
 
61
        if (arshaping)
 
62
                delete arshaping;
 
63
        if (bidireorder)
 
64
                delete bidireorder;
 
65
        if (transliterator)
 
66
                delete transliterator;
 
67
#endif
 
68
}
 
69
 
 
70
 
 
71
void DiathekeMgr::AddRenderFilters(SWModule *module, ConfigEntMap &section)
 
72
{
 
73
        SWBuf lang;
 
74
        bool rtl;
 
75
        ConfigEntMap::iterator entry;
 
76
 
 
77
        lang = ((entry = section.find("Lang")) != section.end()) ? (*entry).second : (SWBuf)"en";
 
78
        rtl = ((entry = section.find("Direction")) != section.end()) ? ((*entry).second == "RtoL") : false;
 
79
 
 
80
#ifdef _ICU_
 
81
        if (shape) {
 
82
                module->AddRenderFilter(arshaping);
 
83
        }
 
84
        if (bidi && rtl) {
 
85
                module->AddRenderFilter(bidireorder);
 
86
        }
 
87
#endif
 
88
        SWMgr::AddRenderFilters(module, section);
 
89
}
 
90
 
 
91
signed char DiathekeMgr::Load () {
 
92
        signed char retval =  SWMgr::Load();
 
93
#ifdef _ICU_
 
94
        optionFilters["UTF8Transliterator"] = transliterator;
 
95
        options.push_back(transliterator->getOptionName());
 
96
#endif
 
97
        return retval;
 
98
};
 
99
 
 
100
void DiathekeMgr::AddGlobalOptions (SWModule * module, ConfigEntMap & section,
 
101
                                   ConfigEntMap::iterator start,
 
102
                                   ConfigEntMap::iterator end) {
 
103
 
 
104
        SWMgr::AddGlobalOptions(module, section, start, end);
 
105
#ifdef _ICU_
 
106
        module->AddOptionFilter(transliterator);
 
107
#endif
 
108
};
 
109