mirror of https://github.com/kiwix/libkiwix.git
+ continue the implementation of ctpp2
This commit is contained in:
parent
045717117e
commit
519eebccd2
|
@ -74,6 +74,30 @@ namespace kiwix {
|
||||||
|
|
||||||
const string Searcher::searchInIndexAndReturnHtml(string &search, const unsigned int resultsCount,
|
const string Searcher::searchInIndexAndReturnHtml(string &search, const unsigned int resultsCount,
|
||||||
const string templatePath, const bool verbose) {
|
const string templatePath, const bool verbose) {
|
||||||
|
|
||||||
|
VMOpcodeCollector oVMOpcodeCollector;
|
||||||
|
StaticText oSyscalls;
|
||||||
|
StaticData oStaticData;
|
||||||
|
StaticText oStaticText;
|
||||||
|
HashTable oHashTable;
|
||||||
|
CTPP2Compiler oCompiler(oVMOpcodeCollector, oSyscalls, oStaticData, oStaticText, oHashTable);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// Load template
|
||||||
|
CTPP2FileSourceLoader oSourceLoader;
|
||||||
|
oSourceLoader.LoadTemplate(search.c_str());
|
||||||
|
|
||||||
|
// Create template parser
|
||||||
|
CTPP2Parser oCTPP2Parser(&oSourceLoader, &oCompiler, search.c_str());
|
||||||
|
|
||||||
|
// Compile template
|
||||||
|
oCTPP2Parser.Compile();
|
||||||
|
}
|
||||||
|
catch(...)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,15 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <unaccent.h>
|
#include <unaccent.h>
|
||||||
|
|
||||||
|
#include <CTPP2Parser.hpp>
|
||||||
|
#include <CTPP2FileSourceLoader.hpp>
|
||||||
|
#include <CTPP2ParserException.hpp>
|
||||||
|
#include <CTPP2HashTable.hpp>
|
||||||
|
#include <CTPP2VMDumper.hpp>
|
||||||
|
#include <CTPP2VMOpcodes.h>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
using namespace CTPP;
|
||||||
|
|
||||||
struct Result
|
struct Result
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue