24 #include <boost/foreach.hpp> 45 stream << query.
name <<
"=" << query.
value;
48 if (scheme.
anchor.size() > 0)
50 stream <<
"#" << scheme.
anchor;
59 std::string name(str, end);
60 for (
size_t i = 0; i < name.size(); ++i)
62 name[i] = tolower(name[i]);
64 if (name ==
"file://")
68 else if (name ==
"http://")
72 else if (name ==
"camera://")
76 else if (name ==
"gps://")
89 std::string name(str, end);
95 std::string name(str, end);
101 std::string name(str, end);
104 m_queries->push_back(query);
109 std::string value(str, end);
110 if (m_queries->empty())
114 m_queries->push_back(query);
116 QueryList::reverse_iterator rit = m_queries->rbegin();
117 assert(rit != m_queries->rend());
132 return this->parseScheme(str, m_scheme, m_info);
146 BOOST_SPIRIT_NAMESPACE::parse_info<> &info)
148 using BOOST_SPIRIT_NAMESPACE::rule;
149 using BOOST_SPIRIT_NAMESPACE::alnum_p;
150 using BOOST_SPIRIT_NAMESPACE::ch_p;
151 using BOOST_SPIRIT_NAMESPACE::space_p;
152 using BOOST_SPIRIT_NAMESPACE::str_p;
153 using BOOST_SPIRIT_NAMESPACE::alpha_p;
154 using BOOST_SPIRIT_NAMESPACE::anychar_p;
172 rule<> extword_p = +alnum_p >> *((ch_p(
'_') | ch_p(
'-') | ch_p(
'.') | space_p) >> +alnum_p);
173 rule<> anchor_word = +alnum_p >> !(ch_p(
'-') >> +alnum_p);
176 rule<> scheme_ch = str_p(
"://");
177 rule<> anchor_ch = ch_p(
'#');
178 rule<> querystart_ch = ch_p(
'?');
179 rule<> querydelim_ch = ch_p(
'&');
182 rule<> scheme_p = +alpha_p >> *((ch_p(
'+')) >> +alpha_p) >> scheme_ch;
183 rule<> specifier_p = +(anychar_p - querystart_ch - anchor_ch);
185 rule<> anchor_p = anchor_ch >> anchor_word[addAnchor];
188 rule<> query_key = +alnum_p >> *(alnum_p | (ch_p(
'_') >> alnum_p));
189 rule<> query_value = +(anychar_p - (querystart_ch | querydelim_ch | space_p));
190 rule<> query_pair = query_key[addName] >> ch_p(
'=') >> query_value[addValue];
191 rule<> query_p = querystart_ch >> query_pair >> *(querydelim_ch >> query_pair);
194 rule<> scheme_rule = !scheme_p[addScheme] >> specifier_p[addSpecifier] >> !anchor_p >> !query_p;
196 scheme_handler.
queries.clear();
197 info = parse(str.c_str(), scheme_rule);
203 #ifdef _IC_BUILDER_DEPRECATED_STYLE_ 205 bool SchemeParser::ParseScheme(
const String &str)
207 return parseScheme(str);
210 const BOOST_SPIRIT_NAMESPACE::parse_info<> &SchemeParser::GetParseInfo()
const 212 return getParseInfo();
217 return getSchemeResult();
220 bool SchemeParser::ParseScheme(
const String &str,
Scheme &scheme_handler, BOOST_SPIRIT_NAMESPACE::parse_info<> &info)
222 return parseScheme(str, scheme_handler, info);
std::ostream & operator<<(std::ostream &os, StampedBase const &stamped)
file:///path/file?key=value
gps://type (gpsd/oxfs/...)
bool parseScheme(const String &str)
camera://source?key=value
Scheme * m_scheme_handler
Scheme * m_scheme_handler
const BOOST_SPIRIT_NAMESPACE::parse_info & getParseInfo() const
virtual void operator()(char const *str, char const *end) const
~SchemeParser()
Destructor.
virtual void operator()(char const *str, char const *end) const
http://domain.org/path/to/site.ext?key=value
virtual void operator()(char const *str, char const *end) const
const icl_core::Scheme & getSchemeResult() const
Returns the parser result.
virtual void operator()(char const *str, char const *end) const
Scheme * m_scheme_handler
Contains icl_core::SchemeParser.
SchemeParser()
Constructor.
virtual void operator()(char const *str, char const *end) const