• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ core::string类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: InjectCommand

core::string VTSharedMemoryImpl::InjectCommand(const core::string& cmd, const core::string& args)
{
	if (!m_data->agent->data)
		return "";
	if (cmd.equals_ignore_case("calib"))
	{
		m_data->agent->data->status.calibration = true;
		m_data->agent->data->status.finger_calibrate = true;
		Update(0.01f);
		Sleep(20);
		m_data->agent->data->status.finger_calibrate = false;
		m_data->agent->data->status.calibration = false;
		return "done";
	}
	if (cmd.equals_ignore_case("done?"))
	{
		if (args.equals_ignore_case("glove"))
		{
			return "no";
		}
		if (args.equals_ignore_case("posture"))
		{
			return "no";
		}
	}
	return "";
}
开发者ID:yingzhang536,项目名称:mrayy-Game-Engine,代码行数:27,代码来源:VTSharedMemory.cpp


示例2: changeWorkingDirectoryTo

//! Changes the current Working Directory to the given string.
bool CFileSystem::changeWorkingDirectoryTo(const core::string<c16>& newDirectory)
{
	bool success=false;

	if (FileSystemType != FILESYSTEM_NATIVE)
	{
		WorkingDirectory[FILESYSTEM_VIRTUAL].append(newDirectory);
		flattenFilename(WorkingDirectory[FILESYSTEM_VIRTUAL], "");
		success = 1;
	}
	else
	{
		WorkingDirectory[FILESYSTEM_NATIVE] = newDirectory;

#if defined(_IRR_USE_WINDOWS_CE_DEVICE_)
		success = true;
#elif defined(_MSC_VER)
	#if defined(_IRR_WCHAR_FILESYSTEM)
		success=(_wchdir(newDirectory.c_str()) == 0);
	#else
		success=(_chdir(newDirectory.c_str()) == 0);
	#endif
#else
		success=(chdir(newDirectory.c_str()) == 0);
#endif
	}

	return success;
}
开发者ID:harmboschloo,项目名称:CocaProject,代码行数:30,代码来源:CFileSystem.cpp


示例3: re_key

void Sqlite::re_key(core::string const& key)
{
    if (key.length())
        sqlite3_rekey(d_ptr->db, key.c_str(), key.length());
    else
        sqlite3_rekey(d_ptr->db, NULL, 0);
}
开发者ID:imace,项目名称:nnt,代码行数:7,代码来源:Sqlite+NNT.cpp


示例4: getZzipError

const mchar* getZzipError(zzip_error_t zzipError) 
{
	static core::string errorMsg;
    switch (zzipError)
    {
    case ZZIP_NO_ERROR:
        break;
    case ZZIP_OUTOFMEM:
        errorMsg = mT("Out of memory.");
        break;            
    case ZZIP_DIR_OPEN:
    case ZZIP_DIR_STAT: 
    case ZZIP_DIR_SEEK:
    case ZZIP_DIR_READ:
        errorMsg = mT("Unable to read zip file.");
        break;            
    case ZZIP_UNSUPP_COMPR:
        errorMsg = mT("Unsupported compression format.");
        break;            
    case ZZIP_CORRUPTED:
        errorMsg = mT("Corrupted archive.");
        break;            
    default:
        errorMsg = mT("Unknown error.");
        break;            
    };

    return errorMsg.c_str();
}
开发者ID:yingzhang536,项目名称:mrayy-Game-Engine,代码行数:29,代码来源:CZipArchive.cpp


示例5: alphabetflow_prev

core::string AlphabetFlow::prevValue(const core::string & value)
{
    char *ret = alphabetflow_prev(value.c_str(), (uint)value.length());
    core::string str = ret;
    free(ret);
    return str;   
}
开发者ID:imace,项目名称:nnt,代码行数:7,代码来源:AlphabetFlow.cpp


示例6: canWrite

bool mdlWriter::canWrite(const core::string& fileName)
{
	int i=fileName.findlast('.');
	if(i==-1)
		return false;
	core::string s= fileName.substr(i+1,m_extension.length());
	return s.equals_ignore_case(m_extension);
}
开发者ID:yingzhang536,项目名称:mrayy-Game-Engine,代码行数:8,代码来源:mdlWriter.cpp


示例7:

//! returns the directory part of a filename, i.e. all until the first
//! slash or backslash, excluding it. If no directory path is prefixed, a '.'
//! is returned.
core::string<c16> CFileSystem::getFileDir(const core::string<c16>& filename) const
{
	// find last forward or backslash
	s32 lastSlash = filename.findLast('/');
	const s32 lastBackSlash = filename.findLast('\\');
	lastSlash = lastSlash > lastBackSlash ? lastSlash : lastBackSlash;

	if ((u32)lastSlash < filename.size())
		return filename.subString(0, lastSlash);
	else
		return ".";
}
开发者ID:harmboschloo,项目名称:CocaProject,代码行数:15,代码来源:CFileSystem.cpp


示例8: OpenByName

bool OFSerialPort::OpenByName(const core::string& port,int baudRate)
{
	if(m_open)
		Close();
	m_open=m_sp->setup(port.c_str(),baudRate);
	return m_open;
}
开发者ID:yingzhang536,项目名称:mrayy-Game-Engine,代码行数:7,代码来源:OFSerialPort.cpp


示例9: open

bool open(core::string const& file)
{
    this->close();
    
    fd.open(file.c_str(), ::std::ios_base::app | ::std::ios_base::out);
    if (!fd.is_open())
        return false;
    
    // open.
    appender = new log4cpp::OstreamAppender(file.c_str(), &fd);        
    log4cpp::PatternLayout* layout = new log4cpp::PatternLayout;
    layout->setConversionPattern("%d: %p %c %x: %m%n");
    appender->setLayout(layout);
    category->addAppender(appender);
    
    return true;
}
开发者ID:imace,项目名称:nnt,代码行数:17,代码来源:Logger+NNT.cpp


示例10: getcwd

core::string Environment::workingDirectory()
{
    if (__preferred_workingdirectory.empty() == false)
        return __preferred_workingdirectory;

    char* path = (char*)malloc(PATH_MAX);
    core::string ret = getcwd(path, PATH_MAX);
    free(path);
    ret = core::dot(ret);
    return ret;
}
开发者ID:imace,项目名称:nnt,代码行数:11,代码来源:App.cpp


示例11: existFile

//! determines if a file exists and would be able to be opened.
bool CFileSystem::existFile(const core::string<c16>& filename) const
{
	for (u32 i=0; i < FileArchives.size(); ++i)
		if ( FileArchives[i]->findFile(filename)!=-1)
			return true;

#if defined ( _IRR_WCHAR_FILESYSTEM )
	FILE* f = _wfopen(filename.c_str(), L"rb");
#else
	FILE* f = fopen(filename.c_str(), "rb");
#endif

	if (f)
	{
		fclose(f);
		return true;
	}

	_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
	return false;
}
开发者ID:harmboschloo,项目名称:CocaProject,代码行数:22,代码来源:CFileSystem.cpp


示例12: defined

core::string<c16> CFileSystem::getAbsolutePath(const core::string<c16>& filename) const
{
	c16 *p=0;

#if defined(_IRR_USE_WINDOWS_CE_DEVICE_)
	return filename;
#elif defined(_IRR_WINDOWS_API_)

	#if defined(_IRR_WCHAR_FILESYSTEM )
		c16 fpath[_MAX_PATH];
		p = _wfullpath(fpath, filename.c_str(), _MAX_PATH);
	#else
		c8 fpath[_MAX_PATH];
		p = _fullpath(fpath, filename.c_str(), _MAX_PATH);
	#endif

#elif (defined(_IRR_POSIX_API_) || defined(_IRR_OSX_PLATFORM_))
	c8 fpath[4096];
	fpath[0]=0;
	p = realpath(filename.c_str(), fpath);
	if (!p)
	{
		// content in fpath is undefined at this point
		if ('0'==fpath[0]) // seems like fpath wasn't altered
		{
			// at least remove a ./ prefix
			if ('.'==filename[0] && '/'==filename[1])
				return filename.subString(2, filename.size()-2);
			else
				return filename;
		}
		else
			return core::string<c16>(fpath);
	}

#endif

	return core::string<c16>(p);
}
开发者ID:harmboschloo,项目名称:CocaProject,代码行数:39,代码来源:CFileSystem.cpp


示例13: DES_string_to_key

NNT_BEGIN_HEADER_C

# include <openssl/des.h>
# include <math.h>

NNT_END_HEADER_C

NNT_BEGIN_CXX

void des::encrypt(char const* key, core::string const& in, core::vector<byte>& out)
{
    DES_cblock key_block;
    DES_key_schedule schedule;
    DES_string_to_key(key, &key_block);
    DES_set_key_checked(&key_block, &schedule);

    usize sz = (usize)ceil((double)in.size() / sizeof(DES_cblock)) * sizeof(DES_cblock);
    out.resize(sz);

    core::string::const_iterator iter = in.begin();
    DES_cblock* output = (DES_cblock*)core::pointer(out);

    DES_cblock input;
    while (iter != in.end())
    {
        usize sz = in.end() - iter;
        if (sz >= 8)
            sz = 8;
        else
            memset(input, 0, sizeof(DES_cblock));
        memcpy(input, &*iter, sz);
        DES_ecb_encrypt(&input, output, &schedule, DES_ENCRYPT);
        iter += sz;
        output += 1;
    }
}
开发者ID:imace,项目名称:nnt,代码行数:36,代码来源:DES+NNT.cpp


示例14: if

//! returns the base part of a filename, i.e. all except for the directory
//! part. If no directory path is prefixed, the full name is returned.
core::string<c16> CFileSystem::getFileBasename(const core::string<c16>& filename, bool keepExtension) const
{
	// find last forward or backslash
	s32 lastSlash = filename.findLast('/');
	const s32 lastBackSlash = filename.findLast('\\');
	lastSlash = core::max_(lastSlash, lastBackSlash);
	s32 end = 0;
	if (!keepExtension)
	{
		end = filename.findLast('.');
		if (end == -1)
			end=0;
		else
			end = filename.size()-end;
	}

	if ((u32)lastSlash < filename.size())
		return filename.subString(lastSlash+1, filename.size()-lastSlash-1-end);
	else if (end != 0)
		return filename.subString(0, filename.size()-end);
	else
		return filename;
}
开发者ID:harmboschloo,项目名称:CocaProject,代码行数:25,代码来源:CFileSystem.cpp


示例15: g_strdup

bool ofGstUtils::setPipelineWithSink(const core::string &pipeline, const core::string & sinkname, bool isStream){
	ofGstUtils::startGstMainLoop();

	gchar* pipeline_string =
		g_strdup((pipeline).c_str());

	GError * error = NULL;
	gstPipeline = gst_parse_launch (pipeline_string, &error);

	gLogManager.log( core::string("gstreamer pipeline: ")+ pipeline_string,ELL_INFO);
	if(error!=NULL){
		gLogManager.log(core::string("couldnt create pipeline: ") + error->message,ELL_WARNING);
		return false;
	}

	gstSink = gst_bin_get_by_name(GST_BIN(gstPipeline),sinkname.c_str());

	if(!gstSink){
		gLogManager.log( "couldn't get sink from string pipeline",ELL_WARNING);
	}

	return setPipelineWithSink(gstPipeline,gstSink,isStream);
}
开发者ID:yingzhang536,项目名称:mrayy-Game-Engine,代码行数:23,代码来源:ofGstUtils.cpp


示例16: re

core::data md5::hex(core::string const& str)
{
    core::data re(MD5_DIGEST_LENGTH);
    MD5((byte*)str.c_str(), str.length(), core::pointer(re));
    return re;
}
开发者ID:imace,项目名称:nnt,代码行数:6,代码来源:MDN+NNT.cpp


示例17: NavigateToUrl

bool BrowserWindow::NavigateToUrl(const core::string& url)
{
	return m_impl->GetWindow()->navigateTo(url.c_str(),url.length());
}
开发者ID:yingzhang536,项目名称:mrayy-Game-Engine,代码行数:4,代码来源:BrowserWindow.cpp


示例18: getMessage

const mchar* getMessage(int msgCode){

	static core::string msgStr;
	switch(msgCode){
		case HMSG_NET_START:
			msgStr+=mT("Network startup.");
			break;
		case HMSG_SOCKET_OPEN:
			msgStr+=mT("Socket Open.");
			break;
		case HMSG_TCP_SOCKET_CREATE:
			msgStr+=mT("TCP Socket Create.");
			break;
		case HMSG_UDP_SOCKET_CREATE:
			msgStr+=mT("UDP Socket Create.");
			break;
		case HMSG_GETHOST:
			msgStr+=mT("Get Host Name.");
			break;
		case HMSG_BIND:
			msgStr+=mT("socket Bind.");
			break;
		case HMSG_GETSOCKNAME:
			msgStr+=mT("Getting socket name.");
			break;
		case HMSG_ACCEPT:
			msgStr+=mT("accept data.");
			break;
		case HMSG_LISTEN:
			msgStr+=mT("Socket Listning.");
			break;
		case HMSG_FIND_REMOTE_HOST:
			msgStr+=mT("Find Remote Host.");
			break;
		case HMSG_CREATE_CONNECTION:
			msgStr+=mT("Creating Connection to Remote Host.");
			break;
		case HMSG_SEND:
			msgStr+=mT("Send Data.");
			break;
		case HMSG_RECIVE:
			msgStr+=mT("Recive Data.");
			break;
		case HMSG_SERVER_LOST:
			msgStr+=mT("Server Lost.");
			break;
		case HMSG_CANOT_CONNECT:
			msgStr+=mT("Cann't connect to server.");
			break;
		case HMSG_MAX_CLIENTS:
			msgStr+=mT("Max Clients Reached.");
			break;
		case HMSG_CLIENT_LOST:
			msgStr+=mT("Client Lost.");
			break;
		case HMSG_SETBROADCAST:
			msgStr+=mT("set Broadcast.");
			break;
		case HMSG_BROADCAST:
			msgStr+=mT("Broadcasting!.");
			break;
		case HMSG_TIMEOUT:
			msgStr+=mT("timeout!.");
			break;
		case HMSG_UNREACHABLEHOST:
			msgStr+=mT("Unreachable remote host!.");
			break;

		default:
			msgStr+=mT("Unkwon.");
			break;
	}


	return msgStr.c_str();
}
开发者ID:yingzhang536,项目名称:mrayy-Game-Engine,代码行数:76,代码来源:HMessage.cpp


示例19: GetBytesCount

int UnicodeEncoding::GetBytesCount(const core::string& str)
{
	return str.length()*2;
}
开发者ID:yingzhang536,项目名称:mrayy-Game-Engine,代码行数:4,代码来源:UnicodeEncoding.cpp


示例20: GetBytes

int UnicodeEncoding::GetBytes(const core::string& str,byte* buff,int maxLen)
{
	return GetBytes(&str[0],str.length(),buff,maxLen);
}
开发者ID:yingzhang536,项目名称:mrayy-Game-Engine,代码行数:4,代码来源:UnicodeEncoding.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ core::stringc类代码示例发布时间:2022-05-31
下一篇:
C++ core::rect类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap