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
db4bc712
Kaydet (Commit)
db4bc712
authored
Şub 14, 2012
tarafından
Gert van Valkenhoef
Kaydeden (comit)
Caolán McNamara
Şub 23, 2012
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Separate HelpIndexer into header, implementation, and main
üst
25caea6f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
146 additions
and
131 deletions
+146
-131
HelpIndexer.cxx
l10ntools/source/help/HelpIndexer.cxx
+4
-128
HelpIndexer.hxx
l10ntools/source/help/HelpIndexer.hxx
+71
-0
HelpIndexer_main.cxx
l10ntools/source/help/HelpIndexer_main.cxx
+66
-0
makefile.mk
l10ntools/source/help/makefile.mk
+5
-3
No files found.
l10ntools/source/help/
helpi
ndexer.cxx
→
l10ntools/source/help/
HelpI
ndexer.cxx
Dosyayı görüntüle @
db4bc712
#include <CLucene/StdHeader.h>
#include <CLucene.h>
#include "HelpIndexer.hxx"
#define TODO
#ifdef TODO
#include <CLucene/analysis/LanguageBasedAnalyzer.h>
#endif
...
...
@@ -10,74 +12,10 @@
#include <errno.h>
#include <string.h>
#include <string>
#include <iostream>
#include <algorithm>
#include <set>
// I assume that TCHAR is defined as wchar_t throughout
using
namespace
lucene
::
document
;
class
HelpIndexer
{
private
:
std
::
string
d_lang
;
std
::
string
d_module
;
std
::
string
d_captionDir
;
std
::
string
d_contentDir
;
std
::
string
d_indexDir
;
std
::
string
d_error
;
std
::
set
<
std
::
string
>
d_files
;
public
:
/**
* @param lang Help files language.
* @param module The module of the helpfiles.
* @param captionDir The directory to scan for caption files.
* @param contentDir The directory to scan for content files.
* @param indexDir The directory to write the index to.
*/
HelpIndexer
(
std
::
string
const
&
lang
,
std
::
string
const
&
module
,
std
::
string
const
&
captionDir
,
std
::
string
const
&
contentDir
,
std
::
string
const
&
indexDir
);
/**
* Run the indexer.
* @return true if index successfully generated.
*/
bool
indexDocuments
();
/**
* Get the error string (empty if no error occurred).
*/
std
::
string
const
&
getErrorMessage
();
private
:
/**
* Scan the caption & contents directories for help files.
*/
bool
scanForFiles
();
/**
* Scan for files in the given directory.
*/
bool
scanForFiles
(
std
::
string
const
&
path
);
/**
* Fill the Document with information on the given help file.
*/
bool
helpDocument
(
std
::
string
const
&
fileName
,
Document
*
doc
);
/**
* Create a reader for the given file, and create an "empty" reader in case the file doesn't exist.
*/
lucene
::
util
::
Reader
*
helpFileReader
(
std
::
string
const
&
path
);
std
::
wstring
string2wstring
(
std
::
string
const
&
source
);
};
HelpIndexer
::
HelpIndexer
(
std
::
string
const
&
lang
,
std
::
string
const
&
module
,
std
::
string
const
&
captionDir
,
std
::
string
const
&
contentDir
,
std
::
string
const
&
indexDir
)
:
d_lang
(
lang
),
d_module
(
module
),
d_captionDir
(
captionDir
),
d_contentDir
(
contentDir
),
d_indexDir
(
indexDir
),
d_error
(
""
),
d_files
()
{}
...
...
@@ -183,65 +121,3 @@ std::wstring HelpIndexer::string2wstring(std::string const &source) {
std
::
copy
(
source
.
begin
(),
source
.
end
(),
target
.
begin
());
return
target
;
}
int
main
(
int
argc
,
char
**
argv
)
{
const
std
::
string
pLang
(
"-lang"
);
const
std
::
string
pModule
(
"-mod"
);
const
std
::
string
pOutDir
(
"-zipdir"
);
const
std
::
string
pSrcDir
(
"-srcdir"
);
std
::
string
lang
;
std
::
string
module
;
std
::
string
srcDir
;
std
::
string
outDir
;
bool
error
=
false
;
for
(
int
i
=
1
;
i
<
argc
;
++
i
)
{
if
(
pLang
.
compare
(
argv
[
i
])
==
0
)
{
if
(
i
+
1
<
argc
)
{
lang
=
argv
[
++
i
];
}
else
{
error
=
true
;
}
}
else
if
(
pModule
.
compare
(
argv
[
i
])
==
0
)
{
if
(
i
+
1
<
argc
)
{
module
=
argv
[
++
i
];
}
else
{
error
=
true
;
}
}
else
if
(
pOutDir
.
compare
(
argv
[
i
])
==
0
)
{
if
(
i
+
1
<
argc
)
{
outDir
=
argv
[
++
i
];
}
else
{
error
=
true
;
}
}
else
if
(
pSrcDir
.
compare
(
argv
[
i
])
==
0
)
{
if
(
i
+
1
<
argc
)
{
srcDir
=
argv
[
++
i
];
}
else
{
error
=
true
;
}
}
else
{
error
=
true
;
}
}
if
(
error
)
{
std
::
cerr
<<
"Error parsing command-line arguments"
<<
std
::
endl
;
}
if
(
error
||
lang
.
empty
()
||
module
.
empty
()
||
srcDir
.
empty
()
||
outDir
.
empty
())
{
std
::
cerr
<<
"Usage: HelpIndexer -lang ISOLangCode -mod HelpModule -srcdir SourceDir -zipdir OutputDir"
<<
std
::
endl
;
return
1
;
}
std
::
string
captionDir
(
srcDir
+
"/caption"
);
std
::
string
contentDir
(
srcDir
+
"/content"
);
std
::
string
indexDir
(
outDir
+
"/"
+
module
+
".idxl"
);
HelpIndexer
indexer
(
lang
,
module
,
captionDir
,
contentDir
,
indexDir
);
if
(
!
indexer
.
indexDocuments
())
{
std
::
cerr
<<
indexer
.
getErrorMessage
()
<<
std
::
endl
;
return
2
;
}
return
0
;
}
l10ntools/source/help/HelpIndexer.hxx
0 → 100644
Dosyayı görüntüle @
db4bc712
#ifndef HELPINDEXER_HXX
#define HELPINDEXER_HXX
#include <CLucene/StdHeader.h>
#include <CLucene.h>
#include <string>
#include <set>
// I assume that TCHAR is defined as wchar_t throughout
class
HelpIndexer
{
private
:
std
::
string
d_lang
;
std
::
string
d_module
;
std
::
string
d_captionDir
;
std
::
string
d_contentDir
;
std
::
string
d_indexDir
;
std
::
string
d_error
;
std
::
set
<
std
::
string
>
d_files
;
public
:
/**
* @param lang Help files language.
* @param module The module of the helpfiles.
* @param captionDir The directory to scan for caption files.
* @param contentDir The directory to scan for content files.
* @param indexDir The directory to write the index to.
*/
HelpIndexer
(
std
::
string
const
&
lang
,
std
::
string
const
&
module
,
std
::
string
const
&
captionDir
,
std
::
string
const
&
contentDir
,
std
::
string
const
&
indexDir
);
/**
* Run the indexer.
* @return true if index successfully generated.
*/
bool
indexDocuments
();
/**
* Get the error string (empty if no error occurred).
*/
std
::
string
const
&
getErrorMessage
();
private
:
/**
* Scan the caption & contents directories for help files.
*/
bool
scanForFiles
();
/**
* Scan for files in the given directory.
*/
bool
scanForFiles
(
std
::
string
const
&
path
);
/**
* Fill the Document with information on the given help file.
*/
bool
helpDocument
(
std
::
string
const
&
fileName
,
lucene
::
document
::
Document
*
doc
);
/**
* Create a reader for the given file, and create an "empty" reader in case the file doesn't exist.
*/
lucene
::
util
::
Reader
*
helpFileReader
(
std
::
string
const
&
path
);
std
::
wstring
string2wstring
(
std
::
string
const
&
source
);
};
#endif
l10ntools/source/help/HelpIndexer_main.cxx
0 → 100644
Dosyayı görüntüle @
db4bc712
#include "HelpIndexer.hxx"
#include <string>
#include <iostream>
int
main
(
int
argc
,
char
**
argv
)
{
const
std
::
string
pLang
(
"-lang"
);
const
std
::
string
pModule
(
"-mod"
);
const
std
::
string
pOutDir
(
"-zipdir"
);
const
std
::
string
pSrcDir
(
"-srcdir"
);
std
::
string
lang
;
std
::
string
module
;
std
::
string
srcDir
;
std
::
string
outDir
;
bool
error
=
false
;
for
(
int
i
=
1
;
i
<
argc
;
++
i
)
{
if
(
pLang
.
compare
(
argv
[
i
])
==
0
)
{
if
(
i
+
1
<
argc
)
{
lang
=
argv
[
++
i
];
}
else
{
error
=
true
;
}
}
else
if
(
pModule
.
compare
(
argv
[
i
])
==
0
)
{
if
(
i
+
1
<
argc
)
{
module
=
argv
[
++
i
];
}
else
{
error
=
true
;
}
}
else
if
(
pOutDir
.
compare
(
argv
[
i
])
==
0
)
{
if
(
i
+
1
<
argc
)
{
outDir
=
argv
[
++
i
];
}
else
{
error
=
true
;
}
}
else
if
(
pSrcDir
.
compare
(
argv
[
i
])
==
0
)
{
if
(
i
+
1
<
argc
)
{
srcDir
=
argv
[
++
i
];
}
else
{
error
=
true
;
}
}
else
{
error
=
true
;
}
}
if
(
error
)
{
std
::
cerr
<<
"Error parsing command-line arguments"
<<
std
::
endl
;
}
if
(
error
||
lang
.
empty
()
||
module
.
empty
()
||
srcDir
.
empty
()
||
outDir
.
empty
())
{
std
::
cerr
<<
"Usage: HelpIndexer -lang ISOLangCode -mod HelpModule -srcdir SourceDir -zipdir OutputDir"
<<
std
::
endl
;
return
1
;
}
std
::
string
captionDir
(
srcDir
+
"/caption"
);
std
::
string
contentDir
(
srcDir
+
"/content"
);
std
::
string
indexDir
(
outDir
+
"/"
+
module
+
".idxl"
);
HelpIndexer
indexer
(
lang
,
module
,
captionDir
,
contentDir
,
indexDir
);
if
(
!
indexer
.
indexDocuments
())
{
std
::
cerr
<<
indexer
.
getErrorMessage
()
<<
std
::
endl
;
return
2
;
}
return
0
;
}
l10ntools/source/help/makefile.mk
Dosyayı görüntüle @
db4bc712
...
...
@@ -60,7 +60,8 @@ SLOFILES=\
EXCEPTIONSFILES
=
\
$(OBJ)$/
HelpLinker.obj
\
$(OBJ)$/
HelpCompiler.obj
\
$(OBJ)$/
helpindexer.obj
\
$(OBJ)$/
HelpIndexer.obj
\
$(OBJ)$/
HelpIndexer_main.obj
\
$(SLO)$/
HelpLinker.obj
\
$(SLO)$/
HelpCompiler.obj
...
...
@@ -74,7 +75,7 @@ NOOPTFILES=\
$(SLO)$/
HelpLinker.obj
.ENDIF
PKGCONFIG_MODULES
=
libclucene-core
PKGCONFIG_MODULES
=
libclucene-core
libclucene-contribs-lib
.INCLUDE
:
pkg_config.mk
APP1TARGET
=
$(TARGET)
...
...
@@ -86,7 +87,8 @@ APP1STDLIBS+=$(SALLIB) $(BERKELEYLIB) $(XSLTLIB) $(EXPATASCII3RDLIB)
APP2TARGET
=
HelpIndexer
APP2OBJS
=
\
$(OBJ)$/
helpindexer.obj
$(OBJ)$/
HelpIndexer.obj
\
$(OBJ)$/
HelpIndexer_main.obj
APP2RPATH
=
NONE
APP2STDLIBS
+=
$(SALLIB)
$(PKGCONFIG_LIBS)
...
...
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