本文整理匯總了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;
}
示例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
}
}
示例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());
}
示例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 ) += "'";
}
}
}
示例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) += "'";
}
}
}
示例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;
}
示例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);
}
}
示例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;
}
示例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) += "\"";
}
}
示例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;
}
}
示例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;
}
示例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;
}
示例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());
}
}
示例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;
}
示例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( );
}