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


C++ GetWord函数代码示例

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


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

示例1: GetWord

bool ieJpegDecoder::GetSOS()
//
// Process SOS (Start of Scan)
//
{
	int length = GetWord() - 3;
	int n = *pbStream++;				//  Number of components
	if ((length != (n * 2 + 3)) || (n < 1) || (n > IE_JPEG_MAX_COMPS)) 
		return false;
    nCompsInScan = n;

    // Collect color component id's and Huffman table indexes
	for (int i = 0; i < n; i++) {

		int cCompId = *pbStream++;
		int cTables = *pbStream++;
		length -= 2;

		PjdCompInfo pComp = nullptr;
		for (int ci = 0; ci < nComps; ci++) {
			if (cCompId == aComps[ci].iId) {
				pComp = &aComps[ci];
				break;
			}
        }
		if (!pComp) return false;

		apCompInfos[i] = pComp;

		pComp->iDCTable = cTables >> 4;
		pComp->iACTable = cTables & 0xF;
	}

    // Collect the additional scan parameters Ss, Se, Ah/Al.
  	Progressive.Ss = *pbStream++;				// Start of spectral selection, 0 for baseline
	Progressive.Se = *pbStream++;				// End of spectral selection, DCTSIZE2-1 for baseline
	BYTE c = *pbStream++;						// 0 for baseline
	Progressive.Ah = (c >> 4) & 0xF;			// Successive approximation high bit
	Progressive.Al = (c     ) & 0xF;    		// Successive approximation low bit
    length -= 3;
    iScanNumber++;

	pbStream += length;

	return true;
}
开发者ID:FMJ-Software,项目名称:ieCpp,代码行数:46,代码来源:ief_jpeg_Marker.cpp

示例2: while

unsigned long 
NALUnit::GetUE()
{
    // Exp-Golomb entropy coding: leading zeros, then a one, then
    // the data bits. The number of leading zeros is the number of
    // data bits, counting up from that number of 1s as the base.
    // That is, if you see
    //      0001010
    // You have three leading zeros, so there are three data bits (010)
    // counting up from a base of 111: thus 111 + 010 = 1001 = 9
    int cZeros = 0;
    while (GetBit() == 0)
    {
        cZeros++;
    }
    return GetWord(cZeros) + ((1 << cZeros)-1);
}
开发者ID:VtsBlack,项目名称:gdcl-mpeg-4-mux,代码行数:17,代码来源:NALUnit.cpp

示例3: theCTCP

void ClientAgent::CTCPAction(BString theTarget, BString theMsg)
{
	BString theCTCP(GetWord(theMsg.String(), 1).ToUpper()),
		theRest(RestOfString(theMsg.String(), 2)), tempString("[CTCP->");

	tempString += theTarget;
	tempString += "] ";
	tempString += theCTCP;

	if (theRest != "-9z99") {
		tempString += " ";
		tempString += theRest;
		tempString += '\n';
	} else
		tempString += '\n';

	Display(tempString.String(), C_CTCP_REQ, C_BACKGROUND, F_SERVER);
}
开发者ID:HaikuArchives,项目名称:Vision,代码行数:18,代码来源:ClientAgent.cpp

示例4: GetNumeric

uint32 SOMFRecordPointer::UnpackLIDATABlock(int8 * destination, uint32 MaxSize) {
   // Unpack Data block in LIDATA record recursively and store data at destination
   uint32 RepeatCount = GetNumeric();            // Outer repeat count
   uint32 BlockCount  = GetWord();               // Inner repeat count
   uint32 Size = 0;                              // Size of data expanded so far
   uint32 RSize;                                 // Size of recursively expanded data
   uint32 SaveIndex;                             // Save Index for repetition
   uint32 i, j;                                  // Loop counters
   if (BlockCount == 0) {
      // Contains one repeated block
      Size = GetByte();                          // Size of repeated block
      if (RepeatCount * Size > MaxSize) {
         // Data outside allowed area
         err.submit(2310);                       // Error message
         Index += Size;                          // Point to after block
         return 0;                               // No data stored
      }

      // Loop RepeatCount times
      for (i = 0; i < RepeatCount; i++) {
         // copy data block into destination
         memcpy(destination, buffer + FileOffset + Index, Size);
         destination += Size;
      }
      Index += Size;                             // Point to after block
      return RepeatCount * Size;                 // Size of expanded data
   }
   // Nested repeat blocks
   SaveIndex = Index;
   // Loop RepeatCount times
   for (i = 0; i < RepeatCount; i++) {
      // Go back and repeat unpacking
      Index = SaveIndex;
      // Loop BlockCount times
      for (j = 0; j < BlockCount; j++) {
         // Recursion
         RSize = UnpackLIDATABlock(destination, MaxSize);
         destination += RSize;
         MaxSize -= RSize;
         Size += RSize;
      }
   }
   return Size;
}
开发者ID:DinrusGroup,项目名称:DRC,代码行数:44,代码来源:omf.cpp

示例5: CheckIfGuidance

int CheckIfGuidance(char *line,int isLabel)
{
	int i;
	char *word;

	i = isLabel ? isLabel + 2 : 0;
	/* Ignore spaces */
	while(isspace(line[i]))
		i++;

	if (line[i++]=='.')
	{
		word=GetWord(&line[i],' ');
		if(strcmp(word,"extern")==0)
		{
			/* Step over .extern word in line */
			i+=7;
			/* Ignore spaces */
			while(isspace(line[i]))
				i++;

			HandleExtern(&line[i]);
			return 1;
		}
		else if(strcmp(word,"entry")==0)
		{
			i+=6;
			while(isspace(line[i]))
				i++;
			HandleEntry(&line[i],&constInstructionArr[MAX_INSTRUCTION-1]);
			return 1;
		}
		else
		{
			printf("Error! in Line %d  :%s  , illegal command \n", countLine, line);
			SeconnedPhaseSucess=0;
		}
	}
	else
	{
		return 0;
	}
	return 0;
}
开发者ID:DiCookieMonster,项目名称:C-OS-compiler-implementation,代码行数:44,代码来源:instruction_Check.c

示例6: YForkThread

int __cdecl CYahooProto::SendMsg( HANDLE hContact, int flags, const char* pszSrc )
{
	DBVARIANT dbv;
	char *msg;
	int  bANSI;

	bANSI = 0;/*GetByte( "DisableUTF8", 0 );*/

	if (!m_bLoggedIn) {/* don't send message if we not connected! */
		YForkThread( &CYahooProto::im_sendackfail, hContact );
		return 1;
	}

	if (bANSI) 
		/* convert to ANSI */
		msg = ( char* )pszSrc;
	else if ( flags & PREF_UNICODE )
		/* convert to utf8 */
		msg = mir_utf8encodeW(( wchar_t* )&pszSrc[ strlen(pszSrc)+1 ] );
	else if ( flags & PREF_UTF )
		msg = mir_strdup(( char* )pszSrc );
	else
		msg = mir_utf8encode(( char* )pszSrc );

	if (lstrlenA(msg) > 800) {
		YForkThread( &CYahooProto::im_sendackfail_longmsg, hContact );
		return 1;
	}

	if (!DBGetContactSettingString( hContact, m_szModuleName, YAHOO_LOGINID, &dbv)) {
		send_msg(dbv.pszVal, GetWord( hContact, "yprotoid", 0), msg, (!bANSI) ? 1 : 0);

		if (!bANSI)
			mir_free(msg);

		YForkThread( &CYahooProto::im_sendacksuccess, hContact );

		DBFreeVariant(&dbv);
		return 1;
	}

	return 0;
}
开发者ID:TonyAlloa,项目名称:miranda-dev,代码行数:43,代码来源:im.cpp

示例7: GetByte

uint8 SOMFRecordPointer::GetNext(uint32 align) {
   // Get next record. Returns record type, made even. Returns 0 if finished
   // align = alignment after MODEND records = page size. Applies to lib files only
   FileOffset += End + 1;

   // Check if alignment needed
   if (align > 1 && Type2 == OMF_MODEND) {
      // Align after MODEND record in library
      FileOffset = (FileOffset + align - 1) & - (int32)align;
   }
   if (FileOffset >= FileEnd) return 0;          // End of file
   Index = 0;                                    // Start reading record
   Type = GetByte();                             // Get record type
   Type2 = Type;  if (Type2 < OMF_LIBHEAD) Type2 &= ~1; // Make even
   uint16 RecordSize = GetWord();                // Get record size
   End = Index + RecordSize - 1;                 // Point to checksum byte
   if (FileOffset + RecordSize + 3 > FileEnd) err.submit(2301); // Extends beyond end of file
   return Type2;
}
开发者ID:DinrusGroup,项目名称:DRC,代码行数:19,代码来源:omf.cpp

示例8: SCPI_FirstIsInt

//---------------------------------------------------------------------------------------------------------------------------------------------------
bool SCPI_FirstIsInt(uint8 *buffer, int *value, int min, int max)
{
    Word param;
    if (GetWord(buffer, &param, 0))
    {
#ifdef WIN32
        char n[10];
#else
        char n[param.numSymbols + 1];
#endif
        memcpy(n, param.address, param.numSymbols);
        n[param.numSymbols] = '\0';
        if (String2Int(n, value) && *value >= min && *value <= max)
        {
            return true;
        }
    }
    return false;
}
开发者ID:Sasha7b9,项目名称:Osci,代码行数:20,代码来源:SCPI.c

示例9: GetSize

bool Phrase::operator== (const Phrase &other) const
{
  size_t thisSize = GetSize()
                    ,compareSize = other.GetSize();
  if (thisSize != compareSize) {
    return false;
  }

  for (size_t pos = 0 ; pos < thisSize ; pos++) {
    const Word &thisWord	= GetWord(pos)
                            ,&otherWord	= other.GetWord(pos);
    bool ret = thisWord == otherWord;
    if (!ret) {
      return false;
    }
  }

  return true;
}
开发者ID:hschreib,项目名称:mosesdecoder,代码行数:19,代码来源:Phrase.cpp

示例10: GetName

/*
 *
 * Function GetName,
 *  Copies a name from the OBJ file into the ObjInfo Structure.
 *
 */
void GetName( FILE *infile, TCHAR *szName , DWORD *lSize)
{
    WORD i = 0;

    do
    {

#ifdef RLRES16

        szName[ i ] = GetByte( infile, lSize);

#else

        szName[ i ] = GetWord( infile, lSize);

#endif
    
    } while ( szName[ i++ ] != TEXT('\0') );
}
开发者ID:mingpen,项目名称:OpenNT,代码行数:25,代码来源:resread.c

示例11: GetMatchLens

// this function looks for portions of the text that can be skipped because it
// begins with a word to ignore or one of its synonyms.
// note that more than one item could match, all should be tried
vector<size_t> CWord_substitution :: GetMatchLens(const string& text, const string& pattern, char prev_char) const
{
    vector<size_t> match_lens;
    size_t len;

    if (!IsSetWord()) {
        // doesn't make sense
    } else if (!NStr::StartsWith(pattern, GetWord(), GetCase_sensitive() ? NStr::eCase : NStr::eNocase)) {
        // no match
    } else if (IsSetSynonyms()) {
        ITERATE(CWord_substitution::TSynonyms, syn, GetSynonyms()) {
            len = (*syn).length();
            if (NStr::StartsWith(text, *syn, GetCase_sensitive() ? NStr::eCase : NStr::eNocase)
                && (!IsSetWhole_word()
                        || (IsWordBoundary(prev_char) && IsWordBoundary(text.c_str()[len])))) {
                // text matches synonym
                match_lens.push_back(len);            
            }
        }
    } else {
开发者ID:svn2github,项目名称:ncbi_tk,代码行数:23,代码来源:Word_substitution.cpp

示例12: switch

//"因子"语法分析
bool KH::GrammarPL0::FactorParsing()
{
	bool result = true;

	switch( GetWord(false).GetSign())
	{
		case KH::_IDENTIFIER://因子可以是一个常量或变量
			Sa.ExistVariable(GetLine(),GetWord(false).GetValue());

			//Gen  ident
			GenPush(GetWord(false).GetValue());
			 skip(1);
			break;

		case KH::_INT:	//因子可以是一个数
		case KH::_FLOAT:
			//Gen  ident
			GenPush(GetWord(false).GetValue());
			 skip(1);
			break;

		case KH::_LPAREN :	//如果看到左括号'('
			//Gen (
			GenPush(" ( ");
			 skip(1);

			if(!ExpressionParsing())
			{
				Error( result," Factor Error , There should be a Expression .");
			}

			if( GetWord(false).GetSign() == KH::_RPAREN)//"表达式"后面应是右括号')'
			{
				//Gen )
				GenPush(" ) ");
				 skip(1);
			}
			else{
				Error( result," Factor Error , There should be a Right Paren : " + GetWord(false).GetValue());
			}

			break;

		default:	
			Error( result," Factor Error , There should be a Factor .");
			break;
	}//End of switch
	return result;
}
开发者ID:gloria50311,项目名称:ThePL0Compiler,代码行数:50,代码来源:GrammarAnalysis.cpp

示例13: SkipPrep

void SkipPrep(void)		/* Skip any preposition which is next word */
{
	char *a=WordPtr;
	WLIST *b=GetWord();
	if(b==(WLIST *)-1)
	{
		WordPtr=a;
		return;
	}
	if(b==NULL)
	{
		WordPtr=a;
		return;
	}
	if(b->wd_Type!=WD_PREP)
	{
		WordPtr=a;
		return;
	}
}
开发者ID:facet42,项目名称:AberMUD,代码行数:20,代码来源:Parser.c

示例14: ReadDict

/* EXPORT->ReadDict: read and store a dictionary definition */
ReturnStatus ReadDict(char *dictFn, Vocab *voc)
{
   LabId labels[MAXPHONES+4];
   Source src;
   Word word;
   float prob;
   int nphones;
   ReturnStatus ret;

   if(InitSource(dictFn,&src,DictFilter)<SUCCESS){
      HRError(8010,"ReadDict: Can't open file %s", dictFn);
      return(FAIL);
   }
   if (trace&T_TOP)
      printf("\nLoading Dictionary from %s\n",dictFn);
   if((ret=ReadDictWord(&src,labels,&prob, &nphones))<SUCCESS){
      CloseSource(&src);
      HRError(8013,"ReadDict: Dict format error in first entry");
      return(FAIL);
   }
   while(nphones>=0){
      word = GetWord(voc,labels[0],TRUE);
      if (labels[1]==NULL) labels[1]=labels[0];
      if (labels[1]->name[0]==0) labels[1]=NULL;
      if (voc->nullWord->wordName == word->wordName)
         HRError(-8013,"ReadDict: !NULL entry contains pronunciation");
      NewPron(voc,word,nphones,labels+2,labels[1],prob);
      if((ret=ReadDictWord(&src,labels,&prob, &nphones))<SUCCESS){
         HRError(8013,"ReadDict: Dict format error");
         return(FAIL);
      }
   }
   CloseSource(&src);

   if (trace&T_DIC)
      ShowDict(voc);
   if (trace&T_TOP)
      printf("Dictionary loaded from %s with %d words and %d prons\n\n",
             dictFn,voc->nwords,voc->nprons);
   return(SUCCESS);
}
开发者ID:botonchou,项目名称:AlgoFinal,代码行数:42,代码来源:HDict.c

示例15: GetWord

// This method writes text to the screen in "paragraph" mode, staying within
// the bounds of the window and scrolling the window upward if necessary
void CursWin::WriteText(char* txt, bool ref) {
    char nextWord[100], *temp = txt;
    char blankWord[2] = "";
    if (((strlen(txt)-1) + curColPos) > maxColPos) {
        temp = GetWord(temp,nextWord);
        if (strlen(nextWord) + curColPos > maxColPos) {
            char* t2 = &(nextWord[0]);
            Writes(blankWord,false);
            while ((*t2 == ' ') || (*t2 == '\n') || (*t2 == '\t')) {
                t2++;
            }
            Write(t2,false);
        }
        else Write(nextWord,false);
        WriteText(temp, false);
    }
    else {
        Write(txt, false);
    }
    if (ref) refresh();
}
开发者ID:ThereIsNoEscape,项目名称:uidaho,代码行数:23,代码来源:CursWin.cpp


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