/* Copyright (C) 2014 J.F.Dockes
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef XMLTOSD_H_INCLUDED
#define XMLTOSD_H_INCLUDED
#include "autoconfig.h"
/** Parsing XML from saved queries or advanced search history.
*
* Here is how the schemas looks like:
*
* For advanced search
*
*
*
* AND|OR
*
* []
* AND|OR|FN|PH|NE
* [base64data]
* [base64data]
* slack
*
*
* [base64 path]
* [base64 path]
*
*
* 162014 <--! datemin -->
* 3062014 <--! datemax -->
* minsize
* maxsize
* space-sep mtypes
* space-sep mtypes
*
*
*
* For Simple search:
*
*
* base64-encoded query text
* OR|AND|FN|QL
* space-separated lang list
*
* space-separated suffix list
* base64-encoded config path>/EX>
*
*/
#include
#include "searchdata.h"
// Parsing XML from advanced search history or saved advanced search into
// a SearchData structure:
std::shared_ptr xmlToSearchData(const string& xml,
bool complain = true);
// Parsing XML from saved simple search to ssearch parameters
struct SSearchDef {
SSearchDef() : autophrase(false), mode(0) {}
std::vector stemlangs;
std::vector autosuffs;
std::vector extindexes;
std::string text;
bool autophrase;
int mode;
};
bool xmlToSSearch(const string& xml, SSearchDef&);
#endif /* XMLTOSD_H_INCLUDED */