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


C++ EncodeString函数代码示例

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


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

示例1: EncodeDicti

string EncodeDicti( const CAtomDicti &x )
{
	map<string, CAtom *> mapDicti = x.getValue( );

	string strDest;

	strDest += "d";

	for( map<string, CAtom *> :: iterator i = mapDicti.begin( ); i != mapDicti.end( ); i++ )
	{
		strDest += EncodeString( CAtomString( (*i).first ) );

		if( dynamic_cast<CAtomInt *>( (*i).second ) )
			strDest += EncodeInt( *dynamic_cast<CAtomInt *>( (*i).second ) );
		else if( dynamic_cast<CAtomLong *>( (*i).second ) )
			strDest += EncodeLong( *dynamic_cast<CAtomLong *>( (*i).second ) );
		else if( dynamic_cast<CAtomString *>( (*i).second ) )
			strDest += EncodeString( *dynamic_cast<CAtomString *>( (*i).second ) );
		else if( dynamic_cast<CAtomList *>( (*i).second ) )
			strDest += EncodeList( *dynamic_cast<CAtomList *>( (*i).second ) );
		else if( dynamic_cast<CAtomDicti *>( (*i).second ) )
			strDest += EncodeDicti( *dynamic_cast<CAtomDicti *>( (*i).second ) );
	}

	strDest += "e";

	return strDest;
}
开发者ID:comeby,项目名称:first_test,代码行数:28,代码来源:bencode.cpp

示例2: EncodeString

void TiXmlAttribute::Print( FILE* cfile, int /*depth*/, TIXML_STRING* str ) const
{
	TIXML_STRING n, v;

	EncodeString( name, &n );
	EncodeString( value, &v );

	if (value.find ('\"') == TIXML_STRING::npos) {
		if ( cfile ) {
		fprintf (cfile, "%s=\"%s\"", n.c_str(), v.c_str() );
		}
		if ( str ) {
			(*str) += n; (*str) += "=\""; (*str) += v; (*str) += "\"";
		}
	}
	else {
#if 0
		// disabled for the UIDesigner
		//if ( cfile ) {
		//fprintf (cfile, "%s='%s'", n.c_str(), v.c_str() );
		//}
		//if ( str ) {
		//	(*str) += n; (*str) += "='"; (*str) += v; (*str) += "'";
		//}
#else
		if ( cfile ) {
		fprintf (cfile, "%s=\"%s\"", n.c_str(), v.c_str() );
		}
		if ( str ) {
			(*str) += n; (*str) += "=\""; (*str) += v; (*str) += "\"";
		}
#endif
	}
}
开发者ID:achellies,项目名称:DUI_LIb,代码行数:34,代码来源:tinyxml.cpp

示例3: EncodeString

    /**
        Write a new name/value pair.

        \param[in]  name    Name of value.
        \param[in] value    Value.
    */
    void SCXFilePersistDataWriter::WriteValue(const std::wstring& name, const std::wstring& value)
    {
        std::wostringstream os;
        os << m_Indentation  << L"<Value Name=\""   << EncodeString(name)
           << L"\" Value=\"" << EncodeString(value) << L"\"/>" << std::endl;
        SCXStream::WriteAsUTF8(*m_Stream, os.str());
    }
开发者ID:Microsoft,项目名称:pal,代码行数:13,代码来源:scxfilepersistdatawriter.cpp

示例4: EncodeString

void TiXmlAttribute::Print( FILE* cfile, int /*depth*/, TIXML_STRING* str ) const
{
	TIXML_STRING n, v;
	
	EncodeString( name, &n );
	EncodeString( value, &v );
	
	if ( value.find ( '\"' ) == TIXML_STRING::npos ) {
		if ( cfile ) {
			fprintf ( cfile, "%s=\"%s\"", n.c_str(), v.c_str() );
		}
		if ( str ) {
			( *str ) += n;
			( *str ) += "=\"";
			( *str ) += v;
			( *str ) += "\"";
		}
	} else {
		if ( cfile ) {
			fprintf ( cfile, "%s='%s'", n.c_str(), v.c_str() );
		}
		if ( str ) {
			( *str ) += n;
			( *str ) += "='";
			( *str ) += v;
			( *str ) += "'";
		}
	}
}
开发者ID:Greyh0und,项目名称:TestProjects,代码行数:29,代码来源:tinyxml.cpp

示例5: EncodeString

void TiXmlAttribute::Print( FileOps *f, int /*depth*/, TIXML_STRING* str ) const
{
	TIXML_STRING n, v;

	EncodeString( name, &n );
	EncodeString( value, &v );

	if (value.find ('\"') == TIXML_STRING::npos) {
		const char *startVal = "=\"";
		const char *endVal = "\"";
		if (f) {
			f->write(n.c_str(), n.size(), 1);
			f->write(startVal, 2, 1);
			f->write(v.c_str(), v.size(), 1);
			f->write(endVal, 1, 1);
		}
		if ( str ) {
			(*str) += n; (*str) += "=\""; (*str) += v; (*str) += "\"";
		}
	}
	else {
		const char *startVal = "='";
		const char *endVal = "'";
		if (f) {
			f->write(n.c_str(), n.size(), 1);
			f->write(startVal, 2, 1);
			f->write(v.c_str(), v.size(), 1);
			f->write(endVal, 1, 1);
		}
		if ( str ) {
			(*str) += n; (*str) += "='"; (*str) += v; (*str) += "'";
		}
	}
}
开发者ID:MoLAoS,项目名称:Mandate,代码行数:34,代码来源:tinyxml.cpp

示例6: switch

/* EncodeElement is called by cat(), write.table() and deparsing. */
const char *EncodeElement(SEXP x, int indx, int quote, char dec)
{
    int w, d, e, wi, di, ei;
    const char *res;

    switch(TYPEOF(x)) {
    case LGLSXP:
	formatLogical(&LOGICAL(x)[indx], 1, &w);
	res = EncodeLogical(LOGICAL(x)[indx], w);
	break;
    case INTSXP:
	formatInteger(&INTEGER(x)[indx], 1, &w);
	res = EncodeInteger(INTEGER(x)[indx], w);
	break;
    case REALSXP:
	formatReal(&REAL(x)[indx], 1, &w, &d, &e, 0);
	res = EncodeReal(REAL(x)[indx], w, d, e, dec);
	break;
    case STRSXP:
	formatString(&STRING_PTR(x)[indx], 1, &w, quote);
	res = EncodeString(STRING_ELT(x, indx), w, quote, Rprt_adj_left);
	break;
    case CPLXSXP:
	formatComplex(&COMPLEX(x)[indx], 1, &w, &d, &e, &wi, &di, &ei, 0);
	res = EncodeComplex(COMPLEX(x)[indx], w, d, e, wi, di, ei, dec);
	break;
    case RAWSXP:
	res = EncodeRaw(RAW(x)[indx]);
	break;
    default:
	res = NULL; /* -Wall */
	UNIMPLEMENTED_TYPE("EncodeElement", x);
    }
    return res;
}
开发者ID:SensePlatform,项目名称:R,代码行数:36,代码来源:printutils.c

示例7: assert

void TiXmlText::Print( FileOps *f, int depth ) const
{
	const char *newLine = "\n";
	const char *tabSpacer = "   ";
	const char *start = "<![CDATA[";
	const char *end = "]]>\n";
	assert( f );
	if ( cdata )
	{
		int i;
		f->write(newLine, strlen(newLine), 1);
		for ( i=0; i<depth; i++ ) {
			f->write(tabSpacer, 3, 1);
		}
		f->write(start, strlen(start), 1);
		f->write(value.c_str(), value.size(), 1);
		f->write(end, strlen(end), 1);
	}
	else
	{
		TIXML_STRING buffer;
		EncodeString( value, &buffer );
		f->write(buffer.c_str(), buffer.size(), 1);
	}
}
开发者ID:MoLAoS,项目名称:Mandate,代码行数:25,代码来源:tinyxml.cpp

示例8: EncodeList

string EncodeList( const CAtomList &x )
{
	vector<CAtom *> v = x.getValue( );

	string strDest;

	strDest += "l";

	for( vector<CAtom *> :: iterator i = v.begin( ); i != v.end( ); i++ )
	{
		if( dynamic_cast<CAtomInt *>( *i ) )
			strDest += EncodeInt( *dynamic_cast<CAtomInt *>( *i ) );
		else if( dynamic_cast<CAtomLong *>( *i ) )
			strDest += EncodeLong( *dynamic_cast<CAtomLong *>( *i ) );
		else if( dynamic_cast<CAtomString *>( *i ) )
			strDest += EncodeString( *dynamic_cast<CAtomString *>( *i ) );
		else if( dynamic_cast<CAtomList *>( *i ) )
			strDest += EncodeList( *dynamic_cast<CAtomList *>( *i ) );
		else if( dynamic_cast<CAtomDicti *>( *i ) )
			strDest += EncodeDicti( *dynamic_cast<CAtomDicti *>( *i ) );
	}

	strDest += "e";

	return strDest;
}
开发者ID:comeby,项目名称:first_test,代码行数:26,代码来源:bencode.cpp

示例9: EncodeString

void TiXmlAttribute::Print( FILE* cfile, int /*depth*/, TIXML_STRING* str ) const
{
    TIXML_STRING n, v;

    EncodeString( name, &n );
    EncodeString( value, &v );

    if ( cfile ) {
        fprintf (cfile, "%s=\"%s\"", n.c_str(), v.c_str() );
    }
    if ( str ) {
        (*str) += n;
        (*str) += "=\"";
        (*str) += v;
        (*str) += "\"";
    }
}
开发者ID:fftyjw,项目名称:DirectUI,代码行数:17,代码来源:tinyxml.cpp

示例10: cat_newline

static void cat_newline(SEXP labels, int *width, int lablen, int ntot)
{
    Rprintf("\n");
    *width = 0;
    if (labels != R_NilValue) {
	Rprintf("%s ", EncodeString(STRING_ELT(labels, ntot % lablen),
				    1, 0, Rprt_adj_left));
	*width += Rstrlen(STRING_ELT(labels, ntot % lablen), 0) + 1;
    }
}
开发者ID:o-,项目名称:Rexperiments,代码行数:10,代码来源:builtin.c

示例11: _ASSERT

void IOPropertyMappingCollection::Write(MdfStream& fd, PropertyMappingCollection* propMappings, Version* version, const std::string& name, MgTab& tab)
{
    _ASSERT(NULL != propMappings);

    fd << tab.tab() << startStr(name) << std::endl;
    tab.inctab();

    for (int i = 0; i < propMappings->GetCount(); ++i)
    {
       fd << tab.tab() << startStr(sPropertyMapping) << std::endl;
       tab.inctab();

        PropertyMapping* propMapping = dynamic_cast<PropertyMapping*>(propMappings->GetAt(i));
        _ASSERT(NULL != propMapping);

        // Property: TargetProperty
        fd << tab.tab() << startStr(sTargetProperty);
        fd << EncodeString(propMapping->GetTargetProperty());
        fd << endStr(sTargetProperty) << std::endl;

        // Property: SourceProperty
        fd << tab.tab() << startStr(sSourceProperty);
        fd << EncodeString(propMapping->GetSourceProperty());
        fd << endStr(sSourceProperty) << std::endl;

        // Property: SourceUnits
        fd << tab.tab() << startStr(sSourceUnits);
        fd << EncodeString(propMapping->GetSourceUnits());
        fd << endStr(sSourceUnits) << std::endl;

        // Write any unknown XML / extended data
        IOUnknown::Write(fd, propMapping->GetUnknownXml(), version, tab);

        tab.dectab();
        fd << tab.tab() << endStr(sPropertyMapping) << std::endl;
    }

    tab.dectab();
    fd << tab.tab() << endStr(name) << std::endl;
}
开发者ID:asir6,项目名称:Colt,代码行数:40,代码来源:IOPropertyMappingCollection.cpp

示例12: str1

std::string Game::GetEncodeString(const char* str)
{
    const Settings & conf = Settings::Get();
    std::string str1(str);
    std::string str2(_(str));

    // encode name
    if(str1 == str2 && str1.size() &&
            conf.Unicode() && conf.MapsCharset().size())
        str2 = EncodeString(str1, conf.MapsCharset().c_str());

    return str2;
}
开发者ID:asimonov-im,项目名称:fheroes2,代码行数:13,代码来源:game.cpp

示例13: assert

void TiXmlText::Print(FILE* cfile, int depth) const {
	assert(cfile);
	if (cdata) {
		int i;
		fprintf(cfile, "\n");
		for (i = 0; i < depth; i++) {
			fprintf(cfile, "    ");
		}
		fprintf(cfile, "<![CDATA[%s]]>\n", value.c_str()); // unformatted output
	} else {
		TIXML_STRING buffer;
		EncodeString(value, &buffer);
		fprintf(cfile, "%s", buffer.c_str());
	}
}
开发者ID:9aa5,项目名称:crtmpserver,代码行数:15,代码来源:tinyxml.cpp

示例14: ToStringOption

	std::string ToStringOption() {
		std::string ret;
		for( std::vector<TreeItem>::const_iterator i = TreeItems.begin() ; i != TreeItems.end(); i++ ) {
			const TreeItem& item = *i;
			if( item.Value != item.Defalut ) {
				std::string name;
				TVPUtf16ToUtf8( name, item.Parameter );
				ret += name;
				ret += "=";
				ret += EncodeString( item.Select[item.Value].first );
				ret += "\r\n";
			}
		}
		return ret;
	}
开发者ID:LonghronShen,项目名称:krkrz,代码行数:15,代码来源:ConfigFormUnit.cpp

示例15: Encode

string Encode( CAtom *pAtom )
{
	if( dynamic_cast<CAtomInt *>( pAtom ) )
		return EncodeInt( *dynamic_cast<CAtomInt *>( pAtom ) );
	else if( dynamic_cast<CAtomLong *>( pAtom ) )
		return EncodeLong( *dynamic_cast<CAtomLong *>( pAtom ) );
	else if( dynamic_cast<CAtomString *>( pAtom ) )
		return EncodeString( *dynamic_cast<CAtomString *>( pAtom ) );
	else if( dynamic_cast<CAtomList *>( pAtom ) )
		return EncodeList( *dynamic_cast<CAtomList *>( pAtom ) );
	else if( dynamic_cast<CAtomDicti *>( pAtom ) )
		return EncodeDicti( *dynamic_cast<CAtomDicti *>( pAtom ) );

	return string( );
}
开发者ID:comeby,项目名称:first_test,代码行数:15,代码来源:bencode.cpp


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