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

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

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

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

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

示例1: isUrlStringEqual

/* * Test to see if we have the same url string */int isUrlStringEqual(CFURLRef url1, CFURLRef url2){	if ((url1 == NULL) || (url2 == NULL)) {		return FALSE;	/* Never match null URLs */	}		if (CFStringCompare(CFURLGetString(url1), CFURLGetString(url1), 						kCFCompareCaseInsensitive) == kCFCompareEqualTo) {		return TRUE;	}	return FALSE;}
开发者ID:aosm,项目名称:smb,代码行数:15,


示例2: 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,


示例3: GeneratePreviewForURL

OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview, CFURLRef url, CFStringRef contentTypeUTI, CFDictionaryRef options){	state = initState(1);    //printf("displaying %d structures /n", state->noOfStructs);	CFStringRef filepath = CFURLGetString(url);	state->coords[0] = pdb_read(CFStringGetCStringPtr(filepath, 0), "1xxx", '_');    //glutInit(&argc, argv);    //glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH | GLUT_MULTISAMPLE);    //glutInitWindowSize (kWindowWidth, kWindowHeight);    //glutInitWindowPosition (100, 100);    //glutCreateWindow ("WURST-o-Visison");	    InitGL();	    //setShader();        glutDisplayFunc(callback_display);    glutReshapeFunc(ReSizeGLScene);        glutMouseFunc(mouse);    glutKeyboardFunc(keyboard);    glutMotionFunc(motion);    	//    glutMouseFunc(callback_mouse);	//    glutMotionFunc(callback_motion);    //glutIdleFunc(DrawGLScene);    glutMainLoop();    return noErr;}
开发者ID:AlexWoroschilow,项目名称:wurst-alphabet,代码行数:30,


示例4: appendExternalID

static void appendExternalID(CFMutableStringRef str, CFXMLExternalID *extID) {    if (extID->publicID) {        CFStringAppendCString(str, " PUBLIC ", kCFStringEncodingASCII);        appendQuotedString(str, extID->publicID);        if (extID->systemID) {            // Technically, for externalIDs, systemID must not be NULL.  However, by testing for a NULL systemID, we can use this to emit publicIDs, too.  REW, 2/15/2000            CFStringAppendCString(str, " ", kCFStringEncodingASCII);            appendQuotedString(str, CFURLGetString(extID->systemID));        }    } else if (extID->systemID) {        CFStringAppendCString(str, " SYSTEM ", kCFStringEncodingASCII);        appendQuotedString(str, CFURLGetString(extID->systemID));    } else {        // Should never get here    }}
开发者ID:Acorld,项目名称:WinObjC-Heading,代码行数:16,


示例5: impExpImportDeleteExtension

/* do a [NSString stringByDeletingPathExtension] equivalent */CFStringRef impExpImportDeleteExtension(	CFStringRef			fileStr){	CFDataRef fileStrData = CFStringCreateExternalRepresentation(NULL, fileStr,		kCFStringEncodingUTF8, 0);	if(fileStrData == NULL) {		return NULL;	}	CFURLRef urlRef = CFURLCreateFromFileSystemRepresentation(NULL,		CFDataGetBytePtr(fileStrData), CFDataGetLength(fileStrData), false);	if(urlRef == NULL) {		CFRelease(fileStrData);		return NULL;	}	CFURLRef rtnUrl = CFURLCreateCopyDeletingPathExtension(NULL, urlRef);	CFStringRef rtnStr = NULL;	CFRelease(urlRef);	if(rtnUrl) {		rtnStr = CFURLGetString(rtnUrl);		CFRetain(rtnStr);		CFRelease(rtnUrl);	}	CFRelease(fileStrData);	return rtnStr;}
开发者ID:unofficial-opensource-apple,项目名称:Security,代码行数:27,


示例6: CFURLGetString

std::ostream& operator<<(std::ostream& out, CFURLRef u){	if(nullptr == u) {		out << "(null)";		return out;	}	CFStringRef s = CFURLGetString(u);#if !TARGET_OS_IPHONE	if(CFStringHasPrefix(s, CFSTR("file:"))) {		CFStringRef displayName = nullptr;		OSStatus result = LSCopyDisplayNameForURL(u, &displayName);		if(noErr == result && nullptr != displayName) {			out << displayName;			CFRelease(displayName);			displayName = nullptr;		}	}	else#endif		out << s;	return out;}
开发者ID:notjosh,项目名称:SFBAudioEngine,代码行数:25,


示例7: jsUndefined

JSValue *UserObjectImp::toPrimitive(ExecState *exec, JSType preferredType) const{    JSValue *result = jsUndefined();    JSUserObject* jsObjPtr = KJSValueToJSObject(toObject(exec), exec);    CFTypeRef cfValue = jsObjPtr ? jsObjPtr->CopyCFValue() : 0;    if (cfValue) {        CFTypeID cfType = CFGetTypeID(cfValue);  // toPrimitive        if (cfValue == GetCFNull()) {            result = jsNull();        }        else if (cfType == CFBooleanGetTypeID()) {            if (cfValue == kCFBooleanTrue) {                result = jsBoolean(true);            } else {                result = jsBoolean(false);            }        } else if (cfType == CFStringGetTypeID()) {            result = jsString(CFStringToUString((CFStringRef)cfValue));        } else if (cfType == CFNumberGetTypeID()) {            double d = 0.0;            CFNumberGetValue((CFNumberRef)cfValue, kCFNumberDoubleType, &d);            result = jsNumber(d);        } else if (cfType == CFURLGetTypeID()) {            CFURLRef absURL = CFURLCopyAbsoluteURL((CFURLRef)cfValue);            if (absURL) {                result = jsString(CFStringToUString(CFURLGetString(absURL)));                ReleaseCFType(absURL);            }        }        ReleaseCFType(cfValue);    }    if (jsObjPtr)        jsObjPtr->Release();    return result;}
开发者ID:cdaffara,项目名称:symbiandump-mw4,代码行数:35,


示例8: htmlURLRef

String WebInspectorProxy::inspectorPageURL() const{    RetainPtr<CFURLRef> htmlURLRef(AdoptCF, CFBundleCopyResourceURL(CFBundleGetBundleWithIdentifier(CFSTR("com.apple.WebKit")), CFSTR("inspector"), CFSTR("html"), CFSTR("inspector")));    if (!htmlURLRef)        return String();    return String(CFURLGetString(htmlURLRef.get()));}
开发者ID:mcgrawp,项目名称:webkit-webcl,代码行数:8,


示例9: htmlURLRef

String WebInspectorProxy::inspectorPageURL() const{    RetainPtr<CFURLRef> htmlURLRef(AdoptCF, CFBundleCopyResourceURL(webKitBundle(), CFSTR("inspector"), CFSTR("html"), CFSTR("inspector")));    if (!htmlURLRef)        return String();    return String(CFURLGetString(htmlURLRef.get()));}
开发者ID:kcomkar,项目名称:webkit,代码行数:8,


示例10: parseApplicationAliasData

Status parseApplicationAliasData(const std::string& data, std::string& result) {  std::string decoded_data = base64Decode(data);  if (decoded_data.empty()) {    return Status(1, "Failed to base64 decode data");  }  CFDataRef resourceData = CFDataCreate(      nullptr,      static_cast<const UInt8*>(static_cast<const void*>(decoded_data.c_str())),      decoded_data.length());  if (resourceData == nullptr) {    return Status(1, "Failed to allocate resource data");  }  auto alias = (CFDataRef)CFPropertyListCreateWithData(kCFAllocatorDefault,                                                       resourceData,                                                       kCFPropertyListImmutable,                                                       nullptr,                                                       nullptr);  CFRelease(resourceData);  if (alias == nullptr) {    return Status(1, "Failed to allocate alias data");  }  auto bookmark =      CFURLCreateBookmarkDataFromAliasRecord(kCFAllocatorDefault, alias);  CFRelease(alias);  if (bookmark == nullptr) {    return Status(1, "Alias data is not a bookmark");  }  auto url = CFURLCreateByResolvingBookmarkData(      kCFAllocatorDefault, bookmark, 0, nullptr, nullptr, nullptr, nullptr);  CFRelease(bookmark);  if (url == nullptr) {    return Status(1, "Alias data is not a URL bookmark");  }  auto replaced = CFURLCreateStringByReplacingPercentEscapes(      kCFAllocatorDefault, CFURLGetString(url), CFSTR(""));  CFRelease(url);  if (replaced == nullptr) {    return Status(1, "Failed to replace percent escapes.");  }  // Get the URL-formatted path.  result = stringFromCFString(replaced);  CFRelease(replaced);  if (result.empty()) {    return Status(1, "Return result is zero size");  }  if (result.length() > 6 && result.substr(0, 7) == "file://") {    result = result.substr(7);  }  return Status(0, "OK");}
开发者ID:chubbymaggie,项目名称:osquery,代码行数:57,


示例11: encode

void encode(ArgumentEncoder* encoder, CFURLRef url){    CFURLRef baseURL = CFURLGetBaseURL(url);    encoder->encodeBool(baseURL);    if (baseURL)        encode(encoder, baseURL);    encode(encoder, CFURLGetString(url));}
开发者ID:sysrqb,项目名称:chromium-src,代码行数:9,


示例12: start

/* -----------------------------------------------------------------------------plugin entry point, called by pppd----------------------------------------------------------------------------- */int start(CFBundleRef ref){    CFStringRef 	strref;    CFURLRef 		urlref;       bundle = ref;    CFRetain(bundle);        url = CFBundleCopyBundleURL(bundle);    // hookup our handlers    old_check_options = the_channel->check_options;    the_channel->check_options = serial_check_options;        old_connect = the_channel->connect;    the_channel->connect = serial_connect;        old_process_extra_options = the_channel->process_extra_options;    the_channel->process_extra_options = serial_process_extra_options;    add_notifier(&connect_fail_notify, serial_connect_notifier, 0);    add_notifier(&lcp_lowerdown_notify, serial_lcpdown_notifier, 0);    cancelstrref = CFBundleCopyLocalizedString(bundle, CFSTR("Cancel"), CFSTR("Cancel"), NULL);    if (cancelstrref == 0) return 1;    CFStringGetCString(cancelstrref, (char*)cancelstr, sizeof(cancelstr), kCFStringEncodingUTF8);        icstrref = CFBundleCopyLocalizedString(bundle, CFSTR("Network Connection"), CFSTR("Network Connection"), NULL);    if (icstrref == 0) return 1;    CFStringGetCString(icstrref, (char*)icstr, sizeof(icstr), kCFStringEncodingUTF8);        urlref = CFBundleCopyResourceURL(bundle, CFSTR("NetworkConnect.icns"), NULL, NULL);    if (urlref == 0 || ((strref = CFURLGetString(urlref)) == 0)) {		if (urlref)            CFRelease(urlref);        return 1;    }    CFStringGetCString(strref, (char*)iconstr, sizeof(iconstr), kCFStringEncodingUTF8);		iconstrref = CFStringCreateCopy(NULL, strref);    CFRelease(urlref);	urlref = CFBundleCopyBuiltInPlugInsURL(bundle);	if (urlref == 0 || ((CFURLGetFileSystemRepresentation(urlref, TRUE, pathccl, sizeof(pathccl))) == FALSE)) {		if (urlref)            CFRelease(urlref);        return 1;    }    strlcat((char*)pathccl, SUFFIX_CCLENGINE, sizeof(pathccl));    CFRelease(urlref);        // add the socket specific options    add_options(serial_options);    return 0;}
开发者ID:Deanzou,项目名称:ppp,代码行数:59,


示例13: application_path

const String application_path() {    cf::Url url(CFBundleCopyResourcesDirectoryURL(CFBundleGetMainBundle()));    cf::String url_string(CFStringCreateCopy(NULL, CFURLGetString(url.c_obj())));    char path_buffer[PATH_MAX];    if (!CFURLGetFileSystemRepresentation(                url.c_obj(), true, reinterpret_cast<UInt8*>(path_buffer), PATH_MAX)) {        throw Exception("couldn't get application_path()");    }    return String(utf8::decode(path_buffer));}
开发者ID:Mailaender,项目名称:antares,代码行数:10,


示例14: defined

bool Utility::hasLaunchOnStartup(const QString &appName){#if defined(Q_OS_WIN)    QString runPath = QLatin1String(runPathC);    QSettings settings(runPath, QSettings::NativeFormat);    return settings.contains(appName);#elif defined(Q_OS_MAC)    // this is quite some duplicate code with setLaunchOnStartup, at some point we should fix this FIXME.    bool returnValue = false;    QString filePath = QDir(QCoreApplication::applicationDirPath()+QLatin1String("/../..")).absolutePath();    CFStringRef folderCFStr = CFStringCreateWithCString(0, filePath.toUtf8().data(), kCFStringEncodingUTF8);    CFURLRef urlRef = CFURLCreateWithFileSystemPath (0, folderCFStr, kCFURLPOSIXPathStyle, true);    LSSharedFileListRef loginItems = LSSharedFileListCreate(0, kLSSharedFileListSessionLoginItems, 0);    if (loginItems) {        // We need to iterate over the items and check which one is "ours".        UInt32 seedValue;        CFArrayRef itemsArray = LSSharedFileListCopySnapshot(loginItems, &seedValue);        CFStringRef appUrlRefString = CFURLGetString(urlRef); // no need for release        for (int i = 0; i < CFArrayGetCount(itemsArray); i++) {            LSSharedFileListItemRef item = (LSSharedFileListItemRef)CFArrayGetValueAtIndex(itemsArray, i);            CFURLRef itemUrlRef = NULL;            if (LSSharedFileListItemResolve(item, 0, &itemUrlRef, NULL) == noErr) {                CFStringRef itemUrlString = CFURLGetString(itemUrlRef);                if (CFStringCompare(itemUrlString,appUrlRefString,0) == kCFCompareEqualTo) {                    returnValue = true;                }                CFRelease(itemUrlRef);            }        }        CFRelease(itemsArray);    }    CFRelease(loginItems);    CFRelease(folderCFStr);    CFRelease(urlRef);    return returnValue;#elif defined(Q_OS_UNIX)    QString userAutoStartPath = QDir::homePath()+QLatin1String("/.config/autostart/");    QString desktopFileLocation = userAutoStartPath+appName+QLatin1String(".desktop");    return QFile::exists(desktopFileLocation);#endif}
开发者ID:Greyhatno,项目名称:mirall,代码行数:42,


示例15: OpenSession9P

static netfsErrorOpenSession9P(CFURLRef url, void *v, CFDictionaryRef opts,              CFDictionaryRef * info){        CFMutableDictionaryRef dict;        Context9P *ctx;        int useGuest, e;        TRACE();        ctx = v;        if (ctx == NULL || url == NULL || info == NULL            || !CFURLCanBeDecomposed(url))                return EINVAL;        DEBUG("url=%s opts=%s", NetFSCFStringtoCString(CFURLGetString(url)),              NetFSCFStringtoCString(CFCopyDescription(opts)));        *info = dict = CreateDict9P();        if (dict == NULL)                return ENOMEM;        useGuest = FALSE;        if (opts != NULL) {                CFBooleanRef boolean =                    CFDictionaryGetValue(opts, kNetFSUseGuestKey);                if (boolean != NULL)                        useGuest = CFBooleanGetValue(boolean);        }        if (useGuest)                CFDictionarySetValue(dict, kNetFSMountedByGuestKey,                                     kCFBooleanTrue);        else {                ctx->user = CFURLCopyUserName(url);                ctx->pass = CFURLCopyPassword(url);                if (ctx->user == NULL || ctx->pass == NULL) {                        if (ctx->user)                                CFRelease(ctx->user);                        if (ctx->pass)                                CFRelease(ctx->pass);                        ctx->user = ctx->pass = NULL;                        goto error;                }                DEBUG("user=%s pass=%s", NetFSCFStringtoCString(ctx->user),                      NetFSCFStringtoCString(ctx->pass));                CFDictionarySetValue(dict, kNetFSMountedByUserKey, ctx->user);        }        return 0; error:        e = errno;        *info = NULL;        CFRelease(dict);        return e;}
开发者ID:pombredanne,项目名称:9pluto,代码行数:54,


示例16: LSOpenCFURLRef

OSStatus LSOpenCFURLRef(CFURLRef inURL, CFURLRef *outLaunchedURL){	// TODO: use 'xdg-mime query' and 'xdg-mime default' to determine the app?    const char *str = CFStringGetCStringPtr(CFURLGetString(inURL),CFStringGetSystemEncoding());    std::vector<std::string> args;    args.push_back(str);    launchApp(g_scXdgOpenPath,args);    outLaunchedURL = nullptr;	return unimpErr;}
开发者ID:Hasimir,项目名称:darling,代码行数:11,


示例17: CreateCustomToolbarItemPersistentData

//-----------------------------------------------------------------------------//	CreateCustomToolbarItemPersistentData//-----------------------------------------------------------------------------//	This is called when the toolbar is about to write the config for this item//	to preferences. It is your chance to save any extra data with the item. You//	must make sure the data is something that can be saved to XML.//static CFTypeRefCreateCustomToolbarItemPersistentData( CustomToolbarItem* inItem ){	CFTypeRef	result = NULL;	if ( inItem->url )	{		return (CFTypeRef)CFStringCreateCopy( NULL, CFURLGetString( inItem->url ) ); 	}		return result;}
开发者ID:fruitsamples,项目名称:CarbonToolbar,代码行数:19,


示例18: urlFromPath

static bool urlFromPath(CFStringRef path, String& url){    if (!path)        return false;    RetainPtr<CFURLRef> cfURL(AdoptCF, CFURLCreateWithFileSystemPath(0, path, kCFURLWindowsPathStyle, false));    if (!cfURL)        return false;    url = String(CFURLGetString(cfURL.get()));    return true;}
开发者ID:Czerrr,项目名称:ISeeBrowser,代码行数:12,


示例19: CFURLGetString

 URL::operator std::string () {     CF::String str;          if( this->_cfObject == NULL )     {         return str.GetValue();     }          str = CFURLGetString( this->_cfObject );          return str.GetValue(); }
开发者ID:siraj,项目名称:CFPP,代码行数:13,


示例20: CreateDisplayNameForURL

CFStringRefCreateDisplayNameForURL(CFURLRef url){    assert(nullptr != url);    CFStringRef displayName = nullptr;#if !TARGET_OS_IPHONE    CFStringRef scheme = CFURLCopyScheme(url);    if(scheme) {        bool isFileURL = (kCFCompareEqualTo == CFStringCompare(CFSTR("file"), scheme, kCFCompareCaseInsensitive));        CFRelease(scheme), scheme = nullptr;        if(isFileURL) {            OSStatus result = LSCopyDisplayNameForURL(url, &displayName);            if(noErr != result) {                LOGGER_WARNING("org.sbooth.AudioEngine", "LSCopyDisplayNameForURL failed: " << result);                displayName = CFURLCopyLastPathComponent(url);            }        }        else {            displayName = CFURLGetString(url);            CFRetain(displayName);        }    }    // If scheme is nullptr the URL is probably invalid, but can still be logged    else {        displayName = CFURLGetString(url);        CFRetain(displayName);    }#else    displayName = CFURLGetString(url);    CFRetain(displayName);#endif    return displayName;}
开发者ID:Hyacinth,项目名称:SFBAudioEngine,代码行数:38,


示例21: CFBundleGetBundleWithIdentifier

CFStringRef Resources::getResourcesPathFromBundleId() { //@@TODO    char buffer[PATH_MAX];    CFBundleRef bundle = CFBundleGetBundleWithIdentifier(CFSTR("SuperColldierAU") );    if (bundle == NULL) return NULL;    CFURLRef bundleURL = CFBundleCopyBundleURL(bundle);    CFURLGetFileSystemRepresentation(bundleURL, TRUE, (UInt8*)buffer,PATH_MAX);    CFStringRef bundlePath = CFStringCreateWithCString(NULL,buffer, kCFStringEncodingUTF8);    CFURLRef bundleResourcesURL = CFBundleCopyResourcesDirectoryURL(bundle);    CFStringRef resourcesRelativePath = CFURLGetString(bundleResourcesURL);    CFMutableStringRef resourcesPath = CFStringCreateMutable(NULL,0);    CFStringAppend(resourcesPath,bundlePath);    CFStringAppend(resourcesPath,resourcesRelativePath);    return resourcesPath;}
开发者ID:2mc,项目名称:supercollider,代码行数:14,


示例22: CFErrorGetDomain

void ResourceError::platformLazyInit(){    if (m_dataIsUpToDate)        return;    if (!m_platformError)        return;    CFStringRef domain = CFErrorGetDomain(m_platformError.get());    if (domain == kCFErrorDomainMach || domain == kCFErrorDomainCocoa)        m_domain ="NSCustomErrorDomain";    else if (domain == kCFErrorDomainCFNetwork)        m_domain = "CFURLErrorDomain";    else if (domain == kCFErrorDomainPOSIX)        m_domain = "NSPOSIXErrorDomain";    else if (domain == kCFErrorDomainOSStatus)        m_domain = "NSOSStatusErrorDomain";    else if (domain == kCFErrorDomainWinSock)        m_domain = "kCFErrorDomainWinSock";    else        m_domain = domain;    m_errorCode = CFErrorGetCode(m_platformError.get());    RetainPtr<CFDictionaryRef> userInfo = adoptCF(CFErrorCopyUserInfo(m_platformError.get()));    if (userInfo.get()) {        CFStringRef failingURLString = (CFStringRef) CFDictionaryGetValue(userInfo.get(), failingURLStringKey);        if (failingURLString)            m_failingURL = String(failingURLString);        else {            CFURLRef failingURL = (CFURLRef) CFDictionaryGetValue(userInfo.get(), failingURLKey);            if (failingURL) {                RetainPtr<CFURLRef> absoluteURLRef = adoptCF(CFURLCopyAbsoluteURL(failingURL));                if (absoluteURLRef.get()) {                    // FIXME: CFURLGetString returns a normalized URL which is different from what is actually used by CFNetwork.                    // We should use CFURLGetBytes instead.                    failingURLString = CFURLGetString(absoluteURLRef.get());                    m_failingURL = String(failingURLString);                }            }        }        m_localizedDescription = (CFStringRef) CFDictionaryGetValue(userInfo.get(), kCFErrorLocalizedDescriptionKey);        #if PLATFORM(WIN)        m_certificate = wkGetSSLPeerCertificateData(userInfo.get());#endif    }    m_dataIsUpToDate = true;}
开发者ID:3163504123,项目名称:phantomjs,代码行数:50,


示例23: extractQuarantineProperty

void extractQuarantineProperty(const std::string &table_key_name,                               CFTypeRef property,                               const std::string &path,                               QueryData &results) {  std::string value;  if (CFGetTypeID(property) == CFStringGetTypeID()) {    value = stringFromCFString((CFStringRef)property);  } else if (CFGetTypeID(property) == CFDateGetTypeID()) {    auto unix_time = CFDateGetAbsoluteTime((CFDateRef)property) +                     kCFAbsoluteTimeIntervalSince1970;    value = INTEGER(std::llround(unix_time));  } else if (CFGetTypeID(property) == CFURLGetTypeID()) {    value = stringFromCFString(CFURLGetString((CFURLRef)property));  }  setRow(results, path, table_key_name, value);}
开发者ID:1514louluo,项目名称:osquery,代码行数:16,


示例24: QObject

Notificator::Notificator(const QString &programName, QSystemTrayIcon *trayicon, QWidget *parent):    QObject(parent),    parent(parent),    programName(programName),    mode(None),    trayIcon(trayicon)#ifdef USE_DBUS    ,interface(0)#endif{    if(trayicon && trayicon->supportsMessages())    {        mode = QSystemTray;    }#ifdef USE_DBUS    interface = new QDBusInterface("org.freedesktop.Notifications",          "/org/freedesktop/Notifications", "org.freedesktop.Notifications");    if(interface->isValid())    {        mode = Freedesktop;    }#endif#ifdef Q_OS_MAC        printf("notification::begin/n");        // check if users OS has support for NSUserNotification        if( MacNotificationHandler::instance()->hasUserNotificationCenterSupport()) {            printf("notification::has/n");            mode = UserNotificationCenter;        } else {            printf("notification::no/n");            // Check if Growl is installed (based on Qt's tray icon implementation)            CFURLRef cfurl;           OSStatus status = LSGetApplicationForInfo(kLSUnknownType, kLSUnknownCreator, CFSTR("growlTicket"), kLSRolesAll, 0, &cfurl);           if (status != kLSApplicationNotFoundErr) {                CFBundleRef bundle = CFBundleCreate(0, cfurl);                if (CFStringCompare(CFBundleGetIdentifier(bundle), CFSTR("com.Growl.GrowlHelperApp"), kCFCompareCaseInsensitive | kCFCompareBackwards) == kCFCompareEqualTo) {                    if (CFStringHasSuffix(CFURLGetString(cfurl), CFSTR("/Growl.app/")))                    mode = Growl13;                else                    mode = Growl12;                }            CFRelease(cfurl);            CFRelease(bundle);         }    }#endif}
开发者ID:niniwzw,项目名称:macoin,代码行数:47,


示例25: 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,


示例26: CFErrorGetDomain

void ResourceError::platformLazyInit(){    if (m_dataIsUpToDate)        return;    if (!m_platformError)        return;    CFStringRef domain = CFErrorGetDomain(m_platformError.get());    if (domain == kCFErrorDomainMach || domain == kCFErrorDomainCocoa)        m_domain ="NSCustomErrorDomain";    else if (domain == kCFErrorDomainCFNetwork)        m_domain = "CFURLErrorDomain";    else if (domain == kCFErrorDomainPOSIX)        m_domain = "NSPOSIXErrorDomain";    else if (domain == kCFErrorDomainOSStatus)        m_domain = "NSOSStatusErrorDomain";    else if (domain == kCFErrorDomainWinSock)        m_domain = "kCFErrorDomainWinSock";    m_errorCode = CFErrorGetCode(m_platformError.get());    RetainPtr<CFDictionaryRef> userInfo(AdoptCF, CFErrorCopyUserInfo(m_platformError.get()));    if (userInfo.get()) {        CFStringRef failingURLString = (CFStringRef) CFDictionaryGetValue(userInfo.get(), failingURLStringKey);        if (failingURLString)            m_failingURL = String(failingURLString);        else {            CFURLRef failingURL = (CFURLRef) CFDictionaryGetValue(userInfo.get(), failingURLKey);            if (failingURL) {                RetainPtr<CFURLRef> absoluteURLRef(AdoptCF, CFURLCopyAbsoluteURL(failingURL));                if (absoluteURLRef.get()) {                    failingURLString = CFURLGetString(absoluteURLRef.get());                    m_failingURL = String(failingURLString);                }            }        }        m_localizedDescription = (CFStringRef) CFDictionaryGetValue(userInfo.get(), kCFErrorLocalizedDescriptionKey);        #if PLATFORM(WIN)        m_certificate = wkGetSSLPeerCertificateData(userInfo.get());#endif    }    m_dataIsUpToDate = true;}
开发者ID:1833183060,项目名称:wke,代码行数:46,


示例27: urlFromPath

static bool urlFromPath(CFStringRef path, String& url){    if (!path)        return false;    RetainPtr<CFURLRef> cfURL(AdoptCF, CFURLCreateWithFileSystemPath(0, path, kCFURLWindowsPathStyle, false));    if (!cfURL)        return false;    url = CFURLGetString(cfURL.get());    // Work around <rdar://problem/6708300>, where CFURLCreateWithFileSystemPath makes URLs with "localhost".    if (url.startsWith("file://localhost/"))        url.remove(7, 9);    return true;}
开发者ID:azrul2202,项目名称:WebKit-Smartphone,代码行数:17,


示例28: CFURLGetString

void MDSAttrParser::logFileError(	const char *op,	CFURLRef fileUrl,	CFStringRef errStr,		// optional if you have it	SInt32 *errNo)			// optional if you have it{	const char *cerrStr = NULL;	CFStringRef urlStr = CFURLGetString(fileUrl);	const char *cUrlStr = CFStringGetCStringPtr(urlStr, kCFStringEncodingUTF8);		if(errStr) {		cerrStr = CFStringGetCStringPtr(errStr, kCFStringEncodingUTF8);		Syslog::alert("MDS: %s: bundle %s url %s: error %s",			op, mPath, cUrlStr, cerrStr);	}	else {		Syslog::alert("MDS: %s: bundle %s url %s: error %d",			op, mPath, cUrlStr, errNo ? *errNo : 0);	}}
开发者ID:Apple-FOSS-Mirror,项目名称:Security,代码行数:20,


示例29: parseAliasData

/// Parse a Login Items Plist Alias data for bin pathStatus parseAliasData(const std::string& data, std::string& result) {  auto decoded = base64Decode(data);  if (decoded.size() == 0) {    // Base64 encoded data (from plist parsing) failed to decode.    return Status(1, "Failed base64 decode");  }  auto alias = CFDataCreate(      kCFAllocatorDefault, (const UInt8*)decoded.c_str(), decoded.size());  if (alias == nullptr) {    // Failed to create CFData object.    return Status(2, "CFData allocation failed");  }  auto bookmark =      CFURLCreateBookmarkDataFromAliasRecord(kCFAllocatorDefault, alias);  if (bookmark == nullptr) {    CFRelease(alias);    return Status(1, "Alias data is not a bookmark");  }  auto url = CFURLCreateByResolvingBookmarkData(      kCFAllocatorDefault, bookmark, 0, nullptr, nullptr, nullptr, nullptr);  if (url == nullptr) {    CFRelease(alias);    CFRelease(bookmark);    return Status(1, "Alias data is not a URL bookmark");  }  // Get the URL-formatted path.  result = stringFromCFString(CFURLGetString(url));  if (result.substr(0, 7) == "file://") {    result = result.substr(7);  }  CFRelease(alias);  CFRelease(bookmark);  CFRelease(url);  return Status(0, "OK");}
开发者ID:Centurion89,项目名称:osquery,代码行数:41,



注:本文中的CFURLGetString函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ CFUUIDGetUUIDBytes函数代码示例
C++ CFURLGetFileSystemRepresentation函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。