本文整理汇总了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;
}
示例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);
}
示例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);
}
示例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();
}
示例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();
}
示例6: stringWithString
NSString* NSString::stringWithString(const std::string& pStr)
{
NSString* pRet = new NSString(pStr);
pRet->autorelease();
return pRet;
}
示例7: create
NSString* NSString::create(const std::string& str)
{
NSString* pRet = new NSString(str);
pRet->autorelease();
return pRet;
}