本文整理汇总了C++中decodeString函数的典型用法代码示例。如果您正苦于以下问题:C++ decodeString函数的具体用法?C++ decodeString怎么用?C++ decodeString使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了decodeString函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: decodeString
//-----------------------------------------------------------------------------
// Analyze URL
// Extract Filename, Path, FileExt
// form RFC2616 / 3.2.2:
// http_URL = "http:" "//" host [ ":" port ] [ abs_path [ "?" query ]]
// query data is splitted and stored in ParameterList
//-----------------------------------------------------------------------------
void CWebserverRequest::analyzeURL(std::string url)
{
std::string fullurl = "";
ParameterList.clear();
// URI decode
fullurl = decodeString(url);
fullurl = trim(fullurl, "\r\n"); // non-HTTP-Standard: allow \r or \n in URL. Delete it.
UrlData["fullurl"] = fullurl;
// split Params
if(ySplitString(url,"?",UrlData["url"],UrlData["paramstring"])) // split pure URL and all Params
{
UrlData["url"] = decodeString(UrlData["url"]);
ParseParams(UrlData["paramstring"]); // split params to ParameterList
}
else // No Params
UrlData["url"] = fullurl;
if(!ySplitStringLast(UrlData["url"],"/",UrlData["path"],UrlData["filename"]))
{
UrlData["path"] = "/"; // Set "/" if not contained
}
else
UrlData["path"] += "/";
if(( UrlData["url"].length() == 1) || (UrlData["url"][UrlData["url"].length()-1] == '/' ))
{ // if "/" at end use index.html
UrlData["path"] = UrlData["url"];
UrlData["filename"] = "index.html";
}
ySplitStringLast(UrlData["filename"],".",UrlData["filenamepure"],UrlData["fileext"]);
}
开发者ID:silid,项目名称:tuxbox-cvs-apps,代码行数:39,代码来源:yrequest.cpp
示例2: printAllPropertyNames
void printAllPropertyNames(v8::Handle<v8::Object> objToPrint)
{
v8::Local<v8::Array> allProps = objToPrint->GetPropertyNames();
std::vector<v8::Local<v8::Object> > propertyNames;
for (int s=0; s < (int)allProps->Length(); ++s)
{
v8::Local<v8::Object>toPrint= v8::Local<v8::Object>::Cast(allProps->Get(s));
String errorMessage = "Error: error decoding first string in debug_checkCurrentContextX. ";
String strVal, strVal2;
bool stringDecoded = decodeString(toPrint, strVal,errorMessage);
if (!stringDecoded)
{
SILOG(js,error,errorMessage);
return;
}
v8::Local<v8::Value> valueToPrint = objToPrint->Get(v8::String::New(strVal.c_str(), strVal.length()));
errorMessage = "Error: error decoding second string in debug_checkCurrentContextX. ";
stringDecoded = decodeString(valueToPrint,strVal2,errorMessage);
if (!stringDecoded)
{
SILOG(js,error,errorMessage);
return;
}
std::cout<<" property "<< s <<": "<<strVal <<": "<<strVal2<<"\n";
}
}
开发者ID:AsherBond,项目名称:sirikata,代码行数:28,代码来源:JSObjectsUtils.cpp
示例3: while
//-----------------------------------------------------------------------------
// parse parameter string
// parameter = attribute "=" value
// attribute = token
// value = token | quoted-string
//
// If parameter attribute is multiple times given, the values are stored like this:
// <attribute>=<value1>,<value2>,..,<value n>
//-----------------------------------------------------------------------------
bool CWebserverRequest::ParseParams(std::string param_string)
{
bool ende = false;
std::string param, name="", value, number;
while(!ende)
{
if(!ySplitStringExact(param_string,"&",param,param_string))
ende = true;
if(ySplitStringExact(param,"=",name,value))
{
name = decodeString(name);
value = trim(decodeString(value));
if(ParameterList[name].empty())
ParameterList[name] = value;
else
{
ParameterList[name] += ",";
ParameterList[name] += value;
}
}
else
name = trim(decodeString(name));
number = string_printf("%d", ParameterList.size()+1);
log_level_printf(7,"ParseParams: name: %s value: %s\n",name.c_str(), value.c_str());
ParameterList[number] = name;
}
return true;
}
开发者ID:silid,项目名称:tuxbox-cvs-apps,代码行数:38,代码来源:yrequest.cpp
示例4: lzwExpand
/***************************************************************************
** expand
**
** Purpose: To uncompress the data contained in the input buffer and store
** the result in the output buffer. The fileLength parameter says how
** many bytes to uncompress. The compression itself is a form of LZW that
** adjusts the number of bits that it represents its codes in as it fills
** up the available codes. Two codes have special meaning:
**
** code 256 = start over
** code 257 = end of data
***************************************************************************/
void lzwExpand(uint8 *in, uint8 *out, int32 len) {
int32 c, lzwnext, lzwnew, lzwold;
uint8 *s, *end;
initLZW();
setBits(START_BITS); // Starts at 9-bits
lzwnext = 257; // Next available code to define
end = (uint8 *)(out + (uint32)len);
lzwold = inputCode(&in); // Read in the first code
c = lzwold;
lzwnew = inputCode(&in);
while ((out < end) && (lzwnew != 0x101)) {
if (lzwnew == 0x100) {
// Code to "start over"
lzwnext = 258;
setBits(START_BITS);
lzwold = inputCode(&in);
c = lzwold;
*out++ = (char)c;
lzwnew = inputCode(&in);
} else {
if (lzwnew >= lzwnext) {
// Handles special LZW scenario
*decodeStack = c;
s = decodeString(decodeStack + 1, lzwold);
} else
s = decodeString(decodeStack, lzwnew);
// Reverse order of decoded string and
// store in out buffer
c = *s;
while (s >= decodeStack)
*out++ = *s--;
if (lzwnext > MAX_CODE)
setBits(BITS + 1);
prefixCode[lzwnext] = lzwold;
appendCharacter[lzwnext] = c;
lzwnext++;
lzwold = lzwnew;
lzwnew = inputCode(&in);
}
}
closeLZW();
}
开发者ID:havlenapetr,项目名称:Scummvm,代码行数:63,代码来源:lzw.cpp
示例5: offsets
void StringFile::readHeader()
{
if(_compressed) {
std::vector<uint16_t> offsets(_strings.size());
for(uint16_t i = 0; i < _strings.size(); i++)
offsets[i] = _stream.getU16LE();
for(uint16_t i = 0; i < _strings.size(); i++)
_strings[i] = decodeString(offsets[i]);
}
else {
_strings.push_back("");
while(!_stream.eof()) {
uint8_t byte = _stream.get();
//TODO: Figure out what these non-alpha numeric characters are for,
// some sort of formatting perhaps? Let's just treat them as
// separators for now...
if(byte >= 0x20 && byte <= 0x7e)
_strings.back() += byte;
else if(_strings.back().size() != 0)
_strings.push_back("");
}
}
}
开发者ID:OmniBlade,项目名称:libeastwood,代码行数:25,代码来源:StringFile.cpp
示例6: inner_decode
static err_t inner_decode(buf_t *in, void *out) {
struct inner *x = (struct inner*)out;
vomControl ctl = controlNone;
uint64_t index;
while (true) {
err_t err = decodeVar128(in, &index, &ctl); ck();
if (ctl == controlEnd) {
return ERR_OK;
}
if (ctl != controlNone) {
// unexpected control message here
err = ERR_DECVOM; ck();
}
switch (index) {
case 0:
err = decodeString(in, &x->String); ck();
break;
default:
err = ERR_DECVOM; ck();
}
}
}
开发者ID:jeffallen,项目名称:miniv,代码行数:25,代码来源:teststruct.c
示例7: pps_decoder_type
QPpsAttribute QPpsObjectPrivate::decodeData(pps_decoder_t *decoder)
{
pps_node_type_t nodeType = pps_decoder_type(decoder, 0);
switch (nodeType) {
case PPS_TYPE_BOOL:
return decodeBool(decoder);
case PPS_TYPE_NUMBER:
return decodeNumber(decoder);
case PPS_TYPE_STRING:
return decodeString(decoder);
case PPS_TYPE_ARRAY:
return decodeNestedData(&QPpsObjectPrivate::decodeArray, decoder);
case PPS_TYPE_OBJECT:
return decodeNestedData(&QPpsObjectPrivate::decodeObject, decoder);
case PPS_TYPE_DELETED: {
// This should create an attribute with the flags set to PpsAttribute::Deleted.
// However, we need to create a valid QPpsAttribute while doing so. To do this,
// I'll create an empty map as a sentinel. Note that the readFlags() call with produce
// the correct set of flags. While I suspect that there will never be any other flags
// set in conjunction with this one, I'd rather not be surprised later.
QPpsAttributeMap emptyMap;
QPpsAttribute::Flags flags = readFlags(decoder);
QPpsAttribute returnVal = QPpsAttributePrivate::createPpsAttribute(emptyMap, flags);
return returnVal;
}
case PPS_TYPE_NULL:
case PPS_TYPE_NONE:
case PPS_TYPE_UNKNOWN:
default:
qWarning() << "QPpsObjectPrivate::decodeData: invalid pps_node_type";
return QPpsAttribute();
}
}
开发者ID:2gis,项目名称:2gisqt5android,代码行数:33,代码来源:qppsobject.cpp
示例8: decodeType
int decodeType( const char* data, int* idx, Object::Type* output ){
int rc = 0;
string type = "";
if( !(rc = decodeString(data, idx, &type)) ){
if( type == "scene" ){
*output = Ymir::Object::Scene;
} else if( type == "terrain" ){
*output = Ymir::Object::Terrain;
} else if( type == "camera" ){
*output = Ymir::Object::Camera;
} else if( type == "light" ){
*output = Ymir::Object::Light;
} else if( type == "static_entity" ){
*output = Ymir::Object::StaticEntity;
} else if( type == "animate_entity" ){
*output = Ymir::Object::AnimateEntity;
} else if( type == "window" ){
*output = Ymir::Object::Window;
} else if( type == "button" ){
*output = Ymir::Object::Button;
} else {
*output = Ymir::Object::Invalid;
}
}
return rc;
}
开发者ID:bsjung,项目名称:ymir,代码行数:29,代码来源:ObjectFactory.cpp
示例9: bsd_uis
static int bsd_uis( bsd_ctx_t *ctx, bsd_data_t *x, const uint8_t *buffer, int length) {
int nread;
CHECK_LENGTH( 1);
uint8_t opcode = buffer[0];
CHECK_DECODE( decodeString( ctx, x, buffer, length, &BS_UIS_STRING));
x->kind = BSD_INT;
if( 0x3b <= opcode && opcode <= 0xc6) {
/* Tiny unsigned */
x->content.i = opcode - 0x3b;
} else if( 0xc7 <= opcode && opcode <= 0xe6) {
/* Small unsigned */
CHECK_LENGTH( 2);
x->content.i = ((opcode - 0xc7) << 8) + buffer[1] + BS_UTI_MAX + 1;
} else if( 0xe7 <= opcode && opcode <= 0xf6) {
/* Medium unsigned */
CHECK_LENGTH( 3);
x->content.i = ((opcode - 0xe7) << 16) + (buffer[1] << 8) + buffer[2] + BS_USI_MAX + 1;
} else if( 0xf7 <= opcode && opcode <= 0xfe) {
/* Large unsigned */
CHECK_LENGTH( 4);
x->content.i = ((opcode - 0xf7) << 24) + (buffer[1] << 16) + (buffer[2] << 8) + buffer[3] + BS_UMI_MAX + 1;
} else if( 0xff == opcode) {
/* XLarge unsigned */
CHECK_LENGTH( 5);
x->content.i = ((uint32_t)buffer[1] << 24) + ((uint32_t)buffer[2] << 16) + ((uint32_t)buffer[3] << 8) + (uint32_t)buffer[4];
} else if( 0x00 == opcode) {
decodeNull( ctx, x);
} else {
return bsd_error( x, BSD_EINVALID);
}
return nread;
}
开发者ID:hmgiang,项目名称:OpenATConnectorSample,代码行数:34,代码来源:bysantd.c
示例10: XDrawString
int XDrawString(Display* display, Drawable drawable, GC gc, int x, int y, _Xconst char* string, int length) {
// https://tronche.com/gui/x/xlib/graphics/drawing-text/XDrawString.html
SET_X_SERVER_REQUEST(display, X_PolyText8);
LOG("%s: Drawing on %lu\n", __func__, drawable);
TYPE_CHECK(drawable, DRAWABLE, display, 0);
if (gc == NULL) {
handleError(0, display, None, 0, BadGC, 0);
return 0;
}
if (length == 0 || string[0] == 0) { return 1; }
GPU_Target* renderTarget;
GET_RENDER_TARGET(drawable, renderTarget);
if (renderTarget == NULL) {
LOG("Failed to get the render target in %s\n", __func__);
handleError(0, display, None, 0, BadDrawable, 0);
return 0;
}
char* text = decodeString(string, length);
if (text == NULL) {
LOG("Out of memory: Failed to allocate decoded string in XDrawString, "
"raising BadMatch error.\n");
handleError(0, display, None, 0, BadMatch, 0);
return 0;
}
int res = 1;
if (!renderText(renderTarget, gc, x, y, text)) {
LOG("Rendering the text failed in %s: %s\n", __func__, SDL_GetError());
handleError(0, display, drawable, 0, BadMatch, 0);
res = 0;
}
free(text);
return res;
}
开发者ID:Abestanis,项目名称:SDL2X11Emulation,代码行数:33,代码来源:font.c
示例11: while
/*!
Adds the string \a keyseq to the key sequence. \a keyseq may
contain up to four key codes, provided they are seperated by a
comma, e.g. "Alt+X,Ctrl+S,Z"). Returns the number of key codes
added.
*/
int QKeySequence::assign( QString keyseq )
{
QString part;
int n = 0;
int p = 0, diff = 0;
// Run through the whole string, but stop
// if we have 4 keys before the end.
while ( keyseq.length() && n < 4 ) {
// We MUST use something to seperate each sequence, and space
// does not cut it, since some of the key names have space
// in them.. (Let's hope no one translate with a comma in it:)
p = keyseq.find( ',' );
if ( -1 != p ) {
if ( ',' == keyseq[p+1] ) // e.g. 'Ctrl+,, Shift+,,'
p++;
if ( ' ' == keyseq[p+1] ) { // Space after comma
diff = 1;
p++;
} else if ( '\0' == keyseq[p+1] ) { // Last comma 'Ctrl+,'
p = -1;
} else {
diff = 0;
}
}
part = keyseq.left( -1==p?keyseq.length():p-diff );
keyseq = keyseq.right( -1==p?0:keyseq.length() - ( p + 1 ) );
d->key[n] = decodeString( part );
n++;
}
return n;
}
开发者ID:AliYousuf,项目名称:abanq-port,代码行数:38,代码来源:qkeysequence.cpp
示例12: decodeString
string decodeString(string s) {
string num = "", abc = "", ret = "";
int cnt = 0;
for ( int i = 0; i < s.size(); ++i ) {
if ( '0' <= s[i] && s[i] <= '9' && cnt == 0) {
num += s[i];
continue;
}
if ( s[i] == '[' ) {
cnt += 1;
}
if (cnt) {
abc += s[i];
}
else {
ret += s[i];
}
if ( s[i] == ']' ) {
cnt -= 1;
if ( cnt == 0 ) {
string temp = decodeString(abc.substr(1, abc.size()-2));
for ( int i = 0; i < atoi(num.c_str()); ++i ) {
ret += temp;
}
num = "";
abc = "";
}
}
}
ret += abc;
return ret;
}
开发者ID:bysen32,项目名称:LeetCode,代码行数:32,代码来源:394.+Decode+String.cpp
示例13: decodeString
/** Returns an irrlicht wide string from the utf8 encoded string at the
* given position.
* \param[in] pos Buffer position where the encoded string starts.
* \param[out] out The decoded string.
* \return number of bytes read. If there are no special characters in the
* string that will be 1+length of string, but multi-byte encoded
* characters can mean that the length of the returned string is
* less than the number of bytes read.
*/
int NetworkString::decodeStringW(int pos, irr::core::stringw *out) const
{
std::string s;
int len = decodeString(pos, &s);
*out = StringUtils::utf8ToWide(s);
return len;
} // decodeString
开发者ID:TheDudeWithThreeHands,项目名称:A-StreamKart,代码行数:16,代码来源:network_string.cpp
示例14: throw
QString cLogDataSource::decodeFile( const QString &p_qsFileName ) throw( cSevException )
{
cTracer obTracer( &g_obLogger, "cLogDataSource::decodeFile", p_qsFileName.toStdString() );
QString qsTempFileName = copyFile( p_qsFileName );
QString qsDecodedFileName = qsTempFileName + ".decoded";
QFile obCodedFile( qsTempFileName );
if( !obCodedFile.open( QIODevice::ReadOnly | QIODevice::Text ) )
{
throw cSevException( cSeverity::ERROR, QString( "%1: %2" ).arg( qsTempFileName ).arg( obCodedFile.errorString() ).toStdString() );
}
QFile obDecodedFile( qsDecodedFileName );
if( !obDecodedFile.open( QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Text ) )
{
obCodedFile.close();
throw cSevException( cSeverity::ERROR, QString( "%1: %2" ).arg( qsDecodedFileName ).arg( obDecodedFile.errorString() ).toStdString() );
}
QTextStream srCodedStream( &obCodedFile );
QTextStream srDecodedStream( &obDecodedFile );
bool boFirstLine = true;
for( QString qsCodedLine = srCodedStream.readLine();
!qsCodedLine.isNull();
qsCodedLine = srCodedStream.readLine() )
{
QStringList slCodedTags = qsCodedLine.split( ',' );
bool boFirstTag = true;
for( int i = 0; i < slCodedTags.size(); i++ )
{
if( boFirstTag ) boFirstTag = false;
else srDecodedStream << ",";
//only need to decode the 5. 9. 10. and 11. tags
if( boFirstLine || ( i != 5 && i != 9 && i != 10 && i != 11 ) )
{
srDecodedStream << slCodedTags.at( i );
}
else
{
srDecodedStream << decodeString( slCodedTags.at( i ) );
}
}
srDecodedStream << "\n";
srDecodedStream.flush();
if( boFirstLine ) boFirstLine = false;
}
obCodedFile.close();
QFile::remove( qsTempFileName );
obDecodedFile.close();
obTracer << qsTempFileName.toStdString();
return qsDecodedFileName;
}
开发者ID:pballok,项目名称:analog,代码行数:59,代码来源:logdatasource.cpp
示例15: currentValue
bool
Reader::decodeString( Token &token )
{
std::string decoded;
if ( !decodeString( token, decoded ) )
return false;
currentValue() = decoded;
return true;
}
开发者ID:herryRiver,项目名称:sdl_core_v3.6_wince,代码行数:9,代码来源:json_reader.cpp
示例16: decodeString
bool Reader::decodeString(Token &token) {
std::string decoded;
if (!decodeString(token, decoded))
return false;
currentValue() = decoded;
currentValue().setOffsetStart(token.start_ - begin_);
currentValue().setOffsetLimit(token.end_ - begin_);
return true;
}
开发者ID:hgl888,项目名称:Server,代码行数:9,代码来源:json_reader.cpp
示例17: decodeString
bool Reader::decodeString(Token& token) {
std::string decoded_string;
if (!decodeString(token, decoded_string))
return false;
Value decoded(decoded_string);
currentValue().swapPayload(decoded);
currentValue().setOffsetStart(token.start_ - begin_);
currentValue().setOffsetLimit(token.end_ - begin_);
return true;
}
开发者ID:robsonswiss,项目名称:OSVR-user-settings,代码行数:10,代码来源:json_reader.cpp
示例18: decodeSpaceID
bool decodeSpaceID(v8::Handle<v8::Value> toDecode,SpaceID& space, String& errorMessage)
{
String spaceStr;
bool strDecode = decodeString(toDecode,spaceStr,errorMessage);
if (! strDecode )
return false;
space = SpaceID(spaceStr);
return true;
}
开发者ID:AsherBond,项目名称:sirikata,代码行数:10,代码来源:JSObjectsUtils.cpp
示例19: decodeObjectReference
bool decodeObjectReference(v8::Handle<v8::Value> toDecode, ObjectReference& oref, String& errorMessage)
{
String orefStr;
bool strDecode = decodeString(toDecode,orefStr,errorMessage);
if (! strDecode )
return false;
oref = ObjectReference(orefStr);
return true;
}
开发者ID:AsherBond,项目名称:sirikata,代码行数:10,代码来源:JSObjectsUtils.cpp
示例20: init
bool Reader::readObject(Token& tokenStart) {
Token tokenName;
std::string name;
Value init(objectValue);
currentValue().swapPayload(init);
currentValue().setOffsetStart(tokenStart.start_ - begin_);
while (readToken(tokenName)) {
bool initialTokenOk = true;
while (tokenName.type_ == tokenComment && initialTokenOk)
initialTokenOk = readToken(tokenName);
if (!initialTokenOk)
break;
if (tokenName.type_ == tokenObjectEnd && name.empty()) // empty object
return true;
name = "";
if (tokenName.type_ == tokenString) {
if (!decodeString(tokenName, name))
return recoverFromError(tokenObjectEnd);
} else if (tokenName.type_ == tokenNumber && features_.allowNumericKeys_) {
Value numberName;
if (!decodeNumber(tokenName, numberName))
return recoverFromError(tokenObjectEnd);
name = numberName.asString();
} else {
break;
}
Token colon;
if (!readToken(colon) || colon.type_ != tokenMemberSeparator) {
return addErrorAndRecover(
"Missing ':' after object member name", colon, tokenObjectEnd);
}
Value& value = currentValue()[name];
nodes_.push(&value);
bool ok = readValue();
nodes_.pop();
if (!ok) // error already set
return recoverFromError(tokenObjectEnd);
Token comma;
if (!readToken(comma) ||
(comma.type_ != tokenObjectEnd && comma.type_ != tokenArraySeparator &&
comma.type_ != tokenComment)) {
return addErrorAndRecover(
"Missing ',' or '}' in object declaration", comma, tokenObjectEnd);
}
bool finalizeTokenOk = true;
while (comma.type_ == tokenComment && finalizeTokenOk)
finalizeTokenOk = readToken(comma);
if (comma.type_ == tokenObjectEnd)
return true;
}
return addErrorAndRecover(
"Missing '}' or object member name", tokenName, tokenObjectEnd);
}
开发者ID:robsonswiss,项目名称:OSVR-user-settings,代码行数:55,代码来源:json_reader.cpp
注:本文中的decodeString函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论