libwolfram20

◆ toString()

std::string WAQuery::toString ( )

Returning a query param string.

Returns
Query
26 {
27 std::string q = std::string("&input=") + WAQuery::parseInput(this->_input);
28
29 // Adding a vectors data to string
30 q += VectorToStr("&format=", false, this->_formats);
31 if (this->_timeout != DEFAULT_TIMEOUT) q += std::string("&scantimeout=") + std::to_string(this->_timeout);
32 q += VectorToStr("&includepodid=", true, this->_includePodIDs);
33 q += VectorToStr("&excludepodid=", true, this->_excludePodIDs);
34 q += VectorToStr("&podtitle=", true, this->_podTitle);
35 q += VectorToStr("&scanner=", true, this->_podScanners);
36 q += VectorToStr("&podindex=", false, this->_podIndexes);
37
38 return q;
39}
std::string to_string(const T &t)
Template for converting any data to string.
Definition: WAQuery.h:166
#define DEFAULT_TIMEOUT
Wolfram API's default timeout per query.
Definition: WAQuery.h:21
std::string VectorToStr(const char *prefix, bool individual, std::vector< T > &t)
Concatenating a vector data to string.
Definition: WAQuery.cpp:204
static std::string parseInput(std::string str)
Given an string it creates a copy but with % code More information here
Definition: WAQuery.cpp:48
unsigned int _timeout
The number of seconds to allow Wolfram|Alpha to compute results in the "scan" stage of processing (in...
Definition: WAQuery.h:124
std::vector< std::string > _includePodIDs
Specifies a pod ID to include in the result.
Definition: WAQuery.h:148
std::vector< std::string > _podTitle
Specifies a pod title to include in the result.
Definition: WAQuery.h:145
std::string _input
Text to search.
Definition: WAQuery.h:123
std::vector< std::string > _formats
The desired format for individual result pods It can be "image", "imagemap", "plaintext",...
Definition: WAQuery.h:144
std::vector< std::string > _excludePodIDs
Specifies a pod ID to exclude from the result.
Definition: WAQuery.h:149
std::vector< std::string > _podScanners
Specifies that only pods produced by the given scanner should be returned.
Definition: WAQuery.h:147
std::vector< int > _podIndexes
Specifies the index(es) of the pod(s) to return.
Definition: WAQuery.h:146