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


C++ behaviac::vector类代码示例

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


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

示例1: BEHAVIAC_UNUSED_VAR

	void CFileSystem::GetModifiedFiles(behaviac::vector<behaviac::string>& modifiedFiles)
	{
		BEHAVIAC_UNUSED_VAR(modifiedFiles);
#if BEHAVIAC_COMPILER_GCC_LINUX
		modifiedFiles.clear();

		if (s_ModifiedFiles.empty())
		{
			return;
		}

		behaviac::ScopedLock lock(s_mutex);
		std::sort(s_ModifiedFiles.begin(), s_ModifiedFiles.end());
		s_ModifiedFiles.erase(std::unique(s_ModifiedFiles.begin(), s_ModifiedFiles.end()), s_ModifiedFiles.end());

		s_ModifiedFiles.swap(modifiedFiles);
		//for (behaviac::vector<behaviac::string>::iterator it = s_ModifiedFiles.begin(); it != s_ModifiedFiles.end(); ++it)
		//{
		//	behaviac::string& s = *it;

		//	modifiedFiles.push_back(s);
		//}    

		//s_ModifiedFiles.clear();
#endif
	}
开发者ID:LacusCon,项目名称:behaviac,代码行数:26,代码来源:filesystem_gcc.cpp

示例2: ConvertTextBufferAsStringArray

	void ConvertTextBufferAsStringArray(const char* buffer, behaviac::vector<behaviac::string>& stringArray)
	{
		BEHAVIAC_ASSERT(buffer);
		const char* lineBuffer = buffer;

		while (*lineBuffer != '\0')
		{
			const char* currentPos = lineBuffer;

			while (*currentPos != '\n' && *currentPos != '\r' && *currentPos != '\0')
			{
				currentPos++;
			}

			behaviac::string line;
			line.assign(lineBuffer, currentPos - lineBuffer);
			stringArray.push_back(line);

			while (*currentPos == '\n' || *currentPos == '\r')
			{
				currentPos++;
			}

			lineBuffer = currentPos;
		}
	}
开发者ID:1414648814,项目名称:behaviac,代码行数:26,代码来源:textfile.cpp

示例3: load

		virtual void load(const char* instance, behaviac::vector<behaviac::string>& paramStrs)
		{
			BEHAVIAC_ASSERT(paramStrs.size() == 1);

			behaviac::StringUtils::StringCopySafe(kInstanceNameMax, _instance, instance);
			_param0 = AgentMeta::TParseProperty<IList >(paramStrs[0].c_str());
		}
开发者ID:liudequ,项目名称:behaviac,代码行数:7,代码来源:behaviac_agent_meta.cpp

示例4: EndCall

void CScriptSystem::EndCall(behaviac::vector<behaviac::string>& array)
{
    if (m_nTempArg == -1)
    {
        return;
    }

    if (ExecuteFunction(m_pLS, m_nTempArg, 1))
    {
        if (lua_istable(m_pLS, -1))
        {
            int top = lua_gettop(m_pLS);
            lua_pushnil(m_pLS);  // first key

            while (lua_next(m_pLS, top) != 0)
            {
                // `key' is at index -2 and `value' at index -1
                const char* value = lua_tostring(m_pLS, -1);
                array.push_back(value);
                lua_pop(m_pLS, 1); // pop value, leave index.
            }
        }

        lua_pop(m_pLS, 1);
    }

    // Check for LUA stack corruption
    CheckStackOnEndCall();
}
开发者ID:CodeBees,项目名称:behaviac,代码行数:29,代码来源:scriptsystem.cpp

示例5: ParseForParams

    //suppose params are seprated by ','
    static void ParseForParams(const behaviac::string& tsrc, behaviac::vector<behaviac::string>& params)
    {
        int tsrcLen = (int)tsrc.size();
        int startIndex = 0;
        int index = 0;
        int quoteDepth = 0;

        for (; index < tsrcLen; ++index)
        {
            if (tsrc[index] == '"')
            {
                quoteDepth++;

                //if (quoteDepth == 1)
                //{
                //	startIndex = index;
                //}

                if ((quoteDepth & 0x1) == 0)
                {
                    //closing quote
                    quoteDepth -= 2;
                    BEHAVIAC_ASSERT(quoteDepth >= 0);
                }
            }
            else if (quoteDepth == 0 && tsrc[index] == ',')
            {
                //skip ',' inside quotes, like "count, count"
                int lengthTemp = index - startIndex;
                behaviac::string strTemp = tsrc.substr(startIndex, lengthTemp);
                params.push_back(strTemp);
                startIndex = index + 1;
            }
        }//end for

        // the last param
        int lengthTemp = index - startIndex;

        if (lengthTemp > 0)
        {
            behaviac::string strTemp = tsrc.substr(startIndex, lengthTemp);
            params.push_back(strTemp);

            //params.push_back(strTemp);
        }
    }
开发者ID:Evilcoolkings,项目名称:behaviac,代码行数:47,代码来源:action.cpp

示例6: findFiles

	void CFileSystem::findFiles(const char* fileName, behaviac::vector<behaviac::string>& fileList,
		bool giveFiles, bool giveDirectories, bool recursive, int maximumSize, bool keepCase)
	{
		BEHAVIAC_ASSERT(fileName);
		CCounterFileSystemVisitor counterVisitor(maximumSize);
		Visit(counterVisitor, fileName, giveFiles, giveDirectories, recursive);
		fileList.reserve(counterVisitor.GetCount());
		CVectorFileSystemVisitor vectorVisitor(fileList, recursive, maximumSize, keepCase);
		Visit(vectorVisitor, fileName, giveFiles, giveDirectories, recursive);
	}
开发者ID:LacusCon,项目名称:behaviac,代码行数:10,代码来源:filesystem_gcc.cpp

示例7: ListFiles_android

	void ListFiles_android(behaviac::vector<behaviac::string>& files, const char* szDirName, bool bRecurrsive)
	{
        AAssetManager* mgr = behaviac::CFileManager::GetInstance()->GetAssetManager();
		if (mgr != NULL)
		{
			const char* validDir = szDirName;
            //skip "assets:/"
			if (behaviac::StringUtils::StartsWith(validDir, "assets:/"))
			{
				validDir = validDir + 8;
			}

			AAssetDir* dir = AAssetManager_openDir(mgr, validDir);
			if (dir != NULL)
			{
				bool bEndsWithSlash = behaviac::StringUtils::EndsWith(szDirName, "/");
				if (!bEndsWithSlash)
				{
					bEndsWithSlash = behaviac::StringUtils::EndsWith(szDirName, "\\");
				}

				while (true)
				{
					const char* fileName = AAssetDir_getNextFileName(dir);
					if (fileName == NULL)
					{
						break;
					}

                    if (bEndsWithSlash)
					{
						fileName = behaviac::FormatString("%s%s", szDirName, fileName);
					}
					else
					{
						fileName = behaviac::FormatString("%s/%s", szDirName, fileName);
					}

					files.push_back(fileName);
				}

				AAssetDir_close(dir);
			}
		}
	}
开发者ID:czfsvn,项目名称:LinuxC,代码行数:45,代码来源:filesystem_gcc.cpp

示例8: ParseProperty

    //[property] WorldState::WorldState int WorldState::time->185606213
    //[property] Ship::Ship_2_3 long GameObject::age->91291
    //[property] Ship::Ship_2_3 bool par_a->true
    void Workspace::ParseProperty(const behaviac::vector<behaviac::string>& tokens)
    {
        BEHAVIAC_UNUSED_VAR(tokens);
#if !BEHAVIAC_RELEASE
        const behaviac::string& agentName = tokens[1];
        Agent* pAgent = Agent::GetAgent(agentName.c_str());

        //pAgent could be 0
        if (pAgent && tokens.size() == 4)
        {
            //const behaviac::string& varTypeName = tokens[2];
            const behaviac::string& varNameValue = tokens[3];

            behaviac::string::size_type posb = varNameValue.find("->");
            BEHAVIAC_ASSERT(posb != behaviac::string::npos);

            if (posb != behaviac::string::npos)
            {
                behaviac::string::size_type size = behaviac::string::npos;
                //varNameValue is the last one with '\n'
                behaviac::string::size_type pose = varNameValue.find('\n');

                if (pose != behaviac::string::npos)
                {
                    size = pose - posb - 1;
                }

                behaviac::string varName = varNameValue.substr(0, posb);
                behaviac::string varValue = varNameValue.substr(posb + 2, size);

                if (pAgent)
                {
                    pAgent->SetVariableFromString(varName.c_str(), varValue.c_str());
                }//end of if (pAgent)
            }
        }

#endif
    }
开发者ID:LacusCon,项目名称:behaviac,代码行数:42,代码来源:workspace.cpp

示例9: SelectorUpdate

    EBTStatus Selector::SelectorUpdate(Agent* pAgent, EBTStatus childStatus, int& activeChildIndex, behaviac::vector<BehaviorTask*>& children)
    {
        EBTStatus s = childStatus;
        int childSize = (int)children.size();

        for (;;)
        {
            BEHAVIAC_ASSERT(activeChildIndex < childSize);

            if (s == BT_RUNNING)
            {
                BehaviorTask* pBehavior = children[activeChildIndex];

				if (this->CheckIfInterrupted(pAgent))
				{
					return BT_FAILURE;
				}

                s = pBehavior->exec(pAgent);
            }

            // If the child fails, or keeps running, do the same.
            if (s != BT_FAILURE)
            {
                return s;
            }

            // Hit the end of the array, job done!
            ++activeChildIndex;

            if (activeChildIndex >= childSize)
            {
                return BT_FAILURE;
            }

            s = BT_RUNNING;
        }
    }
开发者ID:1414648814,项目名称:behaviac,代码行数:38,代码来源:selector.cpp

示例10: BEHAVIAC_UNUSED_VAR


//.........这里部分代码省略.........
    }

    bool CFileSystem::Move(const char* srcFullPath, const char* destFullPath) {
        BEHAVIAC_UNUSED_VAR(srcFullPath);
        BEHAVIAC_UNUSED_VAR(destFullPath);

        BEHAVIAC_ASSERT(0);
        return false;
    }

    void CFileSystem::MakeSureDirectoryExist(const char* filename) {
        const int kMAX_PATH = 260;
        char directory[kMAX_PATH];
        string_cpy(directory, filename);
        char* iter = directory;

        mode_t  old = umask(0);

        while (*iter != 0) {
            if (*iter == '\\' || *iter == '/') {
                char c = *iter;
                *iter = 0;
                mkdir(directory, S_IWUSR);
                *iter = c;
            }

            iter++;
        }

        umask(old);
    }

#if BEHAVIAC_CCDEFINE_ANDROID && (BEHAVIAC_CCDEFINE_ANDROID_VER > 8)
	void ListFiles_android(behaviac::vector<behaviac::string>& files, const char* szDirName, bool bRecurrsive)
	{
        AAssetManager* mgr = behaviac::CFileManager::GetInstance()->GetAssetManager();
		if (mgr != NULL)
		{
			const char* validDir = szDirName;
            //skip "assets:/"
			if (behaviac::StringUtils::StartsWith(validDir, "assets:/"))
			{
				validDir = validDir + 8;
			}

			AAssetDir* dir = AAssetManager_openDir(mgr, validDir);
			if (dir != NULL)
			{
				bool bEndsWithSlash = behaviac::StringUtils::EndsWith(szDirName, "/");
				if (!bEndsWithSlash)
				{
					bEndsWithSlash = behaviac::StringUtils::EndsWith(szDirName, "\\");
				}

				while (true)
				{
					const char* fileName = AAssetDir_getNextFileName(dir);
					if (fileName == NULL)
					{
						break;
					}

                    if (bEndsWithSlash)
					{
						fileName = behaviac::FormatString("%s%s", szDirName, fileName);
					}
开发者ID:czfsvn,项目名称:LinuxC,代码行数:67,代码来源:filesystem_gcc.cpp

示例11: StopMonitoringDirectory

    void CFileSystem::StopMonitoringDirectory() {
#if BEHAVIAC_CCDEFINE_GCC_LINUX

        if (!s_bThreadFinish) {
            s_bThreadFinish = true;

            pthread_join(s_tid, 0);

            s_ModifiedFiles.clear();
        }

#endif
    }
开发者ID:czfsvn,项目名称:LinuxC,代码行数:13,代码来源:filesystem_gcc.cpp

示例12: ThreadFunc

	static void* ThreadFunc(void* arg)
	{
		bool isLock = false;
		const char* path = (char*)arg;
		InotifyDir inotify;
		InotifyDir::Event ev;

		inotify.init();
		inotify.Watch(path);

		while (!s_bThreadFinish)
		{
			if (!inotify.EventPoll(ev))
			{
				if (isLock)
				{
					isLock = false;
					s_mutex.Unlock();
				}

				usleep(100);
				continue;
			}

			if (!isLock)
			{
				isLock = true;
				s_mutex.Lock();
			}

			if (ev.type == InotifyDir::MODIFY || ev.type == InotifyDir::ADD)
			{
				ev.name.erase(0, strlen(path));
				s_ModifiedFiles.push_back(ev.name.c_str());
			}
		}

		if (isLock)
		{
			isLock = false;
			s_mutex.Unlock();
		}

		return NULL;
	}
开发者ID:LacusCon,项目名称:behaviac,代码行数:45,代码来源:filesystem_gcc.cpp


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