Skip to end of metadata
Go to start of metadata

public std::string FB::URI::toString ( bool  include_domain_part = true  )  const

converts the FB::URI object to a string

 FB::URI uri;
 uri.protocol = "http";
 uri.host = "www.firebreath.org";
 uri.path = "/applications";
 uri.query_data["user"] = "taxilian";
 uri.fragment = "bleh";
 std::string struri = uri.toString();
 // struri == "http://[email protected]/applications?user=taxilian#bleh"
Parameters:
include_domain_part bool if false, only the path and later will be returned (no domain or http://, etc)
Returns:
std::string
Since:
1.4b1

Definition at line 66 of file URI.cpp.

References url_encode().

00066                                                     {
00067     std::stringstream res;
00068     if (include_host_part) {
00069         res << protocol << string("://");
00070         if (!login.empty()) res << login << "@";
00071         res << domain;
00072         if (port) res << ":" << boost::lexical_cast<string>(port);
00073     }
00074     res << url_encode(path);
00075     if (!query_data.empty()) {
00076         char separator = '?';
00077         for (std::map<std::string, std::string>::const_iterator it = query_data.begin(); it != query_data.end(); ++it) {
00078             res << separator;
00079             separator = '&';
00080             res << url_encode(it->first);
00081             res << '=';
00082             res << url_encode(it->second);
00083         }
00084     }
00085     if (!fragment.empty())
00086         res << "#" << fragment;
00087     return res.str();
00088 }

Here is the call graph for this function:


Generated on 19 Jun 2013 for FireBreath by  doxygen 1.6.1
Labels
  • None