Add ARM Thumb mutex implementation from a "arm-thumb-mutex.patch"
[LibreOffice.git] / l10ntools / inc / gsicheck.hxx
blob971f85016fbd53635c78d271c0a246b6dc39c8be
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #ifndef _GSICHECK_HXX_
30 #define _GSICHECK_HXX_
32 #include "tagtest.hxx"
33 #include <vector>
36 // class GSILine
38 enum LineFormat { FORMAT_GSI, FORMAT_SDF, FORMAT_UNKNOWN };
40 class GSILine : public ByteString
42 private:
44 ParserMessageList aMessages;
45 LineFormat aFormat;
46 sal_uLong nLineNumber;
48 ByteString aUniqId;
49 ByteString aLineType;
50 ByteString aLangId;
51 ByteString aText;
52 ByteString aQuickHelpText;
53 ByteString aTitle;
55 sal_Bool bOK;
56 sal_Bool bFixed;
58 void ReassembleLine();
60 public:
61 GSILine( const ByteString &rLine, sal_uLong nLine );
62 LineFormat GetLineFormat() const { return aFormat; }
63 sal_uLong GetLineNumber() const { return nLineNumber; }
65 ByteString const GetUniqId() const { return aUniqId; }
66 ByteString const GetLineType() const { return aLineType; }
67 ByteString const GetLanguageId() const { return aLangId; }
68 ByteString const GetText() const { return aText; }
69 String const GetUText() const { return String( aText, RTL_TEXTENCODING_UTF8 ); }
70 ByteString const GetQuickHelpText() const { return aQuickHelpText; }
71 ByteString const GetTitle() const { return aTitle; }
73 void SetUText( String &aNew ) { aText = ByteString( aNew, RTL_TEXTENCODING_UTF8 ); ReassembleLine(); }
74 void SetText( ByteString &aNew ) { aText = aNew; ReassembleLine(); }
75 void SetQuickHelpText( ByteString &aNew ) { aQuickHelpText = aNew; ReassembleLine(); }
76 void SetTitle( ByteString &aNew ) { aTitle = aNew; ReassembleLine(); }
78 ParserMessageList* GetMessageList() { return &aMessages; };
79 sal_Bool HasMessages(){ return ( aMessages.size() > 0 ); };
81 sal_Bool IsOK() const { return bOK; }
82 void NotOK();
84 sal_Bool IsFixed() const { return bFixed; }
85 void SetFixed() { bFixed = sal_True; };
89 // class GSIBlock
92 typedef ::std::vector< GSILine* > GSIBlock_Impl;
94 class LazySvFileStream;
96 class GSIBlock
98 private:
99 GSIBlock_Impl maList;
100 GSILine *pSourceLine;
101 GSILine *pReferenceLine;
102 void PrintList( ParserMessageList *pList, ByteString aPrefix, GSILine *pLine );
103 sal_Bool bPrintContext;
104 sal_Bool bCheckSourceLang;
105 sal_Bool bCheckTranslationLang;
106 sal_Bool bReference;
107 sal_Bool bAllowKeyIDs;
108 sal_Bool bAllowSuspicious;
110 sal_Bool bHasBlockError;
112 sal_Bool IsUTF8( const ByteString &aTestee, sal_Bool bFixTags, sal_uInt16 &nErrorPos, ByteString &aErrorMsg, sal_Bool &bHasBeenFixed, ByteString &aFixed ) const;
113 sal_Bool TestUTF8( GSILine* pTestee, sal_Bool bFixTags );
114 sal_Bool HasSuspiciousChars( GSILine* pTestee, GSILine* pSource );
116 public:
117 GSIBlock( sal_Bool PbPrintContext, sal_Bool bSource, sal_Bool bTrans, sal_Bool bRef, sal_Bool bAllowKID, sal_Bool bAllowSusp );
118 ~GSIBlock();
119 void PrintMessage( ByteString aType, ByteString aMsg, ByteString aPrefix, ByteString aContext, sal_uLong nLine, ByteString aUniqueId = ByteString() );
120 void PrintError( ByteString aMsg, ByteString aPrefix, ByteString aContext, sal_uLong nLine, ByteString aUniqueId = ByteString() );
121 void InsertLine( GSILine* pLine, const ByteString aSourceLang);
122 void SetReferenceLine( GSILine* pLine );
123 sal_Bool CheckSyntax( sal_uLong nLine, sal_Bool bRequireSourceLine, sal_Bool bFixTags );
125 void WriteError( LazySvFileStream &aErrOut, sal_Bool bRequireSourceLine );
126 void WriteCorrect( LazySvFileStream &aOkOut, sal_Bool bRequireSourceLine );
127 void WriteFixed( LazySvFileStream &aFixOut, sal_Bool bRequireSourceLine );
130 #endif
132 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */