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


C++ utString::c_str方法代码示例

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


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

示例1: lmLog

const char *LoomJni::getPackageName()
{
    static utString packageName;

    if (packageName.size())
    {
        return packageName.c_str();
    }

    loomJniMethodInfo t;

    if (getStaticMethodInfo(t,
        "co/theengine/loomdemo/LoomDemo",
        "getActivityPackageName",
        "()Ljava/lang/String;"))
    {
        jstring str = (jstring)t.getEnv()->CallStaticObjectMethod(t.classID, t.methodID);
        t.getEnv()->DeleteLocalRef(t.classID);
        packageName = jstring2string(str);
        t.getEnv()->DeleteLocalRef(str);

        lmLog(jniLogGroup, "package name %s", packageName.c_str());

        return packageName.c_str();
    }

    return 0;
}
开发者ID:RichardRanft,项目名称:LoomSDK,代码行数:28,代码来源:platformAndroidJni.cpp

示例2:

const char *platform_getWritablePath()
{
    static utString path;

    if (path.size())
    {
        return path.c_str();
    }

    const char *tmp = LoomJni::getPackageName();

    if (!tmp)
    {
        return "";
    }

    // the path is: /data/data/ + package name
    path = "/data/data/";

    if (tmp)
    {
        path += tmp;
    }
    else
    {
        return "";
    }

    return path.c_str();
}
开发者ID:24BitGames,项目名称:LoomSDK,代码行数:30,代码来源:platformFileAndroid.cpp

示例3: checkInWhitelist

// We don't track every file. This function filters potential files.
static bool checkInWhitelist(utString path)
{
    // Note the platform-specific version of our whitelisted folders.
    static utString assetPath = "./assets"; platform_normalizePath(const_cast<char*>(assetPath.c_str()));
    static utString binPath   = "./bin";    platform_normalizePath(const_cast<char*>(binPath.c_str()));
    static utString srcPath   = "./src";    platform_normalizePath(const_cast<char*>(srcPath.c_str()));

    // Just prefix match against assets for now - ignore things in other folders.
    lmLogDebug(gAssetAgentLogGroup, "Whitelisting path %s prefix %s\n", path.c_str(), path.substr(0, 6).c_str());
    platform_normalizePath(const_cast<char*>(path.c_str()));
    if (path.substr(path.length() - 3, 3) == "tmp")
    {
        return false;
    }
    if (path.substr(0, 8) == assetPath)
    {
        return true;
    }
    if (path.substr(0, 5) == srcPath)
    {
        return true;
    }
    if (path.substr(0, 5) == binPath)
    {
        return true;
    }
    return false;
}
开发者ID:Y-way,项目名称:LoomSDK,代码行数:29,代码来源:main.cpp

示例4:

const char *platform_getSettingsPath()
{
    static utString path;

    if (path.size())
    {
        return path.c_str();
    }

    path = LoomJni::getSettingsPath();

    return path.c_str();
}
开发者ID:xuanminhacsi,项目名称:LoomSDK,代码行数:13,代码来源:platformFileAndroid.cpp

示例5: send

 void send()
 {
     if (url == "")
     {
         _OnFailureDelegate.pushArgument("Error: Empty URL");
         _OnFailureDelegate.invoke();
     }
     else
     {
         if (bodyBytes != NULL)
         {
             // Send with body as byte array.
             platform_HTTPSend((const char *)url.c_str(), (const char *)method.c_str(), &HTTPRequest::respond, (void *)this,
                               (const char *)bodyBytes->getInternalArray()->ptr(), bodyBytes->getSize(), header,
                               (const char *)responseCacheFile.c_str(), base64EncodeResponseData, followRedirects);
         }
         else
         {
             // Send with body as string.
             platform_HTTPSend((const char *)url.c_str(), (const char *)method.c_str(), &HTTPRequest::respond, (void *)this,
                               (const char *)body.c_str(), body.length(), header,
                               (const char *)responseCacheFile.c_str(), base64EncodeResponseData, followRedirects);
         }
     }
 }
开发者ID:chengjunjian,项目名称:LoomSDK,代码行数:25,代码来源:lmHTTPRequest.cpp

示例6: generateRootDependenciesRecursive

void LSCompiler::generateRootDependenciesRecursive(const utString& ref)
{
    // We're either going to be compiling against an existing loom assembly
    // or compiling from a build file

    char cref[2048];

    snprintf(cref, 2048, "%s", ref.c_str());
    if (strstr(cref, ".loomlib"))
    {
        *(strstr(cref, ".loomlib")) = 0;
    }

    for (UTsize i = 0; i < rootBuildDependencies.size(); i++)
    {
        BuildInfo *buildInfo = rootBuildDependencies.at(i);
        if (buildInfo->getAssemblyName() == cref)
        {
            return;
        }
    }

    // first look in the src folders for an existing build file
    BuildInfo *buildInfo = loadBuildFile(cref);

    if (buildInfo)
    {
        utString  assemblyLib = buildInfo->getOutputDir() + platform_getFolderDelimiter() + buildInfo->getAssemblyName() + ".loomlib";

        // If the assembly is not built yet, build it
        if (!platform_mapFileExists(assemblyLib.c_str()))
        {
            for (UTsize i = 0; i < buildInfo->getNumReferences(); i++)
            {
                utString rref = buildInfo->getReference(i);
                generateRootDependenciesRecursive(rref);
            }

            rootBuildDependencies.push_back(buildInfo);
        }
        else
        {
            rootLibDependencies.push_back(ref);
        }
    }

    if (rootDependencies.find(ref) == UT_NPOS)
    {
        if (!buildInfo)
        {
            // we're compiling against a .loomlib and won't be rebuilding it
            rootLibDependencies.push_back(ref);
        }

        rootDependencies.push_back(ref);
    }
}
开发者ID:RichardRanft,项目名称:LoomSDK,代码行数:57,代码来源:lsCompiler.cpp

示例7: invokeStaticMethod

void LSLuaState::invokeStaticMethod(const utString& typePath,
                                    const char *methodName, int numParameters)
{
    Type *type = getType(typePath.c_str());

    lmAssert(type, "LSLuaState::invokeStaticMethod unknown type: %s", typePath.c_str());

    MemberInfo *member = type->findMember(methodName);
    lmAssert(member, "LSLuaState::invokeStaticMethod unknown member: %s:%s", typePath.c_str(), methodName);
    if (!member->isMethod())
    {
        lmAssert(0, "LSLuaState::invokeStaticMethod member: %s:%s is not a method", typePath.c_str(), methodName);
    }

    MethodInfo *method = (MethodInfo *)member;

    lmAssert(method->isStatic(), "LSLuaState::invokeStaticMethod member: %s:%s is not a static method", typePath.c_str(), methodName);

    method->invoke(NULL, numParameters);
}
开发者ID:Bewolf2,项目名称:LoomSDK,代码行数:20,代码来源:lsLuaState.cpp

示例8: writeToFile

void AssemblyWriter::writeToFile(const utString& filename)
{
    utString out;

    writeToString(out);

    // ... and write it
    utFileStream fs;

    fs.open(filename.c_str(), utStream::SM_WRITE);

    if (fs.isOpen())
    {
        fs.write(out.c_str(), (int)out.size());

        fs.close();
    }
    else
    {
        LSError("Could not write to %s", filename.c_str());
    }
}
开发者ID:RichardRanft,项目名称:LoomSDK,代码行数:22,代码来源:lsAssemblyWriter.cpp

示例9: lmLog

const char *LoomJni::getSettingsPath()
{
    static utString path;

    loomJniMethodInfo t;

    if (getStaticMethodInfo(t,
        "co/theengine/loomplayer/LoomPlayer",
        "getActivitySettingsPath",
        "()Ljava/lang/String;"))
    {
        jstring str = (jstring)t.getEnv()->CallStaticObjectMethod(t.classID, t.methodID);
        path = jstring2string(str);
        t.getEnv()->DeleteLocalRef(str);

        lmLog(jniLogGroup, "settings path %s", path.c_str());

        return path.c_str();
    }

    return 0;
}
开发者ID:Y-way,项目名称:LoomSDK,代码行数:22,代码来源:platformAndroidJni.cpp

示例10: initCodeState

void TypeCompiler::initCodeState(CodeState *codeState, FuncState *funcState,
                                 const utString& source)
{
    memset(codeState, 0, sizeof(CodeState));
    memset(funcState, 0, sizeof(FuncState));

    codeState->L      = vm->VM();
    codeState->source = luaS_new(vm->VM(), source.c_str());

    BC::openFunction(codeState, funcState);

    /* main func. is always vararg */
    funcState->f->is_vararg = VARARG_ISVARARG;
}
开发者ID:bagobor,项目名称:TinyLS,代码行数:14,代码来源:lsTypeCompiler.cpp

示例11: GetSDKPathFromLSCPath

utString GetSDKPathFromLSCPath(utString const& lscPath)
{
    char lsc[2048];
    snprintf(lsc, 2048, "%s", lscPath.c_str());

    // Slurp off the filename...
    unsigned int len = strlen(lsc) - 1;
    while (len-- > 0)
    {
        if ((lsc[len] == '\\') || (lsc[len] == '/'))
        {
            lsc[len + 1] = '\0';
            break;
        }
    }

    // And go up the directories until we find one with "lib" in it...
    // But shouldn't be more than 3
    bool found = false;
    for (int i = 0; i <= 3; i++)
    {
        utString searchLib(lsc);
        searchLib += "libs";
        if (platform_dirExists(searchLib.c_str()) == 0)
        {
            found = true;
            break;
        }
        while (len-- > 0)
        {
            if ((lsc[len] == '\\') || (lsc[len] == '/'))
            {
                lsc[len + 1] = '\0'; // This won't cause a buffer overrun because
                                        // we already ate backwards in the previous loop.
                                        // But we do need to preserve the trailing slash.
                break;
            }
        }
    }

    if (!found)
    {
        printf("Unable to find SDK libraries somewhere inside %s\n", lsc);
        exit(EXIT_FAILURE);
    }

    return utString(lsc);
}
开发者ID:xuanminhacsi,项目名称:LoomSDK,代码行数:48,代码来源:main.cpp

示例12: instate

   // Instate new bits/type to the asset.
   void instate(int _type, void *bits, LoomAssetCleanupCallback dtor)
   {
      // Swap in a new blob.
      if(blob)
         blob->decRef();
      blob = lmNew(gAssetAllocator) loom_assetBlob_t();
      blob->incRef();

      blob->bits = bits;
      blob->dtor = dtor;

      // Update the type.
      type = _type;

      // We're by definition loaded at this point.
      state = loom_asset_t::Loaded;

      // Fire subscribers.
      loom_asset_notifySubscribers(name.c_str());
   }
开发者ID:RichardRanft,项目名称:LoomSDK,代码行数:21,代码来源:assets.cpp

示例13: loadFile

void akBLoader::loadFile(const utString &filename, bool sortByMat, bool openglVertexColor)
{
	fbtBlend fp;

	if (fp.parse(filename.c_str(), fbtFile::PM_COMPRESSED) != fbtFile::FS_OK)
	{
		return;
	}
	
	// current scne
	Blender::Scene* bscene = fp.m_fg->curscene;
	
	//animations
	akAnimationLoader animLoader(m_demo);
	animLoader.convertActions(fp.m_action, fp.getVersion() <= 249, bscene->r.frs_sec);
	
	//convert camera
	convertCameraObject(bscene->camera);
	
	//objects of the active scene
	for (Blender::Base* base = (Blender::Base*)bscene->base.first; base; base = base->next)
	{
		if (!base->object)
			continue;

		Blender::Object* bobj = base->object;

		// test for usable object type
		if(bobj->type == OB_MESH)
		{
			convertObjectMesh(bobj);
			
			akEntity* entity = m_demo->getEntity(AKB_IDNAME(bobj));
			animLoader.convertObject(entity, bobj, fp.getVersion() <= 249, bscene->r.frs_sec);
		}
	}
}
开发者ID:Kelloggs,项目名称:experiments,代码行数:37,代码来源:akBLoader.cpp

示例14: parseApplicationConfig

// this will always be in assets/loom.config (unless we decide to move it)
void LoomApplicationConfig::parseApplicationConfig(const utString& jsonString)
{
    configJSON = jsonString;

    // verify config is valid JSON

    json_error_t jerror;
    json_t       *json = json_loadb(jsonString.c_str(), jsonString.length(), 0, &jerror);

    lmAssert(json, "LoomApplicationConfig::parseApplicationConfig() error parsing application config %s\n %s %i\n", jerror.source, jerror.text, jerror.line);

    if (json_t *wfaa = json_object_get(json, "waitForAssetAgent"))
    {
        _waitForAssetAgent = _jsonParseInt("waitForAssetAgent", wfaa);
    }

    if (json_t *ah = json_object_get(json, "assetAgentHost"))
    {
        if (!json_is_string(ah))
        {
            lmLog(gLoomApplicationConfigLogGroup, "assetAgentHost was specified but is not a string!");
        }
        else
        {
            assetHost = json_string_value(ah);
        }
    }

    if (json_t *ap = json_object_get(json, "assetAgentPort"))
    {
        assetPort = _jsonParseInt("assetAgentPort", ap);
    }

    const char *v = json_string_value(json_object_get(json, "version"));
    if (v != NULL)
    {
        _version = v;
    }

    const char *app_id = json_string_value(json_object_get(json, "app_id"));
    if (app_id != NULL)
    {
        _applicationId = app_id;
    }

    // Parse log block.
    if (json_t *logBlock = json_object_get(json, "log"))
    {
        // Walk the children.
        const char *key;
        json_t     *value;

        json_object_foreach(logBlock, key, value)
        {
            // Key is the prefix for the rule.
            // Maybe we have level or enabled data?
            int enabledRule = -1;
            int filterRule  = -1;

            if (json_t *enabledBlock = json_object_get(value, "enabled"))
            {
                enabledRule = _jsonParseBool("log.enabled", value);
            }

            // TODO: Allow info, warn, error as parameters here.
            if (json_t *levelBlock = json_object_get(value, "level"))
            {
                filterRule = (int)json_integer_value(levelBlock);
            }

            loom_log_addRule(key, enabledRule, filterRule);
        }
    }
开发者ID:RichardRanft,项目名称:LoomSDK,代码行数:74,代码来源:applicationConfig.cpp

示例15: handleMessage

    virtual bool handleMessage(int fourcc, AssetProtocolHandler *handler, NetworkBuffer& buffer)
    {
        switch (fourcc)
        {
        case LOOM_FOURCC('F', 'I', 'L', 'E'):
           {
               // How many pending files?
               gPendingFiles = buffer.readInt();
               loom_asset_notifyPendingCountChange();

               // Read the filename.
               char *path;
               int  fileStringLength;
               buffer.readString(&path, &fileStringLength);

               // And the file length.
               int bitsLength = buffer.readInt();

               // Checkpoint at end!
               buffer.readCheckpoint(0xDEADBEE3);

               // Prepare the buffer!
               if (pendingFile != NULL)
               {
                   lmLogError(gAssetLogGroup, "Got a new FILE '%s' while still processing existing file '%s'!", path, pendingFilePath.c_str());
                   wipePendingData();
               }

               // Update the pending file state.
               pendingFilePath = path;
               lmFree(NULL, path);
               path = NULL;

               pendingFileLength = bitsLength;
               pendingFile       = (const char *)lmAlloc(gAssetAllocator, pendingFileLength);

               // Log it.
               lmLogDebug(gAssetLogGroup, "FILE '%s' %d bytes incoming.", pendingFilePath.c_str(), bitsLength);

               // Awesome, sit back and wait for chunks to come in.
               return true;
           }

        case LOOM_FOURCC('F', 'C', 'H', 'K'):
           {
               // How many pending files?
               gPendingFiles = buffer.readInt();
               loom_asset_notifyPendingCountChange();

               // Get the offset.
               int chunkOffset = buffer.readInt();

               // Read bits into the buffer.
               char *fileBits;
               int  fileBitsLength;
               buffer.readString(&fileBits, &fileBitsLength);
               memcpy((void *)(pendingFile + chunkOffset), (void *)fileBits, fileBitsLength);
               lmFree(NULL, fileBits);

               // Checkpoint at end!
               buffer.readCheckpoint(0xDEADBEE2);

               int lastByteOffset = chunkOffset + fileBitsLength;

               // Log it.
               lmLogDebug(gAssetLogGroup, "FILE '%s' %d of %d bytes!", pendingFilePath.c_str(), lastByteOffset, pendingFileLength);

               // If it's the last one, instate it and wipe our buffer.
               if (lastByteOffset == pendingFileLength)
               {
                   // And this resolves a file so decrement the pending count. This way
                   // we will get to zero.
                   gPendingFiles--;
                   loom_asset_notifyPendingCountChange();

                   // Instate the new asset data.
                   loom_asset_t *asset    = loom_asset_getAssetByName(pendingFilePath.c_str(), 1);
                   int          assetType = loom_asset_recognizeAssetTypeFromPath(pendingFilePath);
                   if (assetType == 0)
                   {
                       lmLogDebug(gAssetLogGroup, "Couldn't infer file type for '%s', ignoring.", pendingFilePath.c_str());
                       wipePendingData();
                       return true;
                   }

                   lmLogWarn(gAssetLogGroup, "Applying new version of '%s', %d bytes.", pendingFilePath.c_str(), pendingFileLength);
                   LoomAssetCleanupCallback dtor = NULL;
                   void *assetBits = loom_asset_deserializeAsset(pendingFilePath.c_str(), assetType, pendingFileLength, (void *)pendingFile, &dtor);
                   asset->instate(assetType, assetBits, dtor);

                   // And wipe the pending date.
                   wipePendingData();
               }
         }

         return true;
      }

    return false;
    }
开发者ID:RichardRanft,项目名称:LoomSDK,代码行数:100,代码来源:assets.cpp


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