当前位置: 首页>>代码示例>>C++>>正文


C++ CFURLGetString函数代码示例

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


在下文中一共展示了CFURLGetString函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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,代码来源:parse_url.c

示例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 OSStatus
InitializeCustomToolbarItem( 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,代码来源:CustomToolbarItem.c

示例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,代码来源:GeneratePreviewForURL.c

示例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,代码来源:CFXMLTree.c

示例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,代码来源:SecImportExportUtils.cpp

示例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,代码来源:Logger.cpp

示例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,代码来源:UserObjectImp.cpp

示例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,代码来源:WebInspectorProxyWin.cpp

示例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,代码来源:WebInspectorProxyWin.cpp

示例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,代码来源:firewall.cpp

示例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,代码来源:ArgumentCodersCF.cpp

示例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,代码来源:main.c

示例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,代码来源:resource.cpp

示例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,代码来源:utility.cpp

示例15: OpenSession9P

static netfsError
OpenSession9P(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,代码来源:plugin.c


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