这篇教程C++ FindToken函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中FindToken函数的典型用法代码示例。如果您正苦于以下问题:C++ FindToken函数的具体用法?C++ FindToken怎么用?C++ FindToken使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了FindToken函数的24个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: TokenNamebool TokenName( unsigned token, char **start, unsigned *len ){ switch( token ) { case T_LINE_SEPARATOR: *start = LIT( End_Of_Line ); *len = strlen( LIT( End_Of_Line ) ) + 1; return( TRUE ); case T_INT_NUM: case T_REAL_NUM: *start = LIT( Num_Name ); *len = strlen( LIT( Num_Name ) ) + 1; return( TRUE ); case T_NAME: *start = LIT( Sym_Name_Name ); *len = strlen( LIT( Sym_Name_Name ) ) + 1; return( TRUE ); } if( token < LAST_CMDLN_DELIM ) { *start = &CmdLnDelimTab[ token - FIRST_CMDLN_DELIM ]; *len = sizeof( char ); return( TRUE ); } if( ExprTokens != NULL ) { if( FindToken( ExprTokens->delims, token, start, len ) ) return(TRUE); if( FindToken( ExprTokens->keywords, token, start, len ) ) return(TRUE); } return( FALSE );}
开发者ID:Ukusbobra,项目名称:open-watcom-v2,代码行数:28,
示例2: FindTokenvoid Parser::SearchForEpisodeTitle() { auto token_begin = tokens_.begin(); auto token_end = tokens_.begin(); do { // Find the first non-enclosed unknown token token_begin = FindToken(token_end, tokens_.end(), kFlagNotEnclosed | kFlagUnknown); if (token_begin == tokens_.end()) return; // Continue until a bracket or identifier is found token_end = FindToken(token_begin, tokens_.end(), kFlagBracket | kFlagIdentifier); // Ignore if it's only a dash if (std::distance(token_begin, token_end) <= 2 && IsDashCharacter(token_begin->content)) { continue; } // Build episode title BuildElement(kElementEpisodeTitle, false, token_begin, token_end); return; } while (token_begin != tokens_.end());}
开发者ID:erengy,项目名称:anitomy,代码行数:26,
示例3: FindTokenvoid Parser::SearchForReleaseGroup() { token_container_t::iterator token_begin = tokens_.begin(); token_container_t::iterator token_end = tokens_.begin(); do { // Find the first enclosed unknown token token_begin = FindToken(token_end, tokens_.end(), kFlagEnclosed | kFlagUnknown); if (token_begin == tokens_.end()) return; // Continue until a bracket or identifier is found token_end = FindToken(token_begin, tokens_.end(), kFlagBracket | kFlagIdentifier); if (token_end->category != kBracket) continue; // Ignore if it's not the first non-delimiter token in group token_container_t::iterator previous_token = FindPreviousToken(tokens_, token_begin, kFlagNotDelimiter); if (previous_token != tokens_.end() && previous_token->category != kBracket) { continue; } // Build release group BuildElement(kElementReleaseGroup, true, token_begin, token_end); return; } while (token_begin != tokens_.end());}
开发者ID:gamedeff,项目名称:anitomy,代码行数:30,
示例4: whilevoid TLexer::Read() { char c; std::string value = ""; while (true) { c = GetChar(); if (FileEOF()) { break; } value += c; switch (c) { case 34: { ReadString(value); break; } case 39: { ReadSymbol(value); break; } case '.' : { FindToken(State_Point, value); break; } case '(': { FindToken(State_Lbkt,value); break; } case ')': { FindToken(State_Rbkt,value); break; } case '#': { ReadSharp(value); break; } default: { if (isspecial(c) || isalpha(c)) { ReadIdent(value); } else if (isdigit(c)) { ReadNumber(value); } else if (IsEndToken(c)) { value.erase(value.size() - 1, value.size()); } break; } } } value = "EOF"; FindToken(State_EOF, value);}
开发者ID:Roninsc2,项目名称:for_scheme,代码行数:53,
示例5: FindTokenvoid MenuManager::ParsePageInfo(char* plinePtr, int* menuNumber, int* pageNumber, int* itemNumber){ (*pageNumber)++; *itemNumber = -1; char pdrawColor[20]; ULONG color; char pseparators[] = {0x20, 0x2c, 0x3d, 0x3b, 0x0d, 0x0a, 0x09, 0x23, 0x00}; char *ptoken; PageStruct* pPage = &(mpMenus[*menuNumber].mpPages[*pageNumber]); #ifdef USE_SH_POOLS pPage->mpTitle = (char *)MemAllocPtr(gCockMemPool,sizeof(char)*mMaxTextLen,FALSE); #else pPage->mpTitle = new char[mMaxTextLen]; #endif *(pPage->mpTitle) = '/0'; ptoken = FindToken(&plinePtr, pseparators); sscanf(ptoken, "%d", &(pPage->mNumItems)); ptoken = FindToken(&plinePtr, pseparators); sscanf(ptoken, "%d", &(pPage->mCondition)); ptoken = FindToken(&plinePtr, pseparators); sscanf(ptoken, "%s", pdrawColor); *(pPage->mpTitle) = NULL; ptoken = FindToken(&plinePtr, pseparators); while(ptoken) { strcat(pPage->mpTitle, ptoken); ptoken = FindToken(&plinePtr, pseparators); if(ptoken) { strcat(pPage->mpTitle, " "); } } if(FindMenuColorValue(pdrawColor, &color)) { pPage->mDrawColor = color; } else { pPage->mDrawColor = gMenuColorTable[MENU_WHITE].mValue; } #ifdef USE_SH_POOLS pPage->mpItems = (ItemStruct *)MemAllocPtr(gCockMemPool,sizeof(ItemStruct)*pPage->mNumItems,FALSE); #else pPage->mpItems = new ItemStruct[pPage->mNumItems]; #endif}
开发者ID:FreeFalcon,项目名称:freefalcon-central,代码行数:51,
示例6: IDENTIFIERL_TOKEN* IDENTIFIER(char* source, int start, int end, int line, GRAMMAR_TABLE grammar){ int token; L_TOKEN* block = (L_TOKEN*)malloc(sizeof(L_TOKEN)); token = FindToken(&source[start], end - start, grammar); if (token) { // token block->token = token; block->string = source + start; block->length = end - start; block->line = line; block->next = 0; } else { // identifier block->token = gSymbolIdentifier; block->string = source + start; block->length = end - start; block->line = line; block->next = 0; } return block;}
开发者ID:fmoliveira,项目名称:duck-lang,代码行数:28,
示例7: TOKENL_TOKEN* TOKEN(char* source, int start, int end, int line, GRAMMAR_TABLE grammar){ int token; L_TOKEN* block = (L_TOKEN*)malloc(sizeof(L_TOKEN)); token = FindToken(&source[start], end - start, grammar); if (token) { // token block->token = token; block->string = source + start; block->length = end - start; block->line = line; block->next = 0; } else { // identifier free(block); block = NULL; printf("Syntax error on line %i, ", line+1); printf("Error, illegal identifier: "); while (start < end) printf("0x%X", source[start++]); printf("/n"); } return block;}
开发者ID:fmoliveira,项目名称:duck-lang,代码行数:30,
示例8: FindPreviousTokentoken_iterator_t FindPreviousToken(token_container_t& tokens, token_iterator_t first, unsigned int flags) { auto it = FindToken(std::reverse_iterator<token_iterator_t>(first), tokens.rend(), flags); return it == tokens.rend() ? tokens.end() : (++it).base();}
开发者ID:erengy,项目名称:anitomy,代码行数:7,
示例9: whileint StyleSheetParser::Parse(StyleSheetNode* node, Stream* _stream){ int rule_count = 0; line_number = 0; stream = _stream; stream_file_name = stream->GetSourceURL().GetURL().Replace("|", ":"); // Look for more styles while data is available while (FillBuffer()) { String style_names; while (FindToken(style_names, "{", true)) { // Read the attributes PropertyDictionary properties; if (!ReadProperties(properties)) { continue; } StringList style_name_list; StringUtilities::ExpandString(style_name_list, style_names); // Add style nodes to the root of the tree for (size_t i = 0; i < style_name_list.size(); i++) ImportProperties(node, style_name_list[i], properties, rule_count); rule_count++; } } return rule_count;}
开发者ID:Wilhansen,项目名称:libRocket,代码行数:34,
示例10: FindTokenvoid pgSettingItem::SetType(const wxString &str){ int index = FindToken(str, pgConfigTypeStrings); if (index < 0) type = PGC_STRING; else type = (pgConfigType)index;}
开发者ID:Timosha,项目名称:pgadmin3,代码行数:8,
示例11: FindTokenvoid TLexer::IsCorrectToken(char c, std::string& value, States state) { if (IsEndToken(c)) { FindToken(state, value); } else { value += c; throw new ExceptionLexerIncorrectChar(value, PosLine, PosColumn); }}
开发者ID:Roninsc2,项目名称:for_scheme,代码行数:8,
示例12: NextTokenstruct TokenStruct NextToken (char *c) { *c = FindToken (*c); struct TokenStruct ret;// = malloc (sizeof (struct TokenStruct)); ret.Token = malloc (sizeof (char) * 2); ret.Token[0] = *c; ret.type = TokenType (*c); ret.priority = OpPriority (*c); ret.index = line_index; int length = 1; if (!ret.type) { if (*c == '+' || *c == '-' || *c == '*' || *c == '/' || *c == '%' || *c == '^' || *c == '=' || *c == ')' || *c == '(' || *c == ',') { // Grab next character if we have a valid token *c = FindToken (0); } ret.Token[1] = '/0';#ifdef DEBUG if (ret.Token[0] != '/n') { printf (" Op/Invalid Token %i: '%s';/n", ret.index, ret.Token); } else { printf (" Op/Invalid Token %i: '//n';/n", ret.index); } sleep (1);#endif return ret; } *c = getchar (); AddSpace (*c); while (TokenType (*c) == ret.type) { ret.Token[length++] = *c; if (ECHO) { putchar (*c); } ret.Token = realloc (ret.Token, sizeof (char) * (length+1)); *c = getchar (); AddSpace (*c); } if (ECHO) { putchar (*c); } //line_index += length; ret.Token[length] = '/0'; *c = FindToken (*c);#ifdef DEBUG printf (" Var/Num Token %i: %s;/n", ret.index, ret.Token); sleep (1);#endif return ret;}
开发者ID:TAParsons,项目名称:HomebrewCalculator,代码行数:42,
示例13: CP_OPENvoid MenuManager::ReadDataFile(char* pfileName){ FILE* pFile; BOOL quitFlag = FALSE; char* presult = ""; char* plinePtr; const int lineLen = MAX_LINE_BUFFER - 1; char plineBuffer[MAX_LINE_BUFFER] = ""; char *ptoken; char pseparators[] = {0x20, 0x2c, 0x3d, 0x3b, 0x0d, 0x0a, 0x09, 0x23, 0x00}; int menuNumber = -1; int pageNumber = -1; int itemNumber = -1; pFile = CP_OPEN(pfileName, "r"); F4Assert(pFile); presult = fgets(plineBuffer, lineLen, pFile); quitFlag = (presult == NULL); plinePtr = plineBuffer; while(!quitFlag) { if(*plineBuffer == '#') { ptoken = FindToken(&plinePtr, pseparators); if(!strcmpi(ptoken, TYPE_MENUMANGER_STR)) { ParseManagerInfo(plinePtr); } else if(!strcmpi(ptoken, TYPE_MENU_STR)) { ParseMenuInfo(plinePtr, &menuNumber, &pageNumber); } else if(!strcmpi(ptoken, TYPE_PAGE_STR)) { ParsePageInfo(plinePtr, &menuNumber, &pageNumber, &itemNumber); } else if(!strcmpi(ptoken, TYPE_ITEM_STR)) { ParseItemInfo(plinePtr, &menuNumber, &pageNumber, &itemNumber); } else if(!strcmpi(ptoken, TYPE_RES_STR)) { ParseResInfo(plinePtr, --mResCount); } else { ShiWarning ("Bad String in menu file"); } } presult = fgets(plineBuffer, lineLen, pFile); plinePtr = plineBuffer; quitFlag = (presult == NULL); } CP_CLOSE(pFile); ShiAssert(mResCount == 0); // Bad data in the manager information line!}
开发者ID:FreeFalcon,项目名称:freefalcon-central,代码行数:54,
示例14: FindTokenvoid PdfParser::ReadXRef( pdf_long* pXRefOffset ){ FindToken( "startxref", PDF_XREF_BUF ); if( !this->IsNextToken( "startxref" ) ) { PODOFO_RAISE_ERROR( ePdfError_NoXRef ); } *pXRefOffset = this->GetNextNumber();}
开发者ID:arunjalota,项目名称:paperman,代码行数:11,
示例15: isStdInitializerListvoid ExplicitConstructorCheck::check(const MatchFinder::MatchResult &Result) { const CXXConstructorDecl *Ctor = Result.Nodes.getNodeAs<CXXConstructorDecl>("ctor"); // Do not be confused: isExplicit means 'explicit' keyword is present, // isImplicit means that it's a compiler-generated constructor. if (Ctor->isOutOfLine() || Ctor->isImplicit() || Ctor->isDeleted() || Ctor->getNumParams() == 0 || Ctor->getMinRequiredArguments() > 1) return; bool takesInitializerList = isStdInitializerList( Ctor->getParamDecl(0)->getType().getNonReferenceType()); if (Ctor->isExplicit() && (Ctor->isCopyOrMoveConstructor() || takesInitializerList)) { auto isKWExplicit = [](const Token &Tok) { return Tok.is(tok::raw_identifier) && Tok.getRawIdentifier() == "explicit"; }; SourceRange ExplicitTokenRange = FindToken(*Result.SourceManager, Result.Context->getLangOpts(), Ctor->getOuterLocStart(), Ctor->getLocEnd(), isKWExplicit); StringRef ConstructorDescription; if (Ctor->isMoveConstructor()) ConstructorDescription = "move"; else if (Ctor->isCopyConstructor()) ConstructorDescription = "copy"; else ConstructorDescription = "initializer-list"; DiagnosticBuilder Diag = diag(Ctor->getLocation(), "%0 constructor should not be declared explicit") << ConstructorDescription; if (ExplicitTokenRange.isValid()) { Diag << FixItHint::CreateRemoval( CharSourceRange::getCharRange(ExplicitTokenRange)); } return; } if (Ctor->isExplicit() || Ctor->isCopyOrMoveConstructor() || takesInitializerList) return; bool SingleArgument = Ctor->getNumParams() == 1 && !Ctor->getParamDecl(0)->isParameterPack(); SourceLocation Loc = Ctor->getLocation(); diag(Loc, "%0 must be marked explicit to avoid unintentional implicit conversions") << (SingleArgument ? "single-argument constructors" : "constructors that are callable with a single argument") << FixItHint::CreateInsertion(Loc, "explicit ");}
开发者ID:GameFusion,项目名称:clang-tools-extra,代码行数:53,
示例16: DBufInitchar const *FindInitialToken(Token *tok, char const *s){ DynamicBuffer buf; DBufInit(&buf); tok->type = T_Illegal; while (isempty(*s)) s++; while (*s && !isempty(*s)) { if (DBufPutc(&buf, *s++) != OK) return s; } FindToken(DBufValue(&buf), tok); DBufFree(&buf); return s;}
开发者ID:unixsuperhero,项目名称:remind,代码行数:18,
示例17: ReadCommandULONG tScriptState::ReadCommand(CString& s){ char buf[256]; if (!fgets(buf, sizeof(buf) - 1, f)) { if (feof(f)) s = FindToken(cmdEnd); else s = "<Error reading from file>"; } else { s = buf; } while (isspace(s[0])) s.Delete(0, 1); s.Remove('/n'); s.Remove('/r'); currentLine++; currentDot = 0; strcpy(buf, s); return currentCommandIndex++;}
开发者ID:YehudaItkin,项目名称:kvm-guest-drivers-windows,代码行数:20,
示例18: ProcessTypes/* * Routine: ProcessTypes * Purpose: Parse the type vector * Algorithm: * Data Structures: * * Params: * Returns: * Called By: * Calls: * Assumptions: * Side Effects: * TODO: None */intProcessTypes (char *stmt, token_t * tokens){ char *cp, *cp1; int nTypeCount = 1, nToken, i; /* get a type count */ for (cp1 = stmt; (cp1 = strchr (cp1, ',')) != NULL; cp1++) nTypeCount += 1; pCurrentIndexEntry->dist->type_vector = (int *) MALLOC (sizeof (int) * nTypeCount); if (pCurrentIndexEntry->dist->type_vector == NULL) return (QERR_NO_MEMORY); memset(pCurrentIndexEntry->dist->type_vector, 0, sizeof(int) * nTypeCount); /* get the type names */ i = 0; while ((cp = strtok (NULL, "=( ,);")) != NULL) { switch (nToken = FindToken (cp)) { /* * NOTE NOTE NOTE NOTE NOTE * this is manually sync'd with expr.h values * NOTE NOTE NOTE NOTE NOTE */ case TKN_INT: case TKN_VARCHAR: pCurrentIndexEntry->dist->type_vector[i++] = nToken; break; default: return (QERR_SYNTAX); } } return (nTypeCount);}
开发者ID:fengttt,项目名称:TPC-DS,代码行数:54,
示例19: switchbool cStrings::UnderstandToken(int token, char *data){ sFlagPair *FlagPair; switch(token) { case TK_FLAGS: while(token != TK_INVALID) { token = FindToken(data, false); for(FlagPair = FlagPairs; FlagPair->Name != TK_INVALID; FlagPair++) { if (FlagPair->Name == token) { Flags |= FlagPair->Value; break; } } } return true; case TK_REFERENCE: SetReference(data); return true; case TK_RIGHT_BRACE: return false; } if (token == TK_INVALID) { return false; } return true;}
开发者ID:Boothand,项目名称:jk2mp,代码行数:36,
示例20: ModelDirective/* handle .model directive * syntax: .MODEL <FLAT|TINY|SMALL...> [,<C|PASCAL|STDCALL...>][,<NEARSTACK|FARSTACK>][,<OS_DOS|OS_OS2>] * sets fields * - ModuleInfo.model * - ModuleInfo.language * - ModuleInfo.distance * - ModuleInfo.ostype * if model is FLAT, defines FLAT pseudo-group * set default segment names for code and data */ret_code ModelDirective( int i, struct asm_tok tokenarray[] )/***********************************************************/{ enum model_type model; enum lang_type language; enum dist_type distance; enum os_type ostype; int index; uint_8 init; uint_8 initv; DebugMsg1(("ModelDirective enter/n")); /* v2.03: it may occur that "code" is defined BEFORE the MODEL * directive (i.e. DB directives in AT-segments). For FASTPASS, * this may have caused errors because contents of the ModuleInfo * structure was saved before the .MODEL directive. */ //if( Parse_Pass != PASS_1 ) { if( Parse_Pass != PASS_1 && ModuleInfo.model != MODEL_NONE ) { /* just set the model with SetModel() if pass is != 1. * This won't set the language ( which can be modified by * OPTION LANGUAGE directive ), but the language in ModuleInfo * isn't needed anymore once pass one is done. */ SetModel(); return( NOT_ERROR ); } i++; if ( tokenarray[i].token == T_FINAL ) { EmitError( EXPECTED_MEMORY_MODEL ); return( ERROR ); } /* get the model argument */ index = FindToken( tokenarray[i].string_ptr, ModelToken, sizeof( ModelToken )/sizeof( ModelToken[0] ) ); if( index >= 0 ) { if( ModuleInfo.model != MODEL_NONE ) { EmitWarn( 2, MODEL_DECLARED_ALREADY ); return( NOT_ERROR ); } model = index + 1; i++; } else { EmitErr( SYNTAX_ERROR_EX, tokenarray[i].string_ptr ); return( ERROR ); } /* get the optional arguments: language, stack distance, os */ init = 0; while ( i < ( Token_Count - 1 ) && tokenarray[i].token == T_COMMA ) { i++; if ( tokenarray[i].token != T_COMMA ) { if ( GetLangType( &i, tokenarray, &language ) == NOT_ERROR ) { initv = INIT_LANG; } else { index = FindToken( tokenarray[i].string_ptr, ModelAttr, sizeof( ModelAttr )/sizeof( ModelAttr[0] ) ); if ( index < 0 ) break; initv = ModelAttrValue[index].init; switch ( initv ) { case INIT_STACK: if ( model == MODEL_FLAT ) { EmitError( INVALID_MODEL_PARAM_FOR_FLAT ); return( ERROR ); } distance = ModelAttrValue[index].value; break; case INIT_OS: ostype = ModelAttrValue[index].value; break; } i++; } /* attribute set already? */ if ( initv & init ) { i--; break; } init |= initv; } } /* everything parsed successfully? */ if ( tokenarray[i].token != T_FINAL ) { EmitErr( SYNTAX_ERROR_EX, tokenarray[i].tokpos ); return( ERROR ); } if ( model == MODEL_FLAT ) { if ( ( ModuleInfo.curr_cpu & P_CPU_MASK) < P_386 ) { EmitError( INSTRUCTION_OR_REGISTER_NOT_ACCEPTED_IN_CURRENT_CPU_MODE );//.........这里部分代码省略.........
开发者ID:tonylazarew,项目名称:jwasm,代码行数:101,
示例21: GetNext// GetNextbool COpcTextReader::GetNext(COpcText& cToken){ // no more data to get - give up if (m_uEndOfData == 0) { return false; } // find the token if (!FindToken(cToken)) { return false; } // all done if token is not being extracted. if (cToken.GetNoExtract()) { return true; } UINT uEndOfToken = cToken.GetEnd() + 1; UINT uDataLeft = m_uEndOfData - uEndOfToken; // extract the delimiter if extracting token. // new line delimiter found. if (cToken.GetNewLine()) { if (cToken.GetDelimChar() == _T('/r')) { uEndOfToken += 2; uDataLeft -= 2; } else { uEndOfToken += 1; uDataLeft -= 1; } } // specific delimiter found. else if (cToken.GetDelimChar() > 0 && !cToken.GetEof()) { uEndOfToken++; uDataLeft--; } // move leftover data to the start of the buffer for (UINT ii = 0; ii < uDataLeft; ii++) { m_szBuf[ii] = m_szBuf[uEndOfToken+ii]; } m_szBuf[ii] = L'/0'; m_uEndOfData = uDataLeft; // set EOF flag if no data left in buffer. if (m_uEndOfData == 0) { cToken.SetEof(); } return true;}
开发者ID:AymanShawky,项目名称:niko78csharp,代码行数:66,
示例22: GetLine/************************************************************************************************ * GetLine * * inputs: * * return: * ************************************************************************************************/void GetLine(char *&Data, int &Size, int &token, char *&data){ static char save_data[8192]; char temp_data[8192]; char *test_token, *pos; save_data[0] = 0; token = TK_INVALID; data = save_data; if (!ReadData(Data, Size, temp_data, sizeof(temp_data))) { return; }// strcpy(temp_data, " DATA /"test of the data/ntest test/ndfa dfd");// strcpy(temp_data, " DATA"); pos = temp_data; while((*pos) && strchr(" /n/r", *pos)) { // remove white space pos++; } test_token = pos; while((*pos) && !strchr(" /n/r", *pos)) { // scan until end of white space pos++; } if ((*pos)) { *pos = 0; pos++; } token = FindToken(test_token, true); while((*pos) && strchr(" /n/r", *pos)) { // remove white space pos++; } if ((*pos) == '/"') { pos++; test_token = save_data; memset(save_data, 0, sizeof(save_data)); while(((*pos) != '/"' || !strchr("/n/r", (*(pos+1)))) && (*pos)) { if ((*pos) == '//' && (*(pos+1)) == 'n') {#ifdef _STRIPED_ *test_token = '/r'; test_token++;#endif *test_token = '/n'; test_token++; pos+=2; continue; } *test_token = *pos; test_token++; pos++; } if ((*pos) == '/"') { *pos = 0; } } else { test_token = pos; while((*pos) && !strchr("/n/r", *pos)) { // scan until end of white space pos++; } *pos = 0; strcpy(save_data, test_token); }}
开发者ID:Boothand,项目名称:jk2mp,代码行数:92,
示例23: SkipSpacevoid pgHbaConfigLine::Init(const wxString &line){ connectType = PGC_INVALIDCONF; changed = false; if (line.IsEmpty()) return; text = line; const wxChar *p0 = line.c_str(); if (*p0 == '#') { isComment = true; p0++; SkipSpace(p0); } else isComment = false; const wxChar *p1 = p0; SkipNonspace(p1); wxString str = line.Mid(p0 - line.c_str(), p1 - p0); int i = FindToken(str, pgHbaConnectTypeStrings); if (i >= 0) connectType = (pgHbaConnectType)i; else { connectType = PGC_INVALIDCONF; isComment = true; return; } SkipSpace(p1); const wxChar *p2 = p1; bool quoted = false; while (*p2) { if (!quoted && IsSpaceChar(*p2)) break; if (*p2 == '"') quoted = !quoted; p2++; } database = line.Mid(p1 - line.c_str(), p2 - p1); SkipSpace(p2); const wxChar *p3 = p2; quoted = false; while (*p3) { if (!quoted && IsSpaceChar(*p3)) break; if (*p3 == '"') quoted = !quoted; p3++; } user = line.Mid(p2 - line.c_str(), p3 - p2); SkipSpace(p3); const wxChar *p4 = p3; if (connectType == PGC_LOCAL) { // no ip address } else { bool hasCidr = false; while (*p4 && !IsSpaceChar(*p4)) { if (*p4 == '/') hasCidr = true; p4++; } if (!hasCidr) { SkipSpace(p4); SkipNonspace(p4); } ipaddress = line.Mid(p3 - line.c_str(), p4 - p3); SkipSpace(p4); } const wxChar *p5 = p4; SkipNonspace(p5);//.........这里部分代码省略.........
开发者ID:Timosha,项目名称:pgadmin3,代码行数:101,
示例24: buffer//.........这里部分代码省略......... memmove(buffer + mTokenLen + 1, buffer, bufLen); memcpy(buffer, token, mTokenLen); buffer[mTokenLen] = '/n'; bufLen += (mTokenLen + 1); // need to reset cursor to the buffer again (bug 100595) cursor = buffer; } } char *token = nullptr; // This may get initialized by ParseHeaders and the resulting // HttpResponseHead will be passed to nsPartChannel by SendStart if (mProcessingHeaders) { // we were not able to process all the headers // for this "part" given the previous buffer given to // us in the previous OnDataAvailable callback. bool done = false; rv = ParseHeaders(channel, cursor, bufLen, &done); if (NS_FAILED(rv)) return rv; if (done) { mProcessingHeaders = false; rv = SendStart(channel); if (NS_FAILED(rv)) return rv; } } int32_t tokenLinefeed = 1; while ( (token = FindToken(cursor, bufLen)) ) { if (((token + mTokenLen) < (cursor + bufLen)) && (*(token + mTokenLen + 1) == '-')) { // This was the last delimiter so we can stop processing rv = SendData(cursor, LengthToToken(cursor, token)); if (NS_FAILED(rv)) return rv; if (mPartChannel) { mPartChannel->SetIsLastPart(); } return SendStop(NS_OK); } if (!mNewPart && token > cursor) { // headers are processed, we're pushing data now. NS_ASSERTION(!mProcessingHeaders, "we should be pushing raw data"); rv = SendData(cursor, LengthToToken(cursor, token)); bufLen -= token - cursor; if (NS_FAILED(rv)) return rv; } // XXX else NS_ASSERTION(token == cursor, "?"); token += mTokenLen; bufLen -= mTokenLen; tokenLinefeed = PushOverLine(token, bufLen); if (mNewPart) { // parse headers mNewPart = false; cursor = token; bool done = false; rv = ParseHeaders(channel, cursor, bufLen, &done); if (NS_FAILED(rv)) return rv; if (done) {
开发者ID:AtulKumar2,项目名称:gecko-dev,代码行数:67,
注:本文中的FindToken函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ FindTypeInArray函数代码示例 C++ FindTask函数代码示例 |