Kaydet (Commit) 1bf49e98 authored tarafından Andras Timar's avatar Andras Timar

pocheck: PO entries can have multiple source code reference lines since LO 6.0

Change-Id: Icbe0dd5e63eb5b10d162f34347ab86dde547dc62
Reviewed-on: https://gerrit.libreoffice.org/61164
Tested-by: Jenkins
Reviewed-by: 's avatarAndras Timar <andras.timar@collabora.com>
üst 8d4e12a4
...@@ -30,7 +30,7 @@ class GenPoEntry ...@@ -30,7 +30,7 @@ class GenPoEntry
{ {
private: private:
OStringBuffer m_sExtractCom; OStringBuffer m_sExtractCom;
OString m_sReference; std::vector<OString> m_sReferences;
OString m_sMsgCtxt; OString m_sMsgCtxt;
OString m_sMsgId; OString m_sMsgId;
OString m_sMsgStr; OString m_sMsgStr;
...@@ -41,7 +41,7 @@ private: ...@@ -41,7 +41,7 @@ private:
public: public:
GenPoEntry(); GenPoEntry();
const OString& getReference() const { return m_sReference; } const std::vector<OString>& getReference() const { return m_sReferences; }
const OString& getMsgCtxt() const { return m_sMsgCtxt; } const OString& getMsgCtxt() const { return m_sMsgCtxt; }
const OString& getMsgId() const { return m_sMsgId; } const OString& getMsgId() const { return m_sMsgId; }
const OString& getMsgStr() const { return m_sMsgStr; } const OString& getMsgStr() const { return m_sMsgStr; }
...@@ -54,7 +54,7 @@ public: ...@@ -54,7 +54,7 @@ public:
} }
void setReference(const OString& rReference) void setReference(const OString& rReference)
{ {
m_sReference = rReference; m_sReferences.push_back(rReference);
} }
void setMsgCtxt(const OString& rMsgCtxt) void setMsgCtxt(const OString& rMsgCtxt)
{ {
...@@ -115,7 +115,7 @@ namespace ...@@ -115,7 +115,7 @@ namespace
GenPoEntry::GenPoEntry() GenPoEntry::GenPoEntry()
: m_sExtractCom( OString() ) : m_sExtractCom( OString() )
, m_sReference( OString() ) , m_sReferences( std::vector<OString>() )
, m_sMsgCtxt( OString() ) , m_sMsgCtxt( OString() )
, m_sMsgId( OString() ) , m_sMsgId( OString() )
, m_sMsgStr( OString() ) , m_sMsgStr( OString() )
...@@ -133,8 +133,11 @@ void GenPoEntry::writeToFile(std::ofstream& rOFStream) const ...@@ -133,8 +133,11 @@ void GenPoEntry::writeToFile(std::ofstream& rOFStream) const
rOFStream rOFStream
<< "#. " << "#. "
<< m_sExtractCom.toString().replaceAll("\n","\n#. ") << std::endl; << m_sExtractCom.toString().replaceAll("\n","\n#. ") << std::endl;
if ( !m_sReference.isEmpty() ) if ( !m_sReferences.empty() )
rOFStream << "#: " << m_sReference << std::endl; {
for(std::vector<OString>::const_iterator it = m_sReferences.begin(); it != m_sReferences.end(); ++it)
rOFStream << "#: " << *it << std::endl;
}
if ( m_bFuzzy ) if ( m_bFuzzy )
rOFStream << "#, fuzzy" << std::endl; rOFStream << "#, fuzzy" << std::endl;
if ( m_bCFormat ) if ( m_bCFormat )
...@@ -173,7 +176,7 @@ void GenPoEntry::readFromFile(std::ifstream& rIFStream) ...@@ -173,7 +176,7 @@ void GenPoEntry::readFromFile(std::ifstream& rIFStream)
} }
else if (sLine.startsWith("#: ")) else if (sLine.startsWith("#: "))
{ {
m_sReference = sLine.copy(3); m_sReferences.push_back(sLine.copy(3));
} }
else if (sLine.startsWith("#, fuzzy")) else if (sLine.startsWith("#, fuzzy"))
{ {
...@@ -252,7 +255,7 @@ PoEntry::PoEntry( ...@@ -252,7 +255,7 @@ PoEntry::PoEntry(
m_pGenPo->setMsgId(rText); m_pGenPo->setMsgId(rText);
m_pGenPo->setExtractCom( m_pGenPo->setExtractCom(
( !rHelpText.isEmpty() ? rHelpText + "\n" : OString()) + ( !rHelpText.isEmpty() ? rHelpText + "\n" : OString()) +
genKeyId( m_pGenPo->getReference() + rGroupId + rLocalId + rResType + rText ) ); genKeyId( m_pGenPo->getReference().front() + rGroupId + rLocalId + rResType + rText ) );
m_bIsInitialized = true; m_bIsInitialized = true;
} }
...@@ -301,7 +304,7 @@ PoEntry& PoEntry::operator=(PoEntry&& rPo) ...@@ -301,7 +304,7 @@ PoEntry& PoEntry::operator=(PoEntry&& rPo)
OString const & PoEntry::getSourceFile() const OString const & PoEntry::getSourceFile() const
{ {
assert( m_bIsInitialized ); assert( m_bIsInitialized );
return m_pGenPo->getReference(); return m_pGenPo->getReference().front();
} }
OString PoEntry::getGroupId() const OString PoEntry::getGroupId() const
...@@ -492,7 +495,7 @@ namespace ...@@ -492,7 +495,7 @@ namespace
// Check the validity of read entry // Check the validity of read entry
bool lcl_CheckInputEntry(const GenPoEntry& rEntry) bool lcl_CheckInputEntry(const GenPoEntry& rEntry)
{ {
return !rEntry.getReference().isEmpty() && return !rEntry.getReference().empty() &&
!rEntry.getMsgCtxt().isEmpty() && !rEntry.getMsgCtxt().isEmpty() &&
!rEntry.getMsgId().isEmpty(); !rEntry.getMsgId().isEmpty();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment