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
5440aa1e
Kaydet (Commit)
5440aa1e
authored
Eyl 13, 2011
tarafından
Kohei Yoshida
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Let's not indent in namespace scopes.
üst
efebf518
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
36 deletions
+35
-36
filters-test.cxx
sc/qa/unit/filters-test.cxx
+35
-36
No files found.
sc/qa/unit/filters-test.cxx
Dosyayı görüntüle @
5440aa1e
...
...
@@ -78,49 +78,48 @@ const int indeterminate = 2;
namespace
{
struct
FileFormats
{
const
char
*
pName
;
const
char
*
pFilterName
;
const
char
*
pTypeName
;
sal_uLong
nFormatType
;
};
struct
FileFormats
{
const
char
*
pName
;
const
char
*
pFilterName
;
const
char
*
pTypeName
;
sal_uLong
nFormatType
;
};
FileFormats
aFileFormats
[]
=
{
{
"ods"
,
"calc8"
,
""
,
ODS_FORMAT_TYPE
},
{
"xls"
,
"MS Excel 97"
,
"calc_MS_EXCEL_97"
,
XLS_FORMAT_TYPE
},
{
"xlsx"
,
"Calc MS Excel 2007 XML"
,
"MS Excel 2007 XML"
,
XLSX_FORMAT_TYPE
}
};
FileFormats
aFileFormats
[]
=
{
{
"ods"
,
"calc8"
,
""
,
ODS_FORMAT_TYPE
},
{
"xls"
,
"MS Excel 97"
,
"calc_MS_EXCEL_97"
,
XLS_FORMAT_TYPE
},
{
"xlsx"
,
"Calc MS Excel 2007 XML"
,
"MS Excel 2007 XML"
,
XLSX_FORMAT_TYPE
}
};
void
loadFile
(
const
rtl
::
OUString
&
aFileName
,
std
::
string
&
aContent
)
{
rtl
::
OString
aOFileName
=
rtl
::
OUStringToOString
(
aFileName
,
RTL_TEXTENCODING_UTF8
);
std
::
ifstream
aFile
(
aOFileName
.
getStr
());
CPPUNIT_ASSERT_MESSAGE
(
"could not open csv file"
,
aFile
);
std
::
ostringstream
aOStream
;
aOStream
<<
aFile
.
rdbuf
();
aFile
.
close
();
aContent
=
aOStream
.
str
();
}
void
loadFile
(
const
rtl
::
OUString
&
aFileName
,
std
::
string
&
aContent
)
void
testFile
(
rtl
::
OUString
&
aFileName
,
ScDocument
*
pDoc
,
SCTAB
nTab
)
{
csv_handler
aHandler
(
pDoc
,
nTab
);
orcus
::
csv_parser_config
aConfig
;
aConfig
.
delimiters
.
push_back
(
','
);
aConfig
.
delimiters
.
push_back
(
';'
);
aConfig
.
text_qualifier
=
'"'
;
std
::
string
aContent
;
loadFile
(
aFileName
,
aContent
);
orcus
::
csv_parser
<
csv_handler
>
parser
(
&
aContent
[
0
],
aContent
.
size
()
,
aHandler
,
aConfig
);
try
{
rtl
::
OString
aOFileName
=
rtl
::
OUStringToOString
(
aFileName
,
RTL_TEXTENCODING_UTF8
);
std
::
ifstream
aFile
(
aOFileName
.
getStr
());
CPPUNIT_ASSERT_MESSAGE
(
"could not open csv file"
,
aFile
);
std
::
ostringstream
aOStream
;
aOStream
<<
aFile
.
rdbuf
();
aFile
.
close
();
aContent
=
aOStream
.
str
();
parser
.
parse
();
}
void
testFile
(
rtl
::
OUString
&
aFileName
,
ScDocument
*
pDoc
,
SCTAB
nTab
)
catch
(
const
orcus
::
csv_parse_error
&
e
)
{
csv_handler
aHandler
(
pDoc
,
nTab
);
orcus
::
csv_parser_config
aConfig
;
aConfig
.
delimiters
.
push_back
(
','
);
aConfig
.
delimiters
.
push_back
(
';'
);
aConfig
.
text_qualifier
=
'"'
;
std
::
string
aContent
;
loadFile
(
aFileName
,
aContent
);
orcus
::
csv_parser
<
csv_handler
>
parser
(
&
aContent
[
0
],
aContent
.
size
()
,
aHandler
,
aConfig
);
try
{
parser
.
parse
();
}
catch
(
const
orcus
::
csv_parse_error
&
e
)
{
std
::
cout
<<
"reading csv content file failed"
<<
e
.
what
()
<<
std
::
endl
;
CPPUNIT_ASSERT_MESSAGE
(
"csv parser error"
,
false
);
}
std
::
cout
<<
"reading csv content file failed"
<<
e
.
what
()
<<
std
::
endl
;
CPPUNIT_ASSERT_MESSAGE
(
"csv parser error"
,
false
);
}
}
}
...
...
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