HCE project C++ developers source code library  1.1.1
HCE project developer library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
SphinxInputJsonMessageSearch.hpp
Go to the documentation of this file.
1 
14 #ifndef SPHINX_INPUT_JSON_MESSAGE_SEARCH_HPP
15 #define SPHINX_INPUT_JSON_MESSAGE_SEARCH_HPP
16 
17 #include "SphinxFilters.hpp"
18 #include "JsonSerializable.hpp"
19 
20 namespace HCE
21 {
22 namespace sphinx
23 {
24 //-----------------------------------------------------------------------------
26 {
27  std::string convertVarToString(Poco::Dynamic::Var& var) throw (std::exception); // convert if input type Numeric or String
28 public:
29  explicit SphinxInputJsonMessageSearch(const std::string& json="");
31 
32  bool serialize(std::string& json);
33  bool unserialize(const std::string& json);
34 
35  void setQueryString(const std::string& queryString_) {queryString=queryString_;}
36  std::string getQueryString(void) const {return queryString;}
37 
38  void addQueryParameters(const std::string& paramName, const std::string& paramValue);
39  std::vector<std::pair<std::string, std::string> >& getQueryParameters(void) {return queryParams;}
40 
41  void addOrderParameters(const std::string& paramName, const std::string& paramValue);
42  std::vector<std::pair<std::string, std::string> >& getOrderParameters(void) {return orderParams;}
43 
44  void addFilter(Poco::SharedPtr<SphinxFilter> pFilter);
46  std::vector<std::string> attributeValues, SphinxFilter::ExcludeType exclude);
47 
48  void setFilters(const SphinxFiltersArray& filtersArray_) {filtersArray=filtersArray_;}
49  SphinxFiltersArray& getFilters(void) {return filtersArray;}
50 
51  void addExternalFields(const std::string& fieldName);
52  std::vector<std::string>& getExternalFields(void) {return externalFields;}
53 
54  void addOrderFields(const std::string& fieldName);
55  std::vector<std::string>& getOrderFields(void) {return orderFields;}
56 private:
57  std::string queryString;
58  std::vector<std::pair<std::string, std::string> > queryParams;
59  std::vector<std::pair<std::string, std::string> > orderParams;
60  SphinxFiltersArray filtersArray;
61 
62  std::vector<std::string> externalFields;
63  std::vector<std::string> orderFields;
64 
65  friend std::istream& operator>>(std::istream& is, SphinxInputJsonMessageSearch& messageSearch);
66  friend std::ostream& operator<<(std::ostream& os, const SphinxInputJsonMessageSearch& messageSearch);
67  typedef IJsonSerializable inherited;
68 };
69 //-----------------------------------------------------------------------------
70 //-----------------------------------------------------------------------------
71 } // end namespace Sphinx
72 } // end namespace HCE
73 
74 #endif // SPHINX_INPUT_JSON_MESSAGE_SEARCH_HPP