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


C++ NSString::autorelease方法代码示例

本文整理汇总了C++中NSString::autorelease方法的典型用法代码示例。如果您正苦于以下问题:C++ NSString::autorelease方法的具体用法?C++ NSString::autorelease怎么用?C++ NSString::autorelease使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在NSString的用法示例。


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

示例1: ej_getNativeClass

JSValueRef ej_getNativeClass(JSContextRef ctx, JSObjectRef object, JSStringRef propertyNameJS, JSValueRef* exception) {
    size_t classNameSize = JSStringGetMaximumUTF8CStringSize(propertyNameJS);
    char* className = (char*)malloc(classNameSize);
    JSStringGetUTF8CString(propertyNameJS, className, classNameSize);

    JSObjectRef obj = NULL;
    NSString * fullClassName = new NSString();

    NSLOG("ej_getNativeClass : EJBinding%s", className);

    fullClassName->initWithFormat("EJBinding%s",className);
    EJBindingBase* pClass = (EJBindingBase*)NSClassFromString(fullClassName->getCString());
    if( pClass ) {
        obj = JSObjectMake( ctx, ej_constructorClass, (void *)pClass );
    } else {
        NSLOG("%s is NULL ... ", fullClassName->getCString());
    }

    if (obj)
    {
        NSLOG("constructor js-obj for %s", className);
    }

    free(className);
    fullClassName->autorelease();
    return obj ? obj : ej_global_undefined;
}
开发者ID:,项目名称:,代码行数:27,代码来源:

示例2: NSStringToJSValue

EJ_BIND_GET(EJBindingHttpRequest, statusText, ctx) {
    // FIXME: should be "200 OK" instead of just "200"

    NSString *code = new NSString();
    code->autorelease();
    code->initWithFormat("%d", getStatusCode());
    return NSStringToJSValue(ctx, code);
}
开发者ID:Alamantus,项目名称:Ejecta-X,代码行数:8,代码来源:EJBindingHttpRequest.cpp

示例3: beginLoad

void EJBindingImage::beginLoad() {
	// This will begin loading the texture in a background thread and will call the
	// JavaScript onload callback when done
	loading = true;
	
	NSString* sharegroup = new NSString();
	sharegroup->autorelease();
	load(sharegroup);
}
开发者ID:aogilvie,项目名称:Ejecta-X,代码行数:9,代码来源:EJBindingImage.cpp

示例4: fullPathFromRelativePath

const char *CCFileUtils::fullPathFromRelativeFile(const char *pszFilename, const char *pszRelativeFile)
{
	std::string relativeFile = fullPathFromRelativePath(pszRelativeFile);
	NSString *pRet = new NSString();
	pRet->autorelease();
	pRet->m_sString = relativeFile.substr(0, relativeFile.rfind('/')+1);
	pRet->m_sString += pszFilename;
	return pRet->m_sString.c_str();
}
开发者ID:charlesa101,项目名称:cocos2d-x,代码行数:9,代码来源:CCXFileUtils_android.cpp

示例5: fullPathFromRelativePath

const char* CCFileUtils::fullPathFromRelativePath(const char *pszRelativePath)
{
	_CheckPath();

    NSString * pRet = new NSString();
    pRet->autorelease();
    if ((strlen(pszRelativePath) > 1 && pszRelativePath[1] == ':'))
    {
        pRet->m_sString = pszRelativePath;
    }
    else if (strlen(pszRelativePath) > 0 && pszRelativePath[0] == '/')
    {
		char szDriver[3] = {s_pszResourcePath[0], s_pszResourcePath[1], 0};
        pRet->m_sString = szDriver;
        pRet->m_sString += pszRelativePath;
    }
    else
    {
        pRet->m_sString = s_pszResourcePath;
        pRet->m_sString += pszRelativePath;
    }
	return pRet->m_sString.c_str();
}
开发者ID:charlesa101,项目名称:cocos2d-x,代码行数:23,代码来源:CCXFileUtils_win32.cpp

示例6: stringWithString

NSString* NSString::stringWithString(const std::string& pStr)
{
    NSString* pRet = new NSString(pStr);
    pRet->autorelease();
    return pRet;
}
开发者ID:,项目名称:,代码行数:6,代码来源:

示例7: create

NSString* NSString::create(const std::string& str)
{
    NSString* pRet = new NSString(str);
    pRet->autorelease();
    return pRet;
}
开发者ID:,项目名称:,代码行数:6,代码来源:


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