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
0c571e23
Kaydet (Commit)
0c571e23
authored
Agu 17, 2011
tarafından
Caolán McNamara
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
add and use a matchL
üst
bb70a125
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
50 additions
and
23 deletions
+50
-23
string.hxx
comphelper/inc/comphelper/string.hxx
+23
-0
jobdata.cxx
vcl/unx/generic/printer/jobdata.cxx
+27
-23
printerinfomanager.cxx
vcl/unx/generic/printer/printerinfomanager.cxx
+0
-0
No files found.
comphelper/inc/comphelper/string.hxx
Dosyayı görüntüle @
0c571e23
...
@@ -162,6 +162,29 @@ COMPHELPER_DLLPUBLIC inline rtl::OUString getToken(const rtl::OUString &rIn,
...
@@ -162,6 +162,29 @@ COMPHELPER_DLLPUBLIC inline rtl::OUString getToken(const rtl::OUString &rIn,
return
rIn
.
getToken
(
nToken
,
cTok
,
nIndex
);
return
rIn
.
getToken
(
nToken
,
cTok
,
nIndex
);
}
}
/**
Match against a substring appearing in another string.
The result is true if and only if the second string appears as a substring
of the first string, at the given position.
This function can't be used for language specific comparison.
@param rStr The string that pMatch will be compared to.
@param pMatch The substring rStr is to be compared against
@param nMatchLen The length of pMatch
@param fromIndex The index to start the comparion from.
The index must be greater or equal than 0
and less or equal as the string length.
@return sal_True if pMatch match with the characters in the string
at the given position;
sal_False, otherwise.
*/
COMPHELPER_DLLPUBLIC
inline
sal_Bool
matchL
(
const
rtl
::
OString
&
rStr
,
const
char
*
pMatch
,
sal_Int32
nMatchLen
,
sal_Int32
fromIndex
=
0
)
SAL_THROW
(())
{
return
rtl_str_shortenedCompare_WithLength
(
rStr
.
pData
->
buffer
+
fromIndex
,
rStr
.
pData
->
length
-
fromIndex
,
pMatch
,
nMatchLen
,
nMatchLen
)
==
0
;
}
/** Convert a sequence of strings to a single comma separated string.
/** Convert a sequence of strings to a single comma separated string.
Note that no escaping of commas or anything fancy is done.
Note that no escaping of commas or anything fancy is done.
...
...
vcl/unx/generic/printer/jobdata.cxx
Dosyayı görüntüle @
0c571e23
...
@@ -36,6 +36,7 @@
...
@@ -36,6 +36,7 @@
#include <sal/alloca.h>
#include <sal/alloca.h>
#include <rtl/strbuf.hxx>
#include <rtl/strbuf.hxx>
#include <comphelper/string.hxx>
using
namespace
psp
;
using
namespace
psp
;
...
@@ -187,7 +188,7 @@ bool JobData::getStreamBuffer( void*& pData, int& bytes )
...
@@ -187,7 +188,7 @@ bool JobData::getStreamBuffer( void*& pData, int& bytes )
bool
JobData
::
constructFromStreamBuffer
(
void
*
pData
,
int
bytes
,
JobData
&
rJobData
)
bool
JobData
::
constructFromStreamBuffer
(
void
*
pData
,
int
bytes
,
JobData
&
rJobData
)
{
{
SvMemoryStream
aStream
(
pData
,
bytes
,
STREAM_READ
);
SvMemoryStream
aStream
(
pData
,
bytes
,
STREAM_READ
);
Byte
String
aLine
;
rtl
::
O
String
aLine
;
bool
bVersion
=
false
;
bool
bVersion
=
false
;
bool
bPrinter
=
false
;
bool
bPrinter
=
false
;
bool
bOrientation
=
false
;
bool
bOrientation
=
false
;
...
@@ -208,56 +209,59 @@ bool JobData::constructFromStreamBuffer( void* pData, int bytes, JobData& rJobDa
...
@@ -208,56 +209,59 @@ bool JobData::constructFromStreamBuffer( void* pData, int bytes, JobData& rJobDa
const
char
pslevelEquals
[]
=
"pslevel="
;
const
char
pslevelEquals
[]
=
"pslevel="
;
const
char
pdfdeviceEquals
[]
=
"pdfdevice="
;
const
char
pdfdeviceEquals
[]
=
"pdfdevice="
;
using
comphelper
::
string
::
matchL
;
while
(
!
aStream
.
IsEof
()
)
while
(
!
aStream
.
IsEof
()
)
{
{
aStream
.
ReadLine
(
aLine
);
aStream
.
ReadLine
(
aLine
);
if
(
aLine
.
CompareTo
(
RTL_CONSTASCII_STRINGPARAM
(
"JobData"
))
==
COMPARE_EQUAL
)
if
(
matchL
(
aLine
,
RTL_CONSTASCII_STRINGPARAM
(
"JobData"
))
)
bVersion
=
true
;
bVersion
=
true
;
else
if
(
aLine
.
CompareTo
(
RTL_CONSTASCII_STRINGPARAM
(
printerEquals
))
==
COMPARE_EQUAL
)
else
if
(
matchL
(
aLine
,
RTL_CONSTASCII_STRINGPARAM
(
printerEquals
))
)
{
{
bPrinter
=
true
;
bPrinter
=
true
;
rJobData
.
m_aPrinterName
=
String
(
aLine
.
Copy
(
RTL_CONSTASCII_LENGTH
(
printerEquals
)),
RTL_TEXTENCODING_UTF8
);
rJobData
.
m_aPrinterName
=
rtl
::
OStringToOUString
(
aLine
.
copy
(
RTL_CONSTASCII_LENGTH
(
printerEquals
)),
RTL_TEXTENCODING_UTF8
);
}
}
else
if
(
aLine
.
CompareTo
(
RTL_CONSTASCII_STRINGPARAM
(
orientatationEquals
))
==
COMPARE_EQUAL
)
else
if
(
matchL
(
aLine
,
RTL_CONSTASCII_STRINGPARAM
(
orientatationEquals
))
)
{
{
bOrientation
=
true
;
bOrientation
=
true
;
rJobData
.
m_eOrientation
=
aLine
.
Copy
(
RTL_CONSTASCII_LENGTH
(
orientatationEquals
)).
EqualsIgnoreCaseAscii
(
"landscape"
)
?
orientation
::
Landscape
:
orientation
::
Portrait
;
rJobData
.
m_eOrientation
=
aLine
.
copy
(
RTL_CONSTASCII_LENGTH
(
orientatationEquals
)).
equalsIgnoreAsciiCase
(
"landscape"
)
?
orientation
::
Landscape
:
orientation
::
Portrait
;
}
}
else
if
(
aLine
.
CompareTo
(
RTL_CONSTASCII_STRINGPARAM
(
copiesEquals
))
==
COMPARE_EQUAL
)
else
if
(
matchL
(
aLine
,
RTL_CONSTASCII_STRINGPARAM
(
copiesEquals
))
)
{
{
bCopies
=
true
;
bCopies
=
true
;
rJobData
.
m_nCopies
=
aLine
.
Copy
(
RTL_CONSTASCII_LENGTH
(
copiesEquals
)).
T
oInt32
();
rJobData
.
m_nCopies
=
aLine
.
copy
(
RTL_CONSTASCII_LENGTH
(
copiesEquals
)).
t
oInt32
();
}
}
else
if
(
aLine
.
CompareTo
(
RTL_CONSTASCII_STRINGPARAM
(
margindajustmentEquals
))
==
COMPARE_EQUAL
)
else
if
(
matchL
(
aLine
,
RTL_CONSTASCII_STRINGPARAM
(
margindajustmentEquals
))
)
{
{
bMargin
=
true
;
bMargin
=
true
;
ByteString
aValues
(
aLine
.
Copy
(
RTL_CONSTASCII_LENGTH
(
margindajustmentEquals
))
);
rtl
::
OString
aValues
(
aLine
.
copy
(
RTL_CONSTASCII_LENGTH
(
margindajustmentEquals
)));
rJobData
.
m_nLeftMarginAdjust
=
aValues
.
GetToken
(
0
,
','
).
ToInt32
();
using
comphelper
::
string
::
getToken
;
rJobData
.
m_nRightMarginAdjust
=
aValues
.
GetToken
(
1
,
','
).
ToInt32
();
rJobData
.
m_nLeftMarginAdjust
=
getToken
(
aValues
,
0
,
','
).
toInt32
();
rJobData
.
m_nTopMarginAdjust
=
aValues
.
GetToken
(
2
,
','
).
ToInt32
();
rJobData
.
m_nRightMarginAdjust
=
getToken
(
aValues
,
1
,
','
).
toInt32
();
rJobData
.
m_nBottomMarginAdjust
=
aValues
.
GetToken
(
3
,
','
).
ToInt32
();
rJobData
.
m_nTopMarginAdjust
=
getToken
(
aValues
,
2
,
','
).
toInt32
();
rJobData
.
m_nBottomMarginAdjust
=
getToken
(
aValues
,
3
,
','
).
toInt32
();
}
}
else
if
(
aLine
.
CompareTo
(
RTL_CONSTASCII_STRINGPARAM
(
colordepthEquals
))
==
COMPARE_EQUAL
)
else
if
(
matchL
(
aLine
,
RTL_CONSTASCII_STRINGPARAM
(
colordepthEquals
))
)
{
{
bColorDepth
=
true
;
bColorDepth
=
true
;
rJobData
.
m_nColorDepth
=
aLine
.
Copy
(
RTL_CONSTASCII_LENGTH
(
colordepthEquals
)).
T
oInt32
();
rJobData
.
m_nColorDepth
=
aLine
.
copy
(
RTL_CONSTASCII_LENGTH
(
colordepthEquals
)).
t
oInt32
();
}
}
else
if
(
aLine
.
CompareTo
(
RTL_CONSTASCII_STRINGPARAM
(
colordeviceEquals
))
==
COMPARE_EQUAL
)
else
if
(
matchL
(
aLine
,
RTL_CONSTASCII_STRINGPARAM
(
colordeviceEquals
))
)
{
{
bColorDevice
=
true
;
bColorDevice
=
true
;
rJobData
.
m_nColorDevice
=
aLine
.
Copy
(
RTL_CONSTASCII_LENGTH
(
colordeviceEquals
)).
T
oInt32
();
rJobData
.
m_nColorDevice
=
aLine
.
copy
(
RTL_CONSTASCII_LENGTH
(
colordeviceEquals
)).
t
oInt32
();
}
}
else
if
(
aLine
.
CompareTo
(
RTL_CONSTASCII_STRINGPARAM
(
pslevelEquals
))
==
COMPARE_EQUAL
)
else
if
(
matchL
(
aLine
,
RTL_CONSTASCII_STRINGPARAM
(
pslevelEquals
))
)
{
{
bPSLevel
=
true
;
bPSLevel
=
true
;
rJobData
.
m_nPSLevel
=
aLine
.
Copy
(
RTL_CONSTASCII_LENGTH
(
pslevelEquals
)).
T
oInt32
();
rJobData
.
m_nPSLevel
=
aLine
.
copy
(
RTL_CONSTASCII_LENGTH
(
pslevelEquals
)).
t
oInt32
();
}
}
else
if
(
aLine
.
CompareTo
(
RTL_CONSTASCII_STRINGPARAM
(
pdfdeviceEquals
))
==
COMPARE_EQUAL
)
else
if
(
matchL
(
aLine
,
RTL_CONSTASCII_STRINGPARAM
(
pdfdeviceEquals
))
)
{
{
bPDFDevice
=
true
;
bPDFDevice
=
true
;
rJobData
.
m_nPDFDevice
=
aLine
.
Copy
(
RTL_CONSTASCII_LENGTH
(
pdfdeviceEquals
)).
T
oInt32
();
rJobData
.
m_nPDFDevice
=
aLine
.
copy
(
RTL_CONSTASCII_LENGTH
(
pdfdeviceEquals
)).
t
oInt32
();
}
}
else
if
(
aLine
.
Equals
(
"PPDContexData"
)
)
else
if
(
aLine
.
equalsL
(
RTL_CONSTASCII_STRINGPARAM
(
"PPDContexData"
))
)
{
{
if
(
bPrinter
)
if
(
bPrinter
)
{
{
...
...
vcl/unx/generic/printer/printerinfomanager.cxx
Dosyayı görüntüle @
0c571e23
This diff is collapsed.
Click to expand it.
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