#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <algorithm>
#include <sstream>
#include <qregexp.h>
#include <qxml.h>
#include <qfile.h>
#include <qfileinfo.h>
#include <xapian.h>
Go to the source code of this file.
|
static void | safeAddTerm (const std::string &term, Xapian::Document &doc, int wfd) |
|
static std::string | trim (const std::string &str, const std::string &whitespace=" \t") |
|
static std::string | reduce (const std::string &str, const std::string &fill=" ", const std::string &whitespace=" \t") |
|
static void | addWords (const std::string &s, Xapian::Document &doc, int wfd) |
|
static void | addIdentifiers (const std::string &s, Xapian::Document &doc, int wfd) |
|
static void | replace_all (std::string &str, const std::string &old, const std::string &repl) |
|
static std::string | unescapeXmlEntities (const std::string &s) |
|
static void | usage (const char *name) |
|
int | main (int argc, const char **argv) |
|
#define MAX_TERM_LENGTH 245 |
static void addIdentifiers |
( |
const std::string & |
s, |
|
|
Xapian::Document & |
doc, |
|
|
int |
wfd |
|
) |
| |
|
static |
Adds all identifiers in s to document doc with weight wfd
Definition at line 105 of file doxyindexer.cpp.
107 QRegExp re(
"[A-Z_a-z][A-Z_a-z0-9]*");
110 while ((i=re.match(qs,p,&l))!=-1)
The QRegExp class provides pattern matching using regular expressions or wildcards.
const char * data() const
QCString mid(uint index, uint len=0xffffffff) const
static void safeAddTerm(const std::string &term, Xapian::Document &doc, int wfd)
static void addWords |
( |
const std::string & |
s, |
|
|
Xapian::Document & |
doc, |
|
|
int |
wfd |
|
) |
| |
|
static |
Adds all words in s to document doc with weight wfd
Definition at line 87 of file doxyindexer.cpp.
89 std::istringstream iss(
s);
90 std::istream_iterator<std::string>
begin(iss),
end,it;
95 std::transform(lword.begin(), lword.end(), lword.begin(), ::tolower);
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
static void safeAddTerm(const std::string &term, Xapian::Document &doc, int wfd)
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
union ptb::content::word::word word
int main |
( |
int |
argc, |
|
|
const char ** |
argv |
|
) |
| |
main function to index data
Definition at line 313 of file doxyindexer.cpp.
320 for (
int i=1;i<argc;i++)
326 std::cerr <<
"Error: missing parameter for -o option" <<
std::endl;
334 if (!fi.exists() || !fi.isDir())
336 std::cerr <<
"Error: specified output directory does not exist!" <<
std::endl;
355 for (
int i=1;i<argc;i++)
364 std::cout <<
"Processing " << xmlFileName.
utf8() <<
"..." <<
std::endl;
365 QFile xmlFile(xmlFileName);
370 reader.
parse(source);
376 std::cerr <<
"Caught exception: " << e.get_description() <<
std::endl;
380 std::cerr <<
"Caught an unknown exception" <<
std::endl;
bool parse(const QXmlInputSource &input)
The QString class provides an abstraction of Unicode text and the classic C null-terminated char arra...
void setErrorHandler(QXmlErrorHandler *handler)
The QXmlSimpleReader class provides an implementation of a simple XML reader (i.e. parser).
void setContentHandler(QXmlContentHandler *handler)
nvidia::inferenceserver::client::Error Error
The QFile class is an I/O device that operates on files.
static void usage(const char *name)
static msg_handler handler
The QFileInfo class provides system-independent file information.
QTextStream & endl(QTextStream &s)
trims whitespace from start and end and replace occurrences of whitespace with fill.
Definition at line 63 of file doxyindexer.cpp.
71 size_t beginSpace = result.find_first_of(whitespace);
72 while (beginSpace != std::string::npos)
74 size_t endSpace = result.find_first_not_of(whitespace, beginSpace);
75 int range = endSpace - beginSpace;
77 result.replace(beginSpace, range,
fill);
79 size_t newStart = beginSpace +
fill.length();
80 beginSpace = result.find_first_of(whitespace, newStart);
static std::string trim(const std::string &str, const std::string &whitespace=" \t")
Replaces all occurrences of old with repl in string str
Definition at line 118 of file doxyindexer.cpp.
121 while ((pos =
str.
find(old, pos)) != std::string::npos)
int find(char c, int index=0, bool cs=TRUE) const
QCString & replace(uint index, uint len, const char *s)
static void safeAddTerm |
( |
const std::string & |
term, |
|
|
Xapian::Document & |
doc, |
|
|
int |
wfd |
|
) |
| |
|
static |
trims whitespace characters from the start and end of string str.
Definition at line 47 of file doxyindexer.cpp.
50 size_t strBegin =
str.find_first_not_of(whitespace);
51 if (strBegin == std::string::npos)
54 size_t strEnd =
str.find_last_not_of(whitespace);
55 int strRange = strEnd - strBegin + 1;
57 return str.substr(strBegin, strRange);
Replaces all XML entities in s with their unescaped representation
Definition at line 129 of file doxyindexer.cpp.
static void replace_all(std::string &str, const std::string &old, const std::string &repl)
static void usage |
( |
const char * |
name | ) |
|
|
static |
Definition at line 306 of file doxyindexer.cpp.
308 std::cerr <<
"Usage: " <<
name <<
" [-o output_dir] searchdata.xml [searchdata2.xml ...]" <<
std::endl;
QTextStream & endl(QTextStream &s)