您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ CFURLCreateWithString函数代码示例

51自学网 2021-06-01 19:59:28
  C++
这篇教程C++ CFURLCreateWithString函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中CFURLCreateWithString函数的典型用法代码示例。如果您正苦于以下问题:C++ CFURLCreateWithString函数的具体用法?C++ CFURLCreateWithString怎么用?C++ CFURLCreateWithString使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了CFURLCreateWithString函数的24个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: InitializeCustomToolbarItem

//-----------------------------------------------------------------------------//	InitializeCustomToolbarItem//-----------------------------------------------------------------------------//	This is called after our item has been constructed. We are called here so//	that we can pull parameters out of the Carbon Event that is passed into the//	HIObjectCreate call.//static OSStatusInitializeCustomToolbarItem( CustomToolbarItem* inItem, EventRef inEvent ){	CFTypeRef		data;	IconRef			iconRef;		if ( GetEventParameter( inEvent, kEventParamToolbarItemConfigData, typeCFTypeRef, NULL,			sizeof( CFTypeRef ), NULL, &data ) == noErr )	{		if ( CFGetTypeID( data ) == CFStringGetTypeID() )			inItem->url = CFURLCreateWithString( NULL, (CFStringRef)data, NULL );		else			inItem->url = (CFURLRef)CFRetain( data );	}	else	{		inItem->url = CFURLCreateWithString( NULL, CFSTR( "http://www.apple.com" ), NULL );	}	HIToolbarItemSetLabel( inItem->toolbarItem, CFSTR( "URL Item" ) );		if ( GetIconRef( kOnSystemDisk, kSystemIconsCreator, kGenericURLIcon, &iconRef ) == noErr )	{		HIToolbarItemSetIconRef( inItem->toolbarItem, iconRef );		ReleaseIconRef( iconRef );	}		HIToolbarItemSetHelpText( inItem->toolbarItem, CFURLGetString( inItem->url ), NULL );		return noErr;}
开发者ID:fruitsamples,项目名称:CarbonToolbar,代码行数:38,


示例2: ASSERT

CFErrorRef ResourceError::cfError() const{    if (m_isNull) {        ASSERT(!m_platformError);        return 0;    }    if (!m_platformError) {        RetainPtr<CFMutableDictionaryRef> userInfo(AdoptCF, CFDictionaryCreateMutable(0, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));        if (!m_localizedDescription.isEmpty()) {            RetainPtr<CFStringRef> localizedDescriptionString(AdoptCF, m_localizedDescription.createCFString());            CFDictionarySetValue(userInfo.get(), kCFErrorLocalizedDescriptionKey, localizedDescriptionString.get());        }        if (!m_failingURL.isEmpty()) {            RetainPtr<CFStringRef> failingURLString(AdoptCF, m_failingURL.createCFString());            CFDictionarySetValue(userInfo.get(), failingURLStringKey, failingURLString.get());            RetainPtr<CFURLRef> url(AdoptCF, CFURLCreateWithString(0, failingURLString.get(), 0));            CFDictionarySetValue(userInfo.get(), failingURLKey, url.get());        }#if PLATFORM(WIN)        if (m_certificate)            wkSetSSLPeerCertificateData(userInfo.get(), m_certificate.get());#endif                RetainPtr<CFStringRef> domainString(AdoptCF, m_domain.createCFString());        m_platformError.adoptCF(CFErrorCreate(0, domainString.get(), m_errorCode, userInfo.get()));    }    return m_platformError.get();}
开发者ID:gobihun,项目名称:webkit,代码行数:33,


示例3: CFURLCreateWithString

 URL::URL( CFStringRef value ) {     if( value != NULL && CFGetTypeID( value ) == CFStringGetTypeID() )     {         this->_cfObject = CFURLCreateWithString( static_cast< CFAllocatorRef >( NULL ), value, NULL );     } }
开发者ID:siraj,项目名称:CFPP,代码行数:7,


示例4: LoadBundle

CFBundleRef LoadBundle(const char* lpBundlePath){	if(lpBundlePath == NULL)	{		return NULL;	}		CFStringRef bundlePath = CFStringCreateWithCString(kCFAllocatorSystemDefault, lpBundlePath, CFStringGetSystemEncoding());	if(NULL == bundlePath)	{		return NULL;	}		CFURLRef bundleURL = CFURLCreateWithString(kCFAllocatorSystemDefault, bundlePath, NULL);	if(NULL == bundleURL)	{		return NULL;	}#endif		// 2.get bundle ref	CFBundleRef bundleRef = CFBundleCreate(kCFAllocatorSystemDefault, bundleURL);	CFRelease(bundleURL);		if(NULL != bundleRef)	{	}	return bundleRef;}
开发者ID:andreasgal,项目名称:openh264,代码行数:30,


示例5: LaunchBrowser

bool LaunchBrowser(const char* url){#ifdef WIN32  int r =  (int)ShellExecuteA(0, "open", url, "", "", 1);  return (r > 32);#else #ifdef MACOSX  CFStringRef strurl =                //CFSTR("http://www.amju.com"); // TODO HACK     CFStringCreateWithBytes(    0,     (const unsigned char*)url,     strlen(url),    kCFStringEncodingMacRoman,    false);  CFURLRef cfurl = CFURLCreateWithString(0, strurl, 0);  OSStatus ret = LSOpenCFURLRef(cfurl, 0);std::cout << "Launch URL: " << CFStringGetCStringPtr(strurl, kCFStringEncodingMacRoman) << "/n";std::cout << "Launch result: " << ret << "/n";  // TODO deal with ret  return true;#else  // Not implemented for this platform  return false;#endif#endif}
开发者ID:jason-amju,项目名称:amju-scp,代码行数:34,


示例6: CreateURLFromReferral

/* * Given a Dfs Referral string create a CFURL. Remember referral have a file * syntax *  * Example: "/smb-win2003.apple.com/DfsRoot/DfsLink1" */CFURLRef CreateURLFromReferral(CFStringRef inStr){	CFURLRef ct_url = NULL;	CFMutableStringRef urlString = CFStringCreateMutableCopy(NULL, 0, CFSTR("smb:/"));	CFStringRef escapeStr = inStr;	    /*      * CreateStringByAddingPercentEscapesUTF8() will either create a new string     * or return the original with ref count incremented. Either way we have to     * call CFRelease on the returned string      */	CreateStringByAddingPercentEscapesUTF8(&escapeStr, NULL, NULL, FALSE);	if (urlString) {		CFStringAppend(urlString, escapeStr);		ct_url = CFURLCreateWithString(kCFAllocatorDefault, urlString, NULL);		CFRelease(urlString);	/* We create it now release it */	}    	if (!ct_url) {		LogCFString(inStr, "creating url failed", __FUNCTION__, __LINE__);	}        if (escapeStr) {        CFRelease(escapeStr);    }   	return ct_url;}
开发者ID:aosm,项目名称:smb,代码行数:35,


示例7: cfstring

void CWebKitActiveScroller::SetURL(const cdstring& urltxt){	MyCFString cfstring(urltxt, kCFStringEncodingUTF8);	CFURLRef url = CFURLCreateWithString( NULL, cfstring, NULL );	URLToWebView(mViewRef, url);	CFRelease(url);}
开发者ID:gpreviato,项目名称:Mulberry-Mail,代码行数:7,


示例8: execview_pretty_command

/* * Return a pretty command, on some OS's we might do something * different than just display the command. * * free_ret - whether or not to free the return value */char *execview_pretty_command(MCAP_CMD_S *mc_cmd, int *free_ret){    char *str;    int rv_to_free = 0;    if(free_ret)      *free_ret = rv_to_free;    if(!mc_cmd)      return NULL;    str = mc_cmd->command;#ifdef _WINDOWS    if(*str == '*' || (*str == '/"' && str[1] == '*')){	if(!strncmp(str + ((*str == '/"') ? 2 : 1), "DDE*", 4))	  str = cpystr("via app already running");	else if(!strncmp(str + ((*str == '/"') ? 2 : 1),"ShellEx*",8))	  str = cpystr("via Explorer defined app");	else	  str = cpystr("via Windows-specific method");	rv_to_free = 1;    }#elif	OSX_TARGET    if(mc_cmd->special_handling){	CFStringRef str_ref = NULL, kind_str_ref = NULL;	CFURLRef url_ref;	char buf[256];	if((str_ref = CFStringCreateWithCString(NULL, mc_cmd->command,					 kCFStringEncodingASCII)) == NULL)	  return "";	if((url_ref = CFURLCreateWithString(NULL, str_ref, NULL)) == NULL)	  return "";	if(LSCopyDisplayNameForURL(url_ref, &kind_str_ref) != noErr)	  return "";	if(CFStringGetCString(kind_str_ref, buf, (CFIndex)255,			      kCFStringEncodingASCII) == false)	  return "";	buf[255] = '/0';	str = cpystr(buf);	rv_to_free = 1;	if(kind_str_ref)	  CFRelease(kind_str_ref);    }#else    /* always pretty */#endif    if(free_ret)      *free_ret = rv_to_free;    return(str);}
开发者ID:RsrchBoy,项目名称:dpkg-alpine,代码行数:66,


示例9: createGetURL

/* Create a URI suitable for use in an http GET request, will return NULL if   the length would exceed 255 bytes. */static CFURLRef createGetURL(CFURLRef responder, CFDataRef request) {    CFURLRef getURL = NULL;    CFMutableDataRef base64Request = NULL;    CFStringRef base64RequestString = NULL;    CFStringRef peRequest = NULL;    CFIndex base64Len;    base64Len = SecBase64Encode(NULL, CFDataGetLength(request), NULL, 0);    /* Don't bother doing all the work below if we know the end result will       exceed 255 bytes (minus one for the '/' separator makes 254). */    if (base64Len + CFURLGetBytes(responder, NULL, 0) > 254)        return NULL;    require(base64Request = CFDataCreateMutable(kCFAllocatorDefault,        base64Len), errOut);    CFDataSetLength(base64Request, base64Len);    SecBase64Encode(CFDataGetBytePtr(request), CFDataGetLength(request),        (char *)CFDataGetMutableBytePtr(base64Request), base64Len);    require(base64RequestString = CFStringCreateWithBytes(kCFAllocatorDefault,        CFDataGetBytePtr(base64Request), base64Len, kCFStringEncodingUTF8,        false), errOut);    require(peRequest = CFURLCreateStringByAddingPercentEscapes(        kCFAllocatorDefault, base64RequestString, NULL, CFSTR("+/="),        kCFStringEncodingUTF8), errOut);#if 1    CFStringRef urlString = CFURLGetString(responder);    CFStringRef fullURL;    if (CFStringHasSuffix(urlString, CFSTR("/"))) {        fullURL = CFStringCreateWithFormat(kCFAllocatorDefault, NULL,            CFSTR("%@%@"), urlString, peRequest);    } else {        fullURL = CFStringCreateWithFormat(kCFAllocatorDefault, NULL,            CFSTR("%@/%@"), urlString, peRequest);    }    getURL = CFURLCreateWithString(kCFAllocatorDefault, fullURL, NULL);    CFRelease(fullURL);#else    getURL = CFURLCreateWithString(kCFAllocatorDefault, peRequest, responder);#endiferrOut:    CFReleaseSafe(base64Request);    CFReleaseSafe(base64RequestString);    CFReleaseSafe(peRequest);    return getURL;}
开发者ID:alfintatorkace,项目名称:osx-10.9-opensource,代码行数:49,


示例10: FetchIPAddress

static void FetchIPAddress(){	if(publicIPState == IPStateFetching)		return;	publicIPState = IPStateFetching;	const UInt8 bodyBytes[] = {0};	CFDataRef body = CFDataCreate(kCFAllocatorDefault, bodyBytes, 0);	CFURLRef url = CFURLCreateWithString(kCFAllocatorDefault, CFSTR("http://icanhazip.com"), NULL);	CFHTTPMessageRef request = CFHTTPMessageCreateRequest(kCFAllocatorDefault, CFSTR("GET"), url, kCFHTTPVersion1_1);	CFHTTPMessageSetBody(request, body);#pragma clang diagnostic push#pragma clang diagnostic ignored "-Wdeprecated-declarations"	// Apple suggests the NSURLSession API instead of CFReadStreamCreateForHTTPRequest,	// But obviously that doesn't really work here	CFReadStreamRef stream = CFReadStreamCreateForHTTPRequest(kCFAllocatorDefault, request);#pragma clang diagnostic pop	CFRelease(body);	CFRelease(url);	CFRelease(request);	CFMutableDataRef responseData = CFDataCreateMutable(kCFAllocatorDefault, 17);	CFStreamClientContext context = { 0, responseData, NULL, NULL, NULL };	if(!CFReadStreamSetClient(stream, kCFStreamEventOpenCompleted | kCFStreamEventHasBytesAvailable | kCFStreamEventEndEncountered | kCFStreamEventErrorOccurred, &IPStreamCallback, &context))	{		CFRelease(stream);		publicIPState = IPStateInvalid;		return;	}	// Add to the run loop and open the stream	CFReadStreamScheduleWithRunLoop(stream, CFRunLoopGetCurrent(), kCFRunLoopCommonModes);	if(!CFReadStreamOpen(stream))	{		CFReadStreamSetClient(stream, 0, NULL, NULL);		CFReadStreamUnscheduleFromRunLoop(stream, CFRunLoopGetCurrent(), kCFRunLoopCommonModes);		CFRelease(stream);		publicIPState = IPStateInvalid;		return;	}	// Run the run loop	do {		CFRunLoopRunInMode(kCFRunLoopDefaultMode, 1.0, TRUE);	} while(publicIPState == IPStateFetching);}
开发者ID:JustSid,项目名称:extip,代码行数:58,


示例11: impExpImportParseFileExten

/* * Parse file extension and attempt to map it to format and type. Returns true * on success. */bool impExpImportParseFileExten(	CFStringRef			fstr,	SecExternalFormat   *inputFormat,   // RETURNED	SecExternalItemType	*itemType)		// RETURNED{	if(fstr == NULL) {		/* nothing to work with */		return false;	}	if(CFStringHasSuffix(fstr, CFSTR(".cer")) ||	   CFStringHasSuffix(fstr, CFSTR(".crt"))) {		*inputFormat = kSecFormatX509Cert;		*itemType = kSecItemTypeCertificate;		SecImpInferDbg("Inferring kSecFormatX509Cert from file name");		return true;	}	if(CFStringHasSuffix(fstr, CFSTR(".p12")) ||	   CFStringHasSuffix(fstr, CFSTR(".pfx"))) {		*inputFormat = kSecFormatPKCS12;		*itemType = kSecItemTypeAggregate;		SecImpInferDbg("Inferring kSecFormatPKCS12 from file name");		return true;	}	/* Get extension, look for key indicators as substrings */	CFURLRef url = CFURLCreateWithString(NULL, fstr, NULL);	if(url == NULL) {		SecImpInferDbg("impExpImportParseFileExten: error creating URL");		return false;	}	CFStringRef exten = CFURLCopyPathExtension(url);	CFRelease(url);	if(exten == NULL) {		/* no extension, app probably passed in only an extension */		exten = fstr;		CFRetain(exten);	}	bool ortn = false;	CFRange cfr;	cfr = CFStringFind(exten, CFSTR("p7"), kCFCompareCaseInsensitive);	if(cfr.length != 0) {		*inputFormat = kSecFormatPKCS7;		*itemType = kSecItemTypeAggregate;		SecImpInferDbg("Inferring kSecFormatPKCS7 from file name");		ortn = true;	}	if(!ortn) {		cfr = CFStringFind(exten, CFSTR("p8"), kCFCompareCaseInsensitive);		if(cfr.length != 0) {			*inputFormat = kSecFormatWrappedPKCS8;			*itemType = kSecItemTypePrivateKey;			SecImpInferDbg("Inferring kSecFormatPKCS8 from file name");			ortn = true;		}	}	CFRelease(exten);	return ortn;}
开发者ID:unofficial-opensource-apple,项目名称:Security,代码行数:62,


示例12: WebKit_win32_NATIVE

JNIEXPORT jintLong JNICALL WebKit_win32_NATIVE(CFURLCreateWithString)	(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jintLong arg2){	jintLong rc = 0;	WebKit_win32_NATIVE_ENTER(env, that, CFURLCreateWithString_FUNC);	rc = (jintLong)CFURLCreateWithString((CFAllocatorRef)arg0, (CFStringRef)arg1, (CFURLRef)arg2);	WebKit_win32_NATIVE_EXIT(env, that, CFURLCreateWithString_FUNC);	return rc;}
开发者ID:HendrikPeilke,项目名称:eclipse.platform.swt,代码行数:9,


示例13: loadKernelExtension

void loadKernelExtension() {  // Check if the kernel extension package is installed.  auto results = SQL::selectAllFrom(      "package_receipts", "path", EQUALS, kKernelPackageReceipt);  if (results.size() == 0) {    // The kernel package is not installed.    return;  }  // Find the panic log file for the last panic if we are booting out of panic.  results =      SQL::SQL(          "SELECT f.path AS path FROM (SELECT * FROM nvram WHERE name like "          "'%panic%') AS nv JOIN (SELECT * FROM file WHERE "          "directory='/Library/Logs/DiagnosticReports/' AND path like "          "'%/Kernel%' ORDER BY ctime DESC LIMIT 1) as f;")          .rows();  // If a panic exists, check if it was caused by the osquery extension.  if (results.size() == 1) {    std::string panic_content;    if (readFile(results[0]["path"], panic_content).ok()) {      auto rx = xp::sregex::compile(kKernelBundleRegex);      xp::smatch matches;      // If so, write a blacklist file that prevents future load attempts.      if (xp::regex_search(panic_content, matches, rx)) {        LOG(ERROR) << "Panic was caused by osquery kernel extension";        writeTextFile(kBlockingFile, "");      }    }  }  // Check if the kernel extension is manually (or set from crash) blocked.  results = SQL::selectAllFrom("file", "path", EQUALS, kBlockingFile);  if (FLAGS_disable_kernel) {    LOG(INFO) << "Kernel extension is disabled";    return;  } else if (results.size() > 0) {    LOG(WARNING) << "Kernel extension disabled by file";    return;  }  CFURLRef urls[1];  CFArrayRef directoryArray;  urls[0] = CFURLCreateWithString(nullptr, kKernelExtensionDirectory, nullptr);  directoryArray =      CFArrayCreate(nullptr, (const void**)urls, 1, &kCFTypeArrayCallBacks);  if (KextManagerLoadKextWithIdentifier(kKernelBundleId, directoryArray) !=      kOSReturnSuccess) {    VLOG(1) << "Could not autoload kernel extension";  } else {    VLOG(1) << "Autoloaded osquery kernel extension";  }  CFRelease(directoryArray);}
开发者ID:wxsBSD,项目名称:osquery,代码行数:57,


示例14: CFURLCreateWithString

CFURLRef Caching_Stream::createFileURLWithPath(CFStringRef path){    CFURLRef regularUrl = CFURLCreateWithString(kCFAllocatorDefault, path, NULL);        CFURLRef fileUrl = CFURLCreateFilePathURL(kCFAllocatorDefault, regularUrl, NULL);        CFRelease(regularUrl);        return fileUrl;}
开发者ID:mps,项目名称:FreeStreamer,代码行数:10,


示例15: LL_WARNS

// Open a URL with the user's default web browser.// Must begin with protocol identifier.void LLWindowMacOSX::spawnWebBrowser(const std::string& escaped_url, bool async){	// I'm fairly certain that this is all legitimate under Apple's currently supported APIs.		bool found = false;	S32 i;	for (i = 0; i < gURLProtocolWhitelistCount; i++)	{		if (escaped_url.find(gURLProtocolWhitelist[i]) != std::string::npos)		{			found = true;			break;		}	}	if (!found)	{		LL_WARNS() << "spawn_web_browser called for url with protocol not on whitelist: " << escaped_url << LL_ENDL;		return;	}	S32 result = 0;	CFURLRef urlRef = NULL;	LL_INFOS() << "Opening URL " << escaped_url << LL_ENDL;	CFStringRef	stringRef = CFStringCreateWithCString(NULL, escaped_url.c_str(), kCFStringEncodingUTF8);	if (stringRef)	{		// This will succeed if the string is a full URL, including the http://		// Note that URLs specified this way need to be properly percent-escaped.		urlRef = CFURLCreateWithString(NULL, stringRef, NULL);		// Don't use CRURLCreateWithFileSystemPath -- only want valid URLs		CFRelease(stringRef);	}	if (urlRef)	{		result = LSOpenCFURLRef(urlRef, NULL);		if (result != noErr)		{			LL_INFOS() << "Error " << result << " on open." << LL_ENDL;		}		CFRelease(urlRef);	}	else	{		LL_INFOS() << "Error: couldn't create URL." << LL_ENDL;	}}
开发者ID:gabeharms,项目名称:firestorm,代码行数:56,


示例16: CFStringCreateWithFormat

// ---------------------------------void USys::openURL(const char *url) {    CFStringRef urlString = CFStringCreateWithFormat(NULL, NULL, CFSTR("%s"), url);    if (urlString) {        CFURLRef pathRef = CFURLCreateWithString(NULL, urlString, NULL);        if (pathRef) {            //OSStatus err = LSOpenCFURLRef( pathRef, NULL );            CFRelease(pathRef);        }        CFRelease(urlString);    }}
开发者ID:PyYoshi,项目名称:PeerCastIM-Mod,代码行数:13,


示例17: QuartzBitmap_Output

void QuartzBitmap_Output(QuartzDesc_t dev, QuartzBitmapDevice *qbd){    if(qbd->path && qbd->uti) {        /* On 10.4+ we can employ the CGImageDestination API to create a           variety of different bitmap formats */#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4	char buf[PATH_MAX+1];	snprintf(buf, PATH_MAX, qbd->path, qbd->page); buf[PATH_MAX] = '/0';        CFStringRef pathString = CFStringCreateWithBytes(kCFAllocatorDefault, (UInt8*) buf, strlen(buf), kCFStringEncodingUTF8, FALSE);        CFURLRef path;        if(CFStringFind(pathString, CFSTR("://"), 0).location != kCFNotFound) {            CFStringRef pathEscaped = CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, pathString, NULL, NULL, kCFStringEncodingUTF8);            path = CFURLCreateWithString(kCFAllocatorDefault, pathEscaped, NULL);            CFRelease(pathEscaped);        } else {            path = CFURLCreateFromFileSystemRepresentation(kCFAllocatorDefault, (const UInt8*) buf, strlen(buf), FALSE);        }        CFRelease(pathString);        CFStringRef scheme = CFURLCopyScheme(path);       	CFStringRef type  = CFStringCreateWithBytes(kCFAllocatorDefault, (UInt8*) qbd->uti, strlen(qbd->uti), kCFStringEncodingUTF8, FALSE);    	CGImageRef image = CGBitmapContextCreateImage(qbd->bitmap);        if(CFStringCompare(scheme,CFSTR("file"), 0) == 0) { /* file output */            CGImageDestinationRef dest = CGImageDestinationCreateWithURL(path, type, 1, NULL);	    if(dest) {		CGImageDestinationAddImage(dest, image, NULL);		CGImageDestinationFinalize(dest);		CFRelease(dest);	    } else 		error(_("QuartzBitmap_Output - unable to open file '%s'"), buf);        } else if(CFStringCompare(scheme, CFSTR("clipboard"), 0) == 0) { /* clipboard output */            CFMutableDataRef      data = CFDataCreateMutable(kCFAllocatorDefault, 0);            CGImageDestinationRef dest = CGImageDestinationCreateWithData(data, type, 1, NULL);            CGImageDestinationAddImage(dest, image, NULL);            CGImageDestinationFinalize(dest);            CFRelease(dest);            PasteboardRef pb = NULL;            if(PasteboardCreate(kPasteboardClipboard, &pb) == noErr) {                PasteboardClear(pb);                PasteboardSynchronize(pb);                PasteboardPutItemFlavor(pb, (PasteboardItemID) 1, type, data, 0);            }            CFRelease(data);        } else            warning(_("not a supported scheme, no image data written"));        CFRelease(scheme);       	CFRelease(type);        CFRelease(path);        CFRelease(image);#endif    }}
开发者ID:Bgods,项目名称:r-source,代码行数:52,


示例18: MySimpleDirectoryListing

/* MySimpleDirectoryListing implements the directory list command.  It sets up a MyStreamInfo 'object' with the read stream being an FTP stream of the directory to list and with no write stream.  It then returns, and the real work happens asynchronously in the runloop.  The function returns true if the stream setup succeeded, and false if it failed. */static BooleanMySimpleDirectoryListing(CFStringRef urlString, CFStringRef username, CFStringRef password){    CFReadStreamRef        readStream;    CFStreamClientContext  context = { 0, NULL, NULL, NULL, NULL };    CFURLRef               downloadURL;    Boolean                success = true;    MyStreamInfo           *streamInfo;    assert(urlString != NULL);    downloadURL = CFURLCreateWithString(kCFAllocatorDefault, urlString, NULL);    assert(downloadURL != NULL);    /* Create an FTP read stream for downloading operation from an FTP URL. */    readStream = CFReadStreamCreateWithFTPURL(kCFAllocatorDefault, downloadURL);    assert(readStream != NULL);    CFRelease(downloadURL);            /* Initialize our MyStreamInfo structure, which we use to store some information about the stream. */    MyStreamInfoCreate(&streamInfo, readStream, NULL);    context.info = (void *)streamInfo;    /* CFReadStreamSetClient registers a callback to hear about interesting events that occur on a stream. */    success = CFReadStreamSetClient(readStream, kNetworkEvents, MyDirectoryListingCallBack, &context);    if (success) {        /* Schedule a run loop on which the client can be notified about stream events.  The client        callback will be triggered via the run loop.  It's the caller's responsibility to ensure that        the run loop is running. */        CFReadStreamScheduleWithRunLoop(readStream, CFRunLoopGetCurrent(), kCFRunLoopCommonModes);                MyCFStreamSetUsernamePassword(readStream, username, password);        MyCFStreamSetFTPProxy(readStream, &streamInfo->proxyDict);            /* CFReadStreamOpen will return success/failure.  Opening a stream causes it to reserve all the        system resources it requires.  If the stream can open non-blocking, this will always return TRUE;        listen to the run loop source to find out when the open completes and whether it was successful. */        success = CFReadStreamOpen(readStream);        if (success == false) {            fprintf(stderr, "CFReadStreamOpen failed/n");            MyStreamInfoDestroy(streamInfo);        }    } else {        fprintf(stderr, "CFReadStreamSetClient failed/n");        MyStreamInfoDestroy(streamInfo);    }    return success;}
开发者ID:BankKit,项目名称:juesheng,代码行数:54,


示例19: FindJnlpURLInFile

static CFURLRef FindJnlpURLInFile(char* fileName) {    XMLNode* doc = NULL;    CFURLRef returnValue = NULL;    char* jnlbuffer = NULL;    /* Parse XML document. */    if (!ReadFileToBuffer(fileName, &jnlbuffer)) {        return NULL;    }    doc = ParseXMLDocument(jnlbuffer);    if (doc != NULL) {        XMLNode* node = NULL;        char *codebase = NULL;        char *href = NULL;        CFStringRef baseURLString = NULL;        CFStringRef hrefString = NULL;        CFMutableStringRef fullURL = NULL;        node = FindXMLChild(doc, "jnlp");        require(node != NULL, bail);        codebase = FindXMLAttribute(node->_attributes, "codebase");        require(codebase != NULL, bail);        href = FindXMLAttribute(node->_attributes, "href");        require(href != NULL, bail);        baseURLString = CFStringCreateWithCString(NULL, codebase, kCFStringEncodingUTF8);        require(baseURLString != NULL, bail);        fullURL = CFStringCreateMutableCopy(NULL, 0, baseURLString);        hrefString = CFStringCreateWithCString(NULL, href, kCFStringEncodingUTF8);        require(hrefString != NULL, bail);        // a relative JNLP path needs a URL that starts at the specificed codebase        if (!CFStringHasSuffix(fullURL, CFSTR("/")))            CFStringAppend(fullURL, CFSTR("/"));        CFStringAppend(fullURL, hrefString);        returnValue = CFURLCreateWithString(NULL, fullURL, NULL);bail:        if (baseURLString != NULL) CFRelease(baseURLString);        if (hrefString != NULL) CFRelease(hrefString);        if (fullURL != NULL) CFRelease(fullURL);        FreeXMLDocument(doc);    }    free(jnlbuffer);    return returnValue;}
开发者ID:Spronovost,项目名称:documentation,代码行数:49,


示例20: CFRelease

 URL & URL::operator = ( std::string value ) {     CF::String s;          if( this->_cfObject != NULL )     {         CFRelease( this->_cfObject );     }          s = value;          this->_cfObject = CFURLCreateWithString( static_cast< CFAllocatorRef >( NULL ), static_cast< CFStringRef >( s ), NULL );          return *( this ); }
开发者ID:siraj,项目名称:CFPP,代码行数:15,


示例21: CopyUserAndWorkgroupFromURL

/*  * Get the user and workgroup names and return them in CFStringRef.  * First get the CFURLCopyNetLocation because it will not escape out the string. */static CFStringRef CopyUserAndWorkgroupFromURL(CFStringRef *outWorkGroup, CFURLRef url){	CFURLRef net_url = NULL;	CFArrayRef	userArray = NULL;	CFStringRef userString = NULL;	CFMutableStringRef urlString = NULL;	CFStringRef wrkgrpString = NULL;		*outWorkGroup = NULL;	/* Always start like we didn't get one. */	/* This will return null if no workgroup in the URL */	userArray = CreateWrkgrpUserArray(url);	if (!userArray)	/* We just have a username name  */		return(CFURLCopyUserName(url));	/* This will escape out the character for us. */		/* Now for the hard part; netlocation contains one of the following:	 *	 * URL = "//workgroup;username:[email
C++ CFURLGetFileSystemRepresentation函数代码示例
C++ CFURLCreateWithFileSystemPath函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。