Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
b0c5af2c
Kaydet (Commit)
b0c5af2c
authored
Ock 23, 2011
tarafından
Joseph Powers
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Remove DECLARE_LIST( LngLineList, ByteString* )
üst
4099852d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
37 deletions
+40
-37
lngmerge.hxx
l10ntools/inc/lngmerge.hxx
+2
-1
lngmerge.cxx
l10ntools/source/lngmerge.cxx
+38
-36
No files found.
l10ntools/inc/lngmerge.hxx
Dosyayı görüntüle @
b0c5af2c
...
@@ -27,8 +27,9 @@
...
@@ -27,8 +27,9 @@
************************************************************************/
************************************************************************/
// local includes
// local includes
#include "export.hxx"
#include "export.hxx"
#include <vector>
DECLARE_LIST
(
LngLineList
,
ByteString
*
)
typedef
::
std
::
vector
<
ByteString
*
>
LngLineList
;
#define LNG_OK 0x0000
#define LNG_OK 0x0000
#define LNG_FILE_NOTFOUND 0x0001
#define LNG_FILE_NOTFOUND 0x0001
...
...
l10ntools/source/lngmerge.cxx
Dosyayı görüntüle @
b0c5af2c
...
@@ -48,7 +48,7 @@ LngParser::LngParser( const ByteString &rLngFile, BOOL bUTF8, BOOL bULFFormat )
...
@@ -48,7 +48,7 @@ LngParser::LngParser( const ByteString &rLngFile, BOOL bUTF8, BOOL bULFFormat )
bDBIsUTF8
(
bUTF8
),
bDBIsUTF8
(
bUTF8
),
bULF
(
bULFFormat
)
bULF
(
bULFFormat
)
{
{
pLines
=
new
LngLineList
(
100
,
100
);
pLines
=
new
LngLineList
();
DirEntry
aEntry
(
String
(
sSource
,
RTL_TEXTENCODING_ASCII_US
));
DirEntry
aEntry
(
String
(
sSource
,
RTL_TEXTENCODING_ASCII_US
));
if
(
aEntry
.
Exists
())
{
if
(
aEntry
.
Exists
())
{
SvFileStream
aStream
(
String
(
sSource
,
RTL_TEXTENCODING_ASCII_US
),
STREAM_STD_READ
);
SvFileStream
aStream
(
String
(
sSource
,
RTL_TEXTENCODING_ASCII_US
),
STREAM_STD_READ
);
...
@@ -63,7 +63,7 @@ LngParser::LngParser( const ByteString &rLngFile, BOOL bUTF8, BOOL bULFFormat )
...
@@ -63,7 +63,7 @@ LngParser::LngParser( const ByteString &rLngFile, BOOL bUTF8, BOOL bULFFormat )
bFirstLine
=
false
;
bFirstLine
=
false
;
}
}
pLines
->
Insert
(
new
ByteString
(
sLine
),
LIST_APPEND
);
pLines
->
push_back
(
new
ByteString
(
sLine
)
);
}
}
}
}
else
else
...
@@ -77,8 +77,9 @@ LngParser::LngParser( const ByteString &rLngFile, BOOL bUTF8, BOOL bULFFormat )
...
@@ -77,8 +77,9 @@ LngParser::LngParser( const ByteString &rLngFile, BOOL bUTF8, BOOL bULFFormat )
LngParser
::~
LngParser
()
LngParser
::~
LngParser
()
/*****************************************************************************/
/*****************************************************************************/
{
{
for
(
ULONG
i
=
0
;
i
<
pLines
->
Count
();
i
++
)
for
(
size_t
i
=
0
,
n
=
pLines
->
size
();
i
<
n
;
i
++
)
delete
pLines
->
GetObject
(
i
);
delete
(
*
pLines
)[
i
];
pLines
->
clear
();
delete
pLines
;
delete
pLines
;
}
}
...
@@ -125,26 +126,25 @@ BOOL LngParser::CreateSDF(
...
@@ -125,26 +126,25 @@ BOOL LngParser::CreateSDF(
sFullEntry
.
Copy
(
sPrjEntry
.
Len
()
+
1
),
gsl_getSystemTextEncoding
());
sFullEntry
.
Copy
(
sPrjEntry
.
Len
()
+
1
),
gsl_getSystemTextEncoding
());
sActFileName
.
SearchAndReplaceAll
(
"/"
,
"
\\
"
);
sActFileName
.
SearchAndReplaceAll
(
"/"
,
"
\\
"
);
ULONG
nPos
=
0
;
size_t
nPos
=
0
;
BOOL
bStart
=
true
;
BOOL
bStart
=
true
;
ByteString
sGroup
;
ByteString
sGroup
;
ByteStringHashMap
Text
;
ByteStringHashMap
Text
;
ByteString
sID
;
ByteString
sID
;
ByteString
sLine
;
ByteString
sLine
;
while
(
nPos
<
pLines
->
Count
()
)
{
while
(
nPos
<
pLines
->
size
()
)
{
sLine
=
*
pLines
->
GetObject
(
nPos
++
)
;
sLine
=
*
(
*
pLines
)[
nPos
++
]
;
while
(
nPos
<
pLines
->
Count
()
&&
!
isNextGroup
(
sGroup
,
sLine
)
)
{
while
(
nPos
<
pLines
->
size
()
&&
!
isNextGroup
(
sGroup
,
sLine
)
)
{
ReadLine
(
sLine
,
Text
);
ReadLine
(
sLine
,
Text
);
sID
=
sGroup
;
sID
=
sGroup
;
sLine
=
*
pLines
->
GetObject
(
nPos
++
)
;
sLine
=
*
(
*
pLines
)[
nPos
++
]
;
};
};
if
(
bStart
){
if
(
bStart
)
{
bStart
=
false
;
bStart
=
false
;
sID
=
sGroup
;
sID
=
sGroup
;
}
}
else
{
else
{
WriteSDF
(
aSDFStream
,
Text
,
rPrj
,
rRoot
,
sActFileName
,
sID
);
WriteSDF
(
aSDFStream
,
Text
,
rPrj
,
rRoot
,
sActFileName
,
sID
);
}
}
}
}
...
@@ -177,7 +177,6 @@ BOOL LngParser::CreateSDF(
...
@@ -177,7 +177,6 @@ BOOL LngParser::CreateSDF(
sOutput
+=
sCur
;
sOutput
+=
"
\t
"
;
sOutput
+=
sCur
;
sOutput
+=
"
\t
"
;
sOutput
+=
sAct
;
sOutput
+=
"
\t\t\t\t
"
;
sOutput
+=
sAct
;
sOutput
+=
"
\t\t\t\t
"
;
sOutput
+=
sTimeStamp
;
sOutput
+=
sTimeStamp
;
//if( !sCur.EqualsIgnoreCaseAscii("de") ||( sCur.EqualsIgnoreCaseAscii("de") && !Export::isMergingGermanAllowed( rPrj ) ) )
aSDFStream
.
WriteLine
(
sOutput
);
aSDFStream
.
WriteLine
(
sOutput
);
}
}
}
}
...
@@ -195,7 +194,6 @@ BOOL LngParser::CreateSDF(
...
@@ -195,7 +194,6 @@ BOOL LngParser::CreateSDF(
return
false
;
return
false
;
}
}
void
LngParser
::
ReadLine
(
const
ByteString
&
sLine_in
,
ByteStringHashMap
&
rText_inout
){
void
LngParser
::
ReadLine
(
const
ByteString
&
sLine_in
,
ByteStringHashMap
&
rText_inout
){
//printf("sLine -> '%s'\n",sLine_in.GetBuffer());
ByteString
sLang
=
sLine_in
.
GetToken
(
0
,
'='
);
ByteString
sLang
=
sLine_in
.
GetToken
(
0
,
'='
);
sLang
.
EraseLeadingChars
(
' '
);
sLang
.
EraseLeadingChars
(
' '
);
sLang
.
EraseTrailingChars
(
' '
);
sLang
.
EraseTrailingChars
(
' '
);
...
@@ -218,7 +216,6 @@ BOOL LngParser::Merge(
...
@@ -218,7 +216,6 @@ BOOL LngParser::Merge(
nError
=
LNG_COULD_NOT_OPEN
;
nError
=
LNG_COULD_NOT_OPEN
;
}
}
nError
=
LNG_OK
;
nError
=
LNG_OK
;
// MergeDataFile( const ByteString &rFileName, const ByteString& rFile , BOOL bErrLog, CharSet aCharSet, BOOL bUTF8 );
MergeDataFile
aMergeDataFile
(
rSDFFile
,
sSource
,
FALSE
,
RTL_TEXTENCODING_MS_1252
);
//, bDBIsUTF8 );
MergeDataFile
aMergeDataFile
(
rSDFFile
,
sSource
,
FALSE
,
RTL_TEXTENCODING_MS_1252
);
//, bDBIsUTF8 );
ByteString
sTmp
(
Export
::
sLanguages
);
ByteString
sTmp
(
Export
::
sLanguages
);
...
@@ -226,13 +223,13 @@ BOOL LngParser::Merge(
...
@@ -226,13 +223,13 @@ BOOL LngParser::Merge(
Export
::
SetLanguages
(
aMergeDataFile
.
GetLanguages
()
);
Export
::
SetLanguages
(
aMergeDataFile
.
GetLanguages
()
);
aLanguages
=
Export
::
GetLanguages
();
aLanguages
=
Export
::
GetLanguages
();
ULONG
nPos
=
0
;
size_t
nPos
=
0
;
BOOL
bGroup
=
FALSE
;
BOOL
bGroup
=
FALSE
;
ByteString
sGroup
;
ByteString
sGroup
;
// seek to next group
// seek to next group
while
(
nPos
<
pLines
->
Count
()
&&
!
bGroup
)
{
while
(
nPos
<
pLines
->
size
()
&&
!
bGroup
)
{
ByteString
sLine
(
*
pLines
->
GetObject
(
nPos
)
);
ByteString
sLine
(
*
(
*
pLines
)[
nPos
]
);
sLine
.
EraseLeadingChars
(
' '
);
sLine
.
EraseLeadingChars
(
' '
);
sLine
.
EraseTrailingChars
(
' '
);
sLine
.
EraseTrailingChars
(
' '
);
if
((
sLine
.
GetChar
(
0
)
==
'['
)
&&
if
((
sLine
.
GetChar
(
0
)
==
'['
)
&&
...
@@ -246,7 +243,7 @@ BOOL LngParser::Merge(
...
@@ -246,7 +243,7 @@ BOOL LngParser::Merge(
nPos
++
;
nPos
++
;
}
}
while
(
nPos
<
pLines
->
Count
())
{
while
(
nPos
<
pLines
->
size
())
{
ByteStringHashMap
Text
;
ByteStringHashMap
Text
;
ByteString
sID
(
sGroup
);
ByteString
sID
(
sGroup
);
ULONG
nLastLangPos
=
0
;
ULONG
nLastLangPos
=
0
;
...
@@ -259,8 +256,8 @@ BOOL LngParser::Merge(
...
@@ -259,8 +256,8 @@ BOOL LngParser::Merge(
ByteString
sLanguagesDone
;
ByteString
sLanguagesDone
;
while
(
nPos
<
pLines
->
Count
()
&&
!
bGroup
)
{
while
(
nPos
<
pLines
->
size
()
&&
!
bGroup
)
{
ByteString
sLine
(
*
pLines
->
GetObject
(
nPos
)
);
ByteString
sLine
(
*
(
*
pLines
)[
nPos
]
);
sLine
.
EraseLeadingChars
(
' '
);
sLine
.
EraseLeadingChars
(
' '
);
sLine
.
EraseTrailingChars
(
' '
);
sLine
.
EraseTrailingChars
(
' '
);
if
((
sLine
.
GetChar
(
0
)
==
'['
)
&&
if
((
sLine
.
GetChar
(
0
)
==
'['
)
&&
...
@@ -283,7 +280,9 @@ BOOL LngParser::Merge(
...
@@ -283,7 +280,9 @@ BOOL LngParser::Merge(
sSearch
+=
";"
;
sSearch
+=
";"
;
if
((
sLanguagesDone
.
Search
(
sSearch
)
!=
STRING_NOTFOUND
))
{
if
((
sLanguagesDone
.
Search
(
sSearch
)
!=
STRING_NOTFOUND
))
{
pLines
->
Remove
(
nPos
);
LngLineList
::
iterator
it
=
pLines
->
begin
();
::
std
::
advance
(
it
,
nPos
);
pLines
->
erase
(
it
);
}
}
if
(
bULF
&&
pEntrys
)
if
(
bULF
&&
pEntrys
)
{
{
...
@@ -294,14 +293,13 @@ BOOL LngParser::Merge(
...
@@ -294,14 +293,13 @@ BOOL LngParser::Merge(
pEntrys
->
GetText
(
sNewText
,
STRING_TYP_TEXT
,
sLang
,
TRUE
);
pEntrys
->
GetText
(
sNewText
,
STRING_TYP_TEXT
,
sLang
,
TRUE
);
if
(
sNewText
.
Len
())
{
if
(
sNewText
.
Len
())
{
ByteString
*
pLine
=
pLines
->
GetObject
(
nPos
);
ByteString
*
pLine
=
(
*
pLines
)[
nPos
];
ByteString
sText1
(
sLang
);
ByteString
sText1
(
sLang
);
sText1
+=
" =
\"
"
;
sText1
+=
" =
\"
"
;
sText1
+=
sNewText
;
sText1
+=
sNewText
;
sText1
+=
"
\"
"
;
sText1
+=
"
\"
"
;
*
pLine
=
sText1
;
*
pLine
=
sText1
;
//}
Text
[
sLang
]
=
sNewText
;
Text
[
sLang
]
=
sNewText
;
}
}
}
}
...
@@ -322,9 +320,7 @@ BOOL LngParser::Merge(
...
@@ -322,9 +320,7 @@ BOOL LngParser::Merge(
if
(
nLastLangPos
)
{
if
(
nLastLangPos
)
{
for
(
unsigned
int
n
=
0
;
n
<
aLanguages
.
size
();
n
++
){
for
(
unsigned
int
n
=
0
;
n
<
aLanguages
.
size
();
n
++
){
sCur
=
aLanguages
[
n
];
sCur
=
aLanguages
[
n
];
if
(
//( !sCur.EqualsIgnoreCaseAscii("de") ||
if
(
!
sCur
.
EqualsIgnoreCaseAscii
(
"en-US"
)
&&
!
Text
[
sCur
].
Len
()
&&
pEntrys
)
{
//( sCur.EqualsIgnoreCaseAscii("de") && Export::isMergingGermanAllowed( rPrj ) ) )
!
sCur
.
EqualsIgnoreCaseAscii
(
"en-US"
)
&&
!
Text
[
sCur
].
Len
()
&&
pEntrys
){
ByteString
sNewText
;
ByteString
sNewText
;
pEntrys
->
GetText
(
sNewText
,
STRING_TYP_TEXT
,
sCur
,
TRUE
);
pEntrys
->
GetText
(
sNewText
,
STRING_TYP_TEXT
,
sCur
,
TRUE
);
...
@@ -340,7 +336,13 @@ BOOL LngParser::Merge(
...
@@ -340,7 +336,13 @@ BOOL LngParser::Merge(
nLastLangPos
++
;
nLastLangPos
++
;
nPos
++
;
nPos
++
;
pLines
->
Insert
(
new
ByteString
(
sLine
),
nLastLangPos
);
if
(
nLastLangPos
<
pLines
->
size
()
)
{
LngLineList
::
iterator
it
=
pLines
->
begin
();
::
std
::
advance
(
it
,
nLastLangPos
);
pLines
->
insert
(
it
,
new
ByteString
(
sLine
)
);
}
else
{
pLines
->
push_back
(
new
ByteString
(
sLine
)
);
}
}
}
}
}
}
}
...
@@ -349,8 +351,8 @@ BOOL LngParser::Merge(
...
@@ -349,8 +351,8 @@ BOOL LngParser::Merge(
delete
pResData
;
delete
pResData
;
}
}
for
(
ULONG
i
=
0
;
i
<
pLines
->
Count
();
i
++
)
for
(
size_t
i
=
0
;
i
<
pLines
->
size
();
i
++
)
aDestination
.
WriteLine
(
*
pLines
->
GetObject
(
i
)
);
aDestination
.
WriteLine
(
*
(
*
pLines
)[
i
]
);
aDestination
.
Close
();
aDestination
.
Close
();
return
TRUE
;
return
TRUE
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment