2012-08-29 09:47:26 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-08-30 12:41:18 +02:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
2012-08-29 09:47:26 +02:00
|
|
|
*
|
2012-08-30 12:41:18 +02:00
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*/
|
2012-08-29 09:47:26 +02:00
|
|
|
|
|
|
|
#ifndef _PO_INCLUDED
|
|
|
|
#define _PO_INCLUDED
|
|
|
|
|
|
|
|
#include <fstream>
|
|
|
|
#include <rtl/string.hxx>
|
2012-09-28 17:52:13 +02:00
|
|
|
#include <boost/noncopyable.hpp>
|
|
|
|
|
|
|
|
class PoOfstream;
|
|
|
|
class PoIfstream;
|
2012-10-10 18:37:17 +02:00
|
|
|
class GenPoEntry;
|
2012-08-29 09:47:26 +02:00
|
|
|
|
2012-09-02 21:10:35 +02:00
|
|
|
class PoEntry
|
2012-08-29 09:51:44 +02:00
|
|
|
{
|
2012-09-23 11:10:45 +02:00
|
|
|
private:
|
2012-09-28 17:52:13 +02:00
|
|
|
|
2012-10-10 18:37:17 +02:00
|
|
|
GenPoEntry* m_pGenPo;
|
2012-09-28 17:52:13 +02:00
|
|
|
bool m_bIsInitialized;
|
2012-09-23 11:10:45 +02:00
|
|
|
|
2012-08-29 09:51:44 +02:00
|
|
|
public:
|
2012-09-28 17:52:13 +02:00
|
|
|
|
|
|
|
friend class PoOfstream;
|
|
|
|
friend class PoIfstream;
|
|
|
|
|
|
|
|
enum SDFPART { PROJECT, SOURCEFILE, DUMMY, RESOURCETYPE, GROUPID,
|
2012-08-29 09:47:26 +02:00
|
|
|
LOCALID, HELPID, PLATFORM, WIDTH, LANGUAGEID,
|
|
|
|
TEXT, HELPTEXT, QUICKHELPTEXT, TITLE, TIMESTAMP };
|
2012-08-29 09:51:44 +02:00
|
|
|
enum TYPE { TTEXT=TEXT, TQUICKHELPTEXT=QUICKHELPTEXT, TTITLE=TITLE };
|
2012-09-28 17:52:13 +02:00
|
|
|
enum Exception { INVALIDSDFLINE };
|
2012-08-29 09:51:44 +02:00
|
|
|
|
2012-09-02 21:10:35 +02:00
|
|
|
PoEntry();
|
2012-09-23 11:10:45 +02:00
|
|
|
PoEntry(const OString& rSDFLine,
|
2012-09-02 21:10:35 +02:00
|
|
|
const TYPE eType = TTEXT);
|
2012-09-23 11:10:45 +02:00
|
|
|
~PoEntry();
|
2012-10-10 18:37:17 +02:00
|
|
|
|
|
|
|
PoEntry( const PoEntry& rPo );
|
|
|
|
PoEntry& operator=( const PoEntry& rPo );
|
2012-09-23 11:10:45 +02:00
|
|
|
|
|
|
|
OString getSourceFile() const;
|
|
|
|
OString getGroupId() const;
|
|
|
|
OString getLocalId() const;
|
|
|
|
OString getResourceType() const;
|
|
|
|
TYPE getType() const;
|
2012-10-11 20:26:36 +02:00
|
|
|
OString getMsgId() const;
|
|
|
|
OString getMsgStr() const;
|
2012-10-11 20:50:19 +02:00
|
|
|
bool isFuzzy() const;
|
2012-09-23 11:10:45 +02:00
|
|
|
OString getKeyId() const;
|
2012-10-11 20:26:36 +02:00
|
|
|
void setMsgId(const OString& rUnTransStr);
|
|
|
|
void setMsgStr(const OString& rTransStr);
|
2012-09-02 21:10:35 +02:00
|
|
|
void setFuzzy(const bool bFuzzy);
|
|
|
|
|
2012-09-10 20:31:38 +02:00
|
|
|
static bool IsInSameComp(const PoEntry& rPo1,const PoEntry& rPo2);
|
|
|
|
|
2012-08-29 09:51:44 +02:00
|
|
|
};
|
2012-08-29 09:47:26 +02:00
|
|
|
|
2012-10-10 18:37:17 +02:00
|
|
|
class PoHeader: private boost::noncopyable
|
2012-08-29 09:47:26 +02:00
|
|
|
{
|
|
|
|
private:
|
2012-09-28 17:52:13 +02:00
|
|
|
|
2012-10-10 18:37:17 +02:00
|
|
|
GenPoEntry* m_pGenPo;
|
2012-09-28 17:52:13 +02:00
|
|
|
bool m_bIsInitialized;
|
2012-09-23 11:10:45 +02:00
|
|
|
|
2012-08-29 09:47:26 +02:00
|
|
|
public:
|
2012-09-28 17:52:13 +02:00
|
|
|
|
|
|
|
friend class PoOfstream;
|
|
|
|
friend class PoIfstream;
|
|
|
|
|
2012-10-01 20:26:05 +02:00
|
|
|
enum Exception { NOLANG };
|
|
|
|
|
2012-09-10 20:31:38 +02:00
|
|
|
PoHeader();
|
2012-08-29 09:47:26 +02:00
|
|
|
PoHeader( const OString& rExtSrc );
|
2012-09-28 17:52:13 +02:00
|
|
|
PoHeader( std::ifstream& rOldPo );
|
2012-08-29 09:47:26 +02:00
|
|
|
~PoHeader();
|
2012-09-10 20:31:38 +02:00
|
|
|
|
2012-09-23 11:10:45 +02:00
|
|
|
OString getLanguage() const;
|
2012-09-28 17:52:13 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
class PoOfstream: private boost::noncopyable
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
|
|
|
|
std::ofstream m_aOutPut;
|
|
|
|
bool m_bIsAfterHeader;
|
|
|
|
|
|
|
|
public:
|
|
|
|
PoOfstream();
|
|
|
|
~PoOfstream();
|
|
|
|
bool isOpen() const { return m_aOutPut.is_open(); }
|
|
|
|
|
|
|
|
void open(const OString& rFileName);
|
|
|
|
void close();
|
|
|
|
void writeHeader(const PoHeader& rHeader);
|
|
|
|
void writeEntry(const PoEntry& rPo);
|
|
|
|
};
|
|
|
|
|
|
|
|
class PoIfstream: private boost::noncopyable
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
|
|
|
|
std::ifstream m_aInPut;
|
|
|
|
bool m_bIsAfterHeader;
|
|
|
|
bool m_bEof;
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
enum Exception { INVALIDENTRY, INVALIDHEADER };
|
|
|
|
|
|
|
|
PoIfstream();
|
|
|
|
~PoIfstream();
|
|
|
|
bool isOpen() const { return m_aInPut.is_open(); }
|
|
|
|
bool eof() const { return m_bEof; }
|
|
|
|
|
|
|
|
void open(const OString& rFileName);
|
|
|
|
void close();
|
|
|
|
void readHeader(PoHeader& rHeader);
|
|
|
|
void readEntry(PoEntry& rPo);
|
2012-08-29 09:47:26 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // _PO_INCLUDED
|
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|