KFileMetaData

poextractor.h
1 /*
2  Gettext translation file analyzer
3 
4  Copyright (C) 2007 Montel Laurent <[email protected]>
5  Copyright (C) 2009 Jos van den Oever <[email protected]>
6  Copyright (C) 2014 Nick Shaforostoff <[email protected]>
7 
8  This library is free software; you can redistribute it and/or
9  modify it under the terms of the GNU Lesser General Public
10  License as published by the Free Software Foundation; either
11  version 2.1 of the License, or (at your option) any later version.
12 
13  This library is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  Lesser General Public License for more details.
17 
18  You should have received a copy of the GNU Lesser General Public
19  License along with this library; if not, write to the Free Software
20  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 */
22 
23 
24 #ifndef POEXTRACTOR_H
25 #define POEXTRACTOR_H
26 
27 #include "extractorplugin.h"
28 
29 namespace KFileMetaData
30 {
31 
32 class POExtractor : public ExtractorPlugin
33 {
34  Q_OBJECT
35  Q_PLUGIN_METADATA(IID "org.kde.kf5.kfilemetadata.ExtractorPlugin"
36  FILE "poextractor.json")
38 
39 public:
40  explicit POExtractor(QObject* parent = nullptr);
41 
42  QStringList mimetypes() const override;
43  void extract(ExtractionResult* result) override;
44 
45 private:
46  void endMessage();
47  void handleComment(const char* data, quint32 length);
48  void handleLine(const char* data, quint32 length);
49 
50 
51  enum PoState {COMMENT, MSGCTXT, MSGID, MSGID_PLURAL, MSGSTR, MSGSTR_PLURAL,
52  WHITESPACE, ERROR};
53  PoState state;
54  int messages;
55  int untranslated;
56  int fuzzy;
57  bool isFuzzy=false, isTranslated=false;
58 };
59 
60 }
61 
62 #endif // PLAINTEXTEXTRACTOR_H
The ExtractorPlugin is the base class for all file metadata extractors.
Q_OBJECTQ_OBJECT
Q_INTERFACES(...)
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon May 25 2020 23:11:16 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.