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

C++ AString函数代码示例

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

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



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

示例1: AString

void cPluginManager::FindPlugins(void)
{
	AString PluginsPath = FILE_IO_PREFIX + AString( "Plugins/" );

	// First get a clean list of only the currently running plugins, we don't want to mess those up
	for (PluginMap::iterator itr = m_Plugins.begin(); itr != m_Plugins.end();)
	{
		if (itr->second == NULL)
		{
			PluginMap::iterator thiz = itr;
			++thiz;
			m_Plugins.erase( itr );
			itr = thiz;
			continue;
		}
		++itr;
	}

	AStringVector Files = cFile::GetFolderContents(PluginsPath.c_str());
	for (AStringVector::const_iterator itr = Files.begin(); itr != Files.end(); ++itr)
	{
		if ((*itr == ".") || (*itr == "..") || (!cFile::IsFolder(PluginsPath + *itr)))
		{
			// We only want folders, and don't want "." or ".."
			continue;
		}

		// Add plugin name/directory to the list
		if (m_Plugins.find(*itr) == m_Plugins.end())
		{
			m_Plugins[*itr] = NULL;
		}
	}
}
开发者ID:straemer,项目名称:MCServer,代码行数:34,代码来源:PluginManager.cpp


示例2: UnicodeStringToMultiByte

AString UnicodeStringToMultiByte(const UString &srcString, UINT codePage)
{
  if (!srcString.IsEmpty())
  {
    const wchar_t * wcs = &srcString[0];
    char utf8[4096];
    UniChar unipath[4096];

    size_t n = wcslen(wcs);

    for(size_t i =   0 ; i<= n ;i++) {
      unipath[i] = wcs[i];
    }

    CFStringRef cfpath = CFStringCreateWithCharacters(NULL,unipath,n);

    CFMutableStringRef cfpath2 = CFStringCreateMutableCopy(NULL,0,cfpath);
    CFRelease(cfpath);
    CFStringNormalize(cfpath2,kCFStringNormalizationFormD);
    
    CFStringGetCString(cfpath2,(char *)utf8,4096,kCFStringEncodingUTF8);

    CFRelease(cfpath2);  

    return AString(utf8);
  }

  AString resultString;
  for (int i = 0; i < srcString.Len(); i++)
  {
    if (srcString[i] >= 256) resultString += '?';
    else                     resultString += char(srcString[i]);
  }
  return resultString;
}
开发者ID:btolab,项目名称:p7zip,代码行数:35,代码来源:StringConvert.cpp


示例3: AString

AString cWebAdmin::GetDefaultPage(void)
{
	AString Content;
	Content += "<h4>Server Name:</h4>";
	Content += "<p>" + AString( cRoot::Get()->GetServer()->GetServerID() ) + "</p>";

	Content += "<h4>Plugins:</h4><ul>";
	cPluginManager * PM = cPluginManager::Get();
	const cPluginManager::PluginMap & List = PM->GetAllPlugins();
	for (cPluginManager::PluginMap::const_iterator itr = List.begin(); itr != List.end(); ++itr)
	{
		if (itr->second == NULL)
		{
			continue;
		}
		AString VersionNum;
		AppendPrintf(Content, "<li>%s V.%i</li>", itr->second->GetName().c_str(), itr->second->GetVersion());
	}
	Content += "</ul>";
	Content += "<h4>Players:</h4><ul>";

	cPlayerAccum PlayerAccum;
	cWorld * World = cRoot::Get()->GetDefaultWorld(); // TODO - Create a list of worlds and players
	if( World != NULL )
	{
		World->ForEachPlayer(PlayerAccum);
		Content.append(PlayerAccum.m_Contents);
	}
	Content += "</ul><br>";
	return Content;
}
开发者ID:crexalbo,项目名称:MCServer,代码行数:31,代码来源:WebAdmin.cpp


示例4: AString

void ATextServer::__readcallback(ASocketServer *server, int socket, void *context)
{
	ATextHandler *handler = (ATextHandler *)context;

	if (handler) {
		static uint8_t buffer[1024];
		int n;

		if ((n = server->ReadSocket(socket, buffer, sizeof(buffer))) > 0) {
			AString data = AString((const char *)buffer, n).SearchAndReplace("\r", "");

			handler->AddData(data);
		}
		else {
			debug("Failed to read data from socket\n");
			server->DeleteHandler(socket);
			return;
		}

		handler->SendData();
	}
	else {
		debug("Received data on an unregistered handler!\n");
		server->DeleteHandler(socket);
	}
}
开发者ID:richardxday,项目名称:rdlib,代码行数:26,代码来源:TextServer.cpp


示例5: TEST

TEST(StringTests, rshort)
{
    LString short_text = "0123456789"_s;
    EXPECT_EQ(&*short_text.begin(), &*RString(short_text).begin());
    EXPECT_EQ(&*short_text.begin(), &*AString(short_text).begin());
    RString r = VString<255>(short_text);
    EXPECT_EQ(r.size(), 10);
    AString a = VString<255>(short_text);
    EXPECT_EQ(r, a);
    AString r2 = r, r3;
    RString a2 = a, a3;
    XString r1 = r2;
    XString a1 = a2;
    r3 = r1;
    a3 = a1;
    EXPECT_EQ(r, r1);
    EXPECT_EQ(a, a1);
    EXPECT_EQ(r, r2);
    EXPECT_EQ(a, a2);
    EXPECT_EQ(r, r3);
    EXPECT_EQ(a, a3);
    EXPECT_EQ(&*r.begin(), &*r1.begin());
    EXPECT_NE(&*a.begin(), &*a1.begin());
    EXPECT_EQ(&*r.begin(), &*r2.begin());
    EXPECT_NE(&*a.begin(), &*a2.begin());
    EXPECT_EQ(&*r.begin(), &*r3.begin());
    EXPECT_NE(&*a.begin(), &*a3.begin());
}
开发者ID:mrktj,项目名称:tmwa,代码行数:28,代码来源:strings2_test.cpp


示例6: fun_add

static
int fun_add(dumb_ptr<env_t>, val_t *result, Slice<val_t> args)
{
    if (ARG_TYPE(0) == TYPE::INT && ARG_TYPE(1) == TYPE::INT)
    {
        /* Integer addition */
        RESULTINT = ARGINT(0) + ARGINT(1);
        result->ty = TYPE::INT;
    }
    else if (ARG_MAY_BE_AREA(0) && ARG_MAY_BE_AREA(1))
    {
        /* Area union */
        make_area(&args[0]);
        make_area(&args[1]);
        RESULTAREA = area_union(ARGAREA(0), ARGAREA(1));
        ARGAREA(0) = nullptr;
        ARGAREA(1) = nullptr;
        result->ty = TYPE::AREA;
    }
    else
    {
        /* Anything else -> string concatenation */
        stringify(&args[0], 1);
        stringify(&args[1], 1);
        /* Yes, we could speed this up. */
        // ugh
        MString m;
        m += ARGSTR(0);
        m += ARGSTR(1);
        RESULTSTR = dumb_string::copys(AString(m));
        result->ty = TYPE::STRING;
    }
    return 0;
}
开发者ID:o11c,项目名称:tmwa,代码行数:34,代码来源:magic-expr.cpp


示例7: find

void cHTTPFormParser::OnPartData(const char * a_Data, size_t a_Size)
{
	if (m_CurrentPartName.empty())
	{
		// Prologue, epilogue or invalid part
		return;
	}
	if (m_CurrentPartFileName.empty())
	{
		// This is a variable, store it in the map
		iterator itr = find(m_CurrentPartName);
		if (itr == end())
		{
			(*this)[m_CurrentPartName] = AString(a_Data, a_Size);
		}
		else
		{
			itr->second.append(a_Data, a_Size);
		}
	}
	else
	{
		// This is a file, pass it on through the callbacks
		if (!m_FileHasBeenAnnounced)
		{
			m_Callbacks.OnFileStart(*this, m_CurrentPartFileName);
			m_FileHasBeenAnnounced = true;
		}
		m_Callbacks.OnFileData(*this, a_Data, a_Size);
	}
}
开发者ID:36451,项目名称:MCServer,代码行数:31,代码来源:HTTPFormParser.cpp


示例8: main

int main(int argc, char *argv[])
{
	ASocketServer server;
	AStdSocket    socket(server);

	if (argc < 2) {
		fprintf(stderr, "cmdsender " VER_STRING "\n");
		fprintf(stderr, "Usage: cmdsender <host> [<port>]\n");
		exit(1);
	}
	
	if (socket.open("0.0.0.0",
					0,
					ASocketServer::Type_Datagram)) {
		uint_t port = 1722;

		if (argc >= 3) port = (uint_t)AString(argv[2]);
		
		if (socket.setdatagramdestination(argv[1], port)) {
			AString line;
			while (line.ReadLn(Stdin) >= 0) {
				if (socket.printf("%s\n", line.str()) <= 0) break;
			}
		}
		
		socket.close();
	}
	
	return 0;
}
开发者ID:richardxday,项目名称:rdutils,代码行数:30,代码来源:cmdsender.cpp


示例9: const_access

AString _DataProxy::operator[](const std::string& field) const {
    if (HasField(field)) {
        return const_access(const_access(data->values, category), field);
    }
    else {
        return AString("");
    }
}
开发者ID:Asmageddon,项目名称:r1,代码行数:8,代码来源:Data.cpp


示例10: vdf_fopen

long _cdecl vdf_fopen(const char* filename, long flags) 
{
	IfsBase* res = VdfsBase.OpenFile(filename, flags);
	if(res)
		return (int)res;
	VdfsBase.SetLastError(AString(filename) + " file not found");
	return -1;
}
开发者ID:basecq,项目名称:GothicFix,代码行数:8,代码来源:Vdfs32.cpp


示例11: AString

bool AMySQLServer::convert(MYSQL_ROW row, int index, int& result)
{
  const char *p = row[index];
  result = 0;
  if (p)
    result = AString(p).toInt();
  return true;
}
开发者ID:achacha,项目名称:AOS,代码行数:8,代码来源:AMySQLServer.cpp


示例12: convert

bool AMySQLServer::convert(MYSQL_ROW row, int index, u2& result)
{
  const char *p = row[index];
  result = 0x0;
  if (p)
    result = (u2)AString(row[index]).toU4();

  return true;
}
开发者ID:achacha,项目名称:AOS,代码行数:9,代码来源:AMySQLServer.cpp


示例13: Hash

		AString* StringHashTable::HashString( const AChar* str ){
			if(str==NULL)
				return	NULL;
			AString* p = NULL;
			m_CS.Enter();
			p	=	Hash(AString(str));
			m_CS.Leave();
			return	p;
		}
开发者ID:ingeyu,项目名称:airengine,代码行数:9,代码来源:AirCommonStringHandle.cpp


示例14: AString

AString cPrefabPiecePool::GetMetadata(const AString & a_ParamName) const
{
	auto itr = m_Metadata.find(a_ParamName);
	if (itr == m_Metadata.end())
	{
		return AString();
	}
	return itr->second;
}
开发者ID:changyongGuo,项目名称:cuberite,代码行数:9,代码来源:PrefabPiecePool.cpp


示例15: AString

// static
status_t M3UParser::parseByteRange(
        const AString &line, uint64_t curOffset,
        uint64_t *length, uint64_t *offset) {
    ssize_t colonPos = line.find(":");

    if (colonPos < 0) {
        return ERROR_MALFORMED;
    }

    ssize_t atPos = line.find("@", colonPos + 1);

    AString lenStr;
    if (atPos < 0) {
        lenStr = AString(line, colonPos + 1, line.size() - colonPos - 1);
    } else {
        lenStr = AString(line, colonPos + 1, atPos - colonPos - 1);
    }

    lenStr.trim();

    const char *s = lenStr.c_str();
    char *end;
    *length = strtoull(s, &end, 10);

    if (s == end || *end != '\0') {
        return ERROR_MALFORMED;
    }

    if (atPos >= 0) {
        AString offStr = AString(line, atPos + 1, line.size() - atPos - 1);
        offStr.trim();

        const char *s = offStr.c_str();
        *offset = strtoull(s, &end, 10);

        if (s == end || *end != '\0') {
            return ERROR_MALFORMED;
        }
    } else {
        *offset = curOffset;
    }

    return OK;
}
开发者ID:3dsfr3ak,项目名称:android_frameworks_av,代码行数:45,代码来源:M3UParser.cpp


示例16: make_vector2i

sf::Vector2i make_vector2i(const std::string& str) {
    sf::Vector2i result;

    std::vector<int> vec = AString(str).as_int_vector();
    if (vec.size() < 2) return sf::Vector2i(0,0);

    result.x = vec[0];
    result.y = vec[1];
    return result;
}
开发者ID:Asmageddon,项目名称:r1,代码行数:10,代码来源:utils.cpp


示例17: make_vector2f

sf::Vector2f make_vector2f(const std::string& str) {
    sf::Vector2f result;

    std::vector<float> vec = AString(str).as_float_vector();
    if (vec.size() < 2) return sf::Vector2f(0,0);

    result.x = vec[0];
    result.y = vec[1];
    return result;
}
开发者ID:Asmageddon,项目名称:r1,代码行数:10,代码来源:utils.cpp


示例18: make_vector2u

sf::Vector2u make_vector2u(const std::string& str) {
    sf::Vector2u result;

    std::vector<int> vec = AString(str).as_int_vector();
    if (vec.size() < 2) return sf::Vector2u(0,0);

    result.x = (unsigned int)vec[0];
    result.y = (unsigned int)vec[1];
    return result;
}
开发者ID:Asmageddon,项目名称:r1,代码行数:10,代码来源:utils.cpp


示例19: AString

int AString::CheckPrefix(const AString &s)
{
	if (Len() < s.len) return 0;

	AString x = *this;
	x.str[s.len] = '\0';
	x.len = s.len;

	return AString(x) == s;
}
开发者ID:essenbee,项目名称:atlantis,代码行数:10,代码来源:astring.cpp


示例20: SetName

void Faction::SetName(AString* s)
{
	if (s) {
		AString* newname = s->getlegal();
		delete s;
		if (!newname) return;
		delete name;
		*newname += AString(" (") + num + ")";
		name = newname;
	}
}
开发者ID:davisd123,项目名称:Atlantis,代码行数:11,代码来源:faction.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ AT91C_PIN_PA函数代码示例发布时间:2022-05-30
下一篇:
C++ AS_UINT32函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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