本文整理汇总了C++中URI函数的典型用法代码示例。如果您正苦于以下问题:C++ URI函数的具体用法?C++ URI怎么用?C++ URI使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了URI函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: IRI
bool Property::ParseMetaElement(shared_ptr<xml::Node> node)
{
if ( !bool(node) )
return false;
if ( !node->IsElementNode() )
return false;
auto ns = node->Namespace();
if ( ns != nullptr && ns->URI() == DCMES_uri )
{
auto found = NameToIDMap.find(node->Name());
if ( found == NameToIDMap.end() )
return false;
_type = found->second;
_identifier = IRI(string(DCMES_uri) + node->Name());
_value = node->Content();
_language = node->Language();
SetXMLIdentifier(_getProp(node, "id"));
return true;
}
else if ( node->Name() == MetaTagName )
{
string property = _getProp(node, "property");
if ( property.empty() )
return false;
_type = DCType::Custom;
_identifier = OwnedBy::Owner()->PropertyIRIFromString(property);
_value = node->Content();
_language = node->Language();
SetXMLIdentifier(_getProp(node, "id"));
return true;
}
else if ( ns != nullptr )
{
_type = DCType::Custom;
_identifier = IRI(string(ns->URI()) + node->Name());
_value = node->Content();
_language = node->Language();
SetXMLIdentifier(_getProp(node, "id"));
return true;
}
return false;
}
示例2: URI
URI NLink::target_path() const
{
if(m_target.get() == nullptr)
return URI();
return m_target->uri();
}
示例3: URI
URI URI::fromString(const std::string& string) {
URI uri;
const auto firstColon = string.find_first_of(':');
const auto secondColon = string.find_first_of(':', firstColon + 1);
const auto firstSlash = string.find_first_of('/');
const auto secondSlash = string.find_first_of('/', firstSlash + 1);
const auto thirdSlash = string.find_first_of('/', secondSlash + 1);
if (firstColon == std::string::npos ||
firstSlash == std::string::npos ||
secondSlash == std::string::npos ||
thirdSlash == std::string::npos) {
return URI();
}
uri.protocol_ = string.substr(0, firstColon);
uri.server_ = string.substr(secondSlash + 1, std::min(secondColon, thirdSlash) - secondSlash - 1);
if (secondColon < thirdSlash) {
const auto portString = string.substr(secondColon + 1, thirdSlash - secondColon - 1);
uri.port_ = std::stoul(portString);
} else {
if (uri.protocol_ == "coap") uri.port_ = 5683;
if (uri.protocol_ == "coaps") uri.port_ = 20220;
}
uri.path_ = string.substr(thirdSlash);
uri.isValid_ = true;
return uri;
}
示例4: Component
BinaryDataWriter::BinaryDataWriter ( const std::string& name ) : Component(name)
{
options().add("file", URI())
.pretty_name("File")
.description("File name for the output file")
.attach_trigger(boost::bind(&BinaryDataWriter::trigger_file, this));
}
示例5: NS_ENSURE_TRUE
NS_IMETHODIMP
nsInputStreamChannel::SetURI(nsIURI *uri)
{
NS_ENSURE_TRUE(!URI(), NS_ERROR_ALREADY_INITIALIZED);
nsBaseChannel::SetURI(uri);
return NS_OK;
}
示例6: RemoteFileId
void FileNameHandler::finishedDownload(const NameLookupHandler::Callback &cb,
const std::string &filename, DenseDataPtr data, bool success)
{
bool exists = false;
RemoteFileId foundURI;
if (success) {
for (const unsigned char *iter = data->begin(); iter != data->end();) {
const unsigned char *newlinepos = std::find(iter, data->end(), '\n');
if (newlinepos == data->end()) {
break;
}
const unsigned char *spacepos = std::find(iter, newlinepos, ' ');
if (std::string(iter, spacepos) != filename) {
iter = newlinepos + 1;
continue;
}
if (spacepos == newlinepos || spacepos + 1 == newlinepos) {
// the name does not exist.
exists = false;
} else {
exists = true;
foundURI = RemoteFileId(URI(std::string(spacepos+1, newlinepos)));
}
iter = newlinepos + 1;
}
}
if (exists) {
cb(foundURI.fingerprint(), foundURI.uri().toString(), true);
} else {
cb(Fingerprint::null(), std::string(), false);
}
}
示例7: URI
PRBool
nsGopherChannel::GetStatusArg(nsresult status, nsString &statusArg)
{
nsCAutoString host;
URI()->GetHost(host);
CopyUTF8toUTF16(host, statusArg);
return PR_TRUE;
}
示例8: URI
bool
nsFtpChannel::GetStatusArg(nsresult status, nsString &statusArg)
{
nsCAutoString host;
URI()->GetHost(host);
CopyUTF8toUTF16(host, statusArg);
return true;
}
示例9: create_option
virtual boost::shared_ptr< Option > create_option(const std::string& name, const boost::any& default_value)
{
const std::vector<std::string> uri_strings = boost::any_cast< std::vector<std::string> >(default_value);
typename OptionArray< Handle<CTYPE> >::value_type def_val; def_val.reserve(uri_strings.size());
BOOST_FOREACH(const std::string& uri_str, uri_strings)
{
def_val.push_back(Handle<CTYPE>(Core::instance().root().access_component(URI(uri_str))));
}
示例10: httpMethod
//------------------------------------------------------------------------------
ofxHTTPBaseRequest::ofxHTTPBaseRequest(const string& _httpMethod, const string& _uri, const string& _httpVersion) :
httpMethod(_httpMethod),
httpVersion(_httpVersion)
{
// this is kind of a mess, but we want to create requests from string uris
try {
uri = URI(_uri);
bHasValidURI = true;
} catch(const SyntaxException& exc) {
invalidURI = _uri;
uri = URI("http://127.0.0.1");
bHasValidURI = false;
ofLogError("ofxHTTPBaseRequest::ofxHTTPBaseRequest") << "Syntax exeption: " << exc.message() << " Setting uri to http://127.0.0.1";
}
setFormFieldsFromURI(uri);
}
示例11: properties
void IterativeSolver::raise_iteration_done()
{
SignalOptions opts;
const Uint iter = properties().value<Uint>("iteration");
opts.add_option< OptionT<Uint> >( "iteration", iter );
SignalFrame frame = opts.create_frame("iteration_done", uri(), URI());
Common::Core::instance().event_handler().raise_event( "iteration_done", frame);
}
示例12: do_QueryInterface
NS_IMETHODIMP
nsFileChannel::GetFile(nsIFile **file)
{
nsCOMPtr<nsIFileURL> fileURL = do_QueryInterface(URI());
NS_ENSURE_STATE(fileURL);
// This returns a cloned nsIFile
return fileURL->GetFile(file);
}
示例13: LOGI
bool ARTSPConnection::receiveRTSPRequest() {
AString requestLine;
LOGI(LOG_TAG,"start receiveLine ......\n");
if (!receiveLine(&requestLine)) {
return false;
}
// LOGI(LOG_TAG,"receiveLine OK\n");
sp<AMessage> request = new AMessage(kWhatRequest,mhandlerID);
request->setInt32("SessionID",mSessionID);
LOGI(LOG_TAG,"request->setInt32 SessionID %d\n",mSessionID);
LOGI(LOG_TAG,"request: %s\n", requestLine.c_str());
ssize_t space1 = requestLine.find(" ");//寻找空格
if (space1 < 0) {
return false;
}
ssize_t space2 = requestLine.find(" ", space1 + 1);
if (space2 < 0) {
return false;
}
AString Method(requestLine.c_str(), space1);
request->setString("Method",Method.c_str());
AString URI(requestLine,space1+1,space2-space1-1);
request->setString("URI",URI.c_str());
AString line;
for (;;) {
if (!receiveLine(&line)) {
break;
}
if (line.empty()) {
break;
}
ssize_t colonPos = line.find(":");
if (colonPos < 0) {
// Malformed header line.
return false;
}
AString key(line, 0, colonPos);
key.trim();
// key.tolower();
line.erase(0, colonPos + 1);
line.trim();
LOGI(LOG_TAG,"line: %s:%s\n", key.c_str(),line.c_str());
request->setString(key.c_str(),line.c_str());
}
LOGI(LOG_TAG,"Post the request to handler\n");
request->post();//将请求消息发送给uplayer 处理
return OK;
}
示例14: SILOG
void MeerkatChunkHandler::get(std::tr1::shared_ptr<Chunk> chunk, ChunkCallback callback) {
std::tr1::shared_ptr<DenseData> bad;
if (!chunk) {
SILOG(transfer, error, "HttpChunkHandler get called with null chunk parameter");
callback(bad);
return;
}
//Check to see if it's in the cache first
SharedChunkCache::getSingleton().getCache()->getData(chunk->getHash(), chunk->getRange(), std::tr1::bind(
&MeerkatChunkHandler::cache_check_callback, this, _1, URI("meerkat:///"), chunk, callback));
}
示例15: ad_server_answer
/* Parses the http request and responds accordingly to
* the connected client. Jumps out of the routine if
* there are errors during the transactions with the client.
*
* @param client_socket file descriptor of the client socket
* @param error_jmp safe state to jump back to after encountering errors
*/
void ad_server_answer(int client_socket, jmp_buf error_jmp)
{
int requested_file;
char path[512];
char buffer[AD_HTTP_REQUEST_MAX_SIZE];
ad_http_request *http_request = NULL;
ad_response_receive(client_socket, buffer, AD_HTTP_REQUEST_MAX_SIZE, error_jmp);
http_request = ad_http_request_parse(buffer);
if (http_request == NULL || METHOD(http_request) == NULL || !ad_method_is_valid(METHOD(http_request)))
{
ad_http_request_free(http_request);
ad_response_send(client_socket, AD_RESPONSE_CLIENT_BAD_REQUEST, error_jmp);
}
else if (ad_utils_strcmp_ic(METHOD(http_request), "GET"))
{
ad_http_request_free(http_request);
ad_response_send(client_socket, AD_RESPONSE_SERVER_NOT_IMPLEMENTED, error_jmp);
}
else if (!ad_utils_strcmp_ic(METHOD(http_request),"GET"))
{
sprintf(path, "htdocs%s", URI(http_request));
if (ad_utils_is_directory(path))
{
strcat(path, "index.html");
}
ad_http_request_free(http_request);
if ((requested_file = open(path, O_RDONLY)) == -1)
{
perror(path);
ad_response_send(client_socket, AD_RESPONSE_CLIENT_NOT_FOUND, error_jmp);
}
else
{
ad_response_send(client_socket, AD_RESPONSE_HTTP_OK, error_jmp);
ad_response_sendfile(client_socket, requested_file, error_jmp);
close(requested_file);
}
}
shutdown(client_socket, SHUT_WR);
ad_response_receive(client_socket, buffer, AD_HTTP_REQUEST_MAX_SIZE, error_jmp);
close(client_socket);
}