diff options
author | Andras Bartek <barteka13@gmail.com> | 2012-09-06 21:11:23 +0200 |
---|---|---|
committer | Andras Timar <atimar@suse.com> | 2012-09-10 14:17:58 +0200 |
commit | e3b927787f3643f9e584cc80c974d5f907a94858 (patch) | |
tree | e08cd4fca4955115f391dac8b6c760ce1df45806 /l10ntools/inc/gsicheck.hxx | |
parent | da329b8bb04f5d6a5c89afb7f083c7de679d5691 (diff) |
fdo#52246 let helpex use gsicheck's tag checker
So the build will not break on translations errors in help.
English segment will be used, when the localized segment
has fatal error in it, e.g. a tag error that results in
invalid xml.
Change-Id: I8a74649d1f00f6379a7244f2582d27b8a437cd2f
Signed-off-by: Andras Timar <atimar@suse.com>
Diffstat (limited to 'l10ntools/inc/gsicheck.hxx')
-rw-r--r-- | l10ntools/inc/gsicheck.hxx | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/l10ntools/inc/gsicheck.hxx b/l10ntools/inc/gsicheck.hxx index 467925e46767..266ea96c2543 100644 --- a/l10ntools/inc/gsicheck.hxx +++ b/l10ntools/inc/gsicheck.hxx @@ -33,6 +33,7 @@ #include <cstddef> #include <vector> +#include <fstream> #include "tagtest.hxx" @@ -131,6 +132,65 @@ public: void WriteFixed( LazyStream &aFixOut ); }; +sal_Bool check(rtl::OString s,std::size_t nLine); + +void PrintMessage( rtl::OString const & aType, rtl::OString const & aMsg, rtl::OString const & aPrefix, + rtl::OString const & aContext, sal_Bool bPrintContext, std::size_t nLine, rtl::OString aUniqueId = rtl::OString() ); + +void PrintError( rtl::OString const & aMsg, rtl::OString const & aPrefix, + rtl::OString const & aContext, sal_Bool bPrintContext, std::size_t nLine, rtl::OString const & aUniqueId = rtl::OString() ); + +bool LanguageOK( rtl::OString const & aLang ); + +class LazyStream: public std::ofstream +{ + +private: + rtl::OString aFileName; + bool bOpened; + +public: + LazyStream() + : aFileName() + , bOpened(false) + {}; + + void SetFileName( const rtl::OString& rFileName ) + { + aFileName = rFileName; + }; + + void LazyOpen(); +}; + +namespace { + +sal_Int32 const MAX_GID_LID_LEN = 250; + +rtl::OString copyUpTo( + rtl::OString const & text, sal_Int32 start, sal_Int32 maximumLength) +{ + assert(start >= 0 && start <= text.getLength()); + return text.copy(start, std::min(text.getLength() - start, maximumLength)); +} + +rtl::OString addSuffix( + rtl::OString const & pathname, rtl::OString const & suffix) +{ + sal_Int32 n = pathname.lastIndexOf('.'); + if (n == -1) { + fprintf( + stderr, + ("Error: pathname \"%s\" does not contain dot to add suffix in" + " front of\n"), + pathname.getStr()); + exit(EXIT_FAILURE); + } + return pathname.replaceAt(n, 0, suffix); +} + +} + #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |