• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ Peek函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: Insert

void Insert (Item X, int position, List *L) {
	ListNode *p, *q;
	assert(position >= 0);
	assert(position <= L->size);
	
	L->size++;
	q=(ListNode *)malloc(sizeof(ListNode));
	copyItem(&q->item,X);
			 
	if(position==0) {
		q->next=L->first;
		L->first=q;
	}
	else {
		p=moveTo(position-1,L);
		q->next=p->next;
		p->next=q;
	}
	assert(Empty(L) == 0);
	assert(Size(L) == L->size);
	Peek(position, L, &X);
	assert(strcmp(q->item.name, X.name) == 0);
	assert(q->item.grade == X.grade);
	
}
开发者ID:cmarcott,项目名称:CIS2520,代码行数:25,代码来源:ListImplementation.c


示例2: AttachedTransformation

size_t BufferedTransformation::Peek(byte &outByte) const
{
	if (AttachedTransformation())
		return AttachedTransformation()->Peek(outByte);
	else
		return Peek(&outByte, 1);
}
开发者ID:Phoul,项目名称:pycryptopp,代码行数:7,代码来源:cryptlib.cpp


示例3: ReadUntil

nsresult nsScanner::ReadUntil(nsScannerSharedSubstring& aString,
                              const nsReadEndCondition& aEndCondition,
                              PRBool addTerminal)
{  
  if (!mSlidingBuffer) {
    return kEOF;
  }

  nsScannerIterator origin, current;
  const PRUnichar* setstart = aEndCondition.mChars;
  const PRUnichar* setcurrent;

  origin = mCurrentPosition;
  current = origin;

  PRUnichar         theChar=0;
  nsresult          result=Peek(theChar);

  if (NS_FAILED(result)) {
    return result;
  }
  
  while (current != mEndPosition) {
    theChar = *current;
    if (theChar == '\0') {
      ReplaceCharacter(current, sInvalid);
      theChar = sInvalid;
    }

    // Filter out completely wrong characters
    // Check if all bits are in the required area
    if(!(theChar & aEndCondition.mFilter)) {
      // They were. Do a thorough check.

      setcurrent = setstart;
      while (*setcurrent) {
        if (*setcurrent == theChar) {
          if(addTerminal)
            ++current;
          AppendUnicodeTo(origin, current, aString);
          SetPosition(current);

          //DoErrTest(aString);

          return NS_OK;
        }
        ++setcurrent;
      }
    }
    
    ++current;
  }

  // If we are here, we didn't find any terminator in the string and
  // current = mEndPosition
  SetPosition(current);
  AppendUnicodeTo(origin, current, aString);
  return FillBuffer();
}
开发者ID:rn10950,项目名称:RetroZilla,代码行数:59,代码来源:nsScanner.cpp


示例4: ReadTagIdentifier

/**
 *  Consume characters until you run into space, a '<', a '>', or a '/'.
 *  
 *  @param   aString - receives new data from stream
 *  @return  error code
 */
nsresult nsScanner::ReadTagIdentifier(nsScannerSharedSubstring& aString) {

  if (!mSlidingBuffer) {
    return kEOF;
  }

  PRUnichar         theChar=0;
  nsresult          result=Peek(theChar);
  nsScannerIterator current, end;
  PRBool            found=PR_FALSE;  
  
  current = mCurrentPosition;
  end = mEndPosition;

  // Loop until we find an illegal character. Everything is then appended
  // later.
  while(current != end && !found) {
    theChar=*current;

    switch(theChar) {
      case '\n':
      case '\r':
      case ' ' :
      case '\t':
      case '\v':
      case '\f':
      case '<':
      case '>':
      case '/':
        found = PR_TRUE;
        break;

      case '\0':
        ReplaceCharacter(current, sInvalid);
        break;

      default:
        break;
    }

    if (!found) {
      ++current;
    }
  }

  // Don't bother appending nothing.
  if (current != mCurrentPosition) {
    AppendUnicodeTo(mCurrentPosition, current, aString);
  }

  SetPosition(current);  
  if (current == end) {
    result = FillBuffer();
  }

  //DoErrTest(aString);

  return result;
}
开发者ID:rn10950,项目名称:RetroZilla,代码行数:65,代码来源:nsScanner.cpp


示例5: BuildSignatureDatabaseSearchMachine

int BuildSignatureDatabaseSearchMachine(signature_db* SignatureDatabase)
{
  if (!SignatureDatabase)
    return -1;

  if (!SignatureDatabase->Trie && BuildSignatureDatabaseTrie(SignatureDatabase) != 0)
    return -1;

  InitializeSearchMachine(SignatureDatabase->SearchMachine, SignatureDatabase->Trie);

  search_machine* SM = SignatureDatabase->SearchMachine;

  // Phase 2
  queue* Queue = xcalloc(1, sizeof(queue));
  InitializeQueue(Queue);

  for (size_t AlphabetIndex = 0; AlphabetIndex < UNIT_CARDINALITY; ++AlphabetIndex)
  {
    trie* Node = SM->Goto[ROOT_IDENTIFIER][AlphabetIndex];
    //if (Node && Node->Identifier != ROOT_IDENTIFIER)
    if (!Node || Node->Identifier != ROOT_IDENTIFIER)
    {
      SM->Fail[Node->Identifier] = SM->Trie;
      Enqueue(Queue, Node);
    }
  }

  while (Peek(Queue) != NULL)
  {
    trie* R = Dequeue(Queue);

    for (size_t AlphabetIndex = 0; AlphabetIndex < UNIT_CARDINALITY; ++AlphabetIndex)
    {
      trie* S = SM->Goto[R->Identifier][AlphabetIndex];

      // Not 100% about this
      if (S)
      {
        Enqueue(Queue, S);
        trie* ST = SM->Fail[R->Identifier];

        // Not 100% about this
        while (!SM->Goto[ST->Identifier][AlphabetIndex])
        {
          ST = SM->Fail[ST->Identifier];
        }

        SM->Fail[S->Identifier] = SM->Goto[ST->Identifier][AlphabetIndex];

        // out(u) = out(u) UNION out(fail(u))
        SM->Out[S->Identifier] = UniqExtendList(SM->Out[S->Identifier], SM->Out[SM->Fail[S->Identifier]->Identifier]);
      }
    }
  }

  FreeQueue(Queue);
  Queue = NULL;
  return 0;
}
开发者ID:trailofbits,项目名称:cb-multios,代码行数:59,代码来源:sigdb.c


示例6: MOZ_ASSERT

/**
 * Scan an AtKeyword token.  Also handles production of Symbol when
 * an '@' is not followed by an identifier.
 */
bool
nsCSSScanner::ScanAtKeyword(nsCSSToken& aToken)
{
  MOZ_ASSERT(Peek() == '@', "should not have been called");

  // Fall back for when '@' isn't followed by an identifier.
  aToken.mSymbol = '@';
  Advance();

  int32_t ch = Peek();
  if (StartsIdent(ch, Peek(1))) {
    if (GatherText(IS_IDCHAR, aToken.mIdent)) {
       aToken.mType = eCSSToken_AtKeyword;
     }
  }
  return true;
}
开发者ID:AtulKumar2,项目名称:gecko-dev,代码行数:21,代码来源:nsCSSScanner.cpp


示例7: showListContent

static void showListContent (List *L) {
	int i;
	Student S;
	for(i=0;i<Size(L);i++) {
		Peek(i,L,&S);
		printf("\t%s %d%%\n",NameOfStudent(S),GradeOfStudent(S));
		FreeStudent(&S);
	}
}
开发者ID:cmarcott,项目名称:CIS2520,代码行数:9,代码来源:myProgram.c


示例8: Term

// <bool_term>       ::= <bool_not_factor> [<and_op> <bool_not_factor]*
void Term(CPU *cpu, Files file){
    NotFactor(cpu, file);
    while(Peek("&&", file)){
        Match("&&", file);
        NotFactor(cpu, file);
        cpu->PopValue();
        cpu->BooleanAnd();
    }
}
开发者ID:FlyingJester,项目名称:EmeraldC,代码行数:10,代码来源:boolean_expression.cpp


示例9: Expression

// <bool_expression> ::= <bool_term> [<or_op> <bool_term]*
void Expression(CPU *cpu, Files file){
    Term(cpu, file);
    while(Peek("||", file)){
        Match("||", file);
        Term(cpu, file);
        cpu->PopValue();
        cpu->BooleanOr();
    }
}
开发者ID:FlyingJester,项目名称:EmeraldC,代码行数:10,代码来源:boolean_expression.cpp


示例10: Peek

const Token *TokenStream::PeekIf(const TokenTypeSet &typeSet) const
{
	const Token *token = Peek();
	if (typeSet.Contains(token->GetTokenType()))
	{
		return token;
	}
	return nullptr;
}
开发者ID:bondscripting,项目名称:bond,代码行数:9,代码来源:tokenstream.cpp


示例11: Peek

bool Tokenizer::CondRead(SYMBOL kind) {
  const Token* T = Peek();
  if (T->kind() == kind) {
    Get( );
    return true;
  } else {
    return false;
  }
}
开发者ID:shayne1993,项目名称:ComputerGraphicProjects,代码行数:9,代码来源:Tokenizer.cpp


示例12: return

double basisfield::PeekWide(int i, int j, int k, FieldIndex fi)
{
  if (!(i<0 || j<0 || k<0 || static_cast<unsigned int>(i)>=FieldSz_x() || static_cast<unsigned int>(j)>=FieldSz_y() || static_cast<unsigned int>(k)>=FieldSz_z())) {  // Inside "valid" FOV
    return(Peek(static_cast<unsigned int>(i),static_cast<unsigned int>(j),static_cast<unsigned int>(k),fi));
  }
  else {
    return(peek_outside_fov(i,j,k,fi));
  }
}
开发者ID:valentinalorenzetti,项目名称:FriendENGINE,代码行数:9,代码来源:basisfield.cpp


示例13: Compare

	bool Compare(BufferedLineReader &other) {
		if (Peek(0) != other.Peek(0)) {
			return false;
		}

		Skip(1);
		other.Skip(1);
		return true;
	}
开发者ID:18859966862,项目名称:ppsspp,代码行数:9,代码来源:Compare.cpp


示例14: ActorPhysicsSetVelocity

int LuaBinding::ActorPhysicsSetVelocity()
{
    int actorId = 0;
    Vector2f velocity;
    if (!Peek(1, &actorId) || !Peek(2, &velocity))
    {
        return ERROR_TYPE_PARAMETER;
    }

    const boost::shared_ptr<ActorPropertyPhysics> property = LuaBinding::GetActorProperty<ActorPropertyPhysics>(actorId);
    if (!property)
    {
        return ERROR_TYPE_STATE;
    }

    property->SetVelocity(velocity);
    return 0;
}
开发者ID:FooSoft,项目名称:moonfall,代码行数:18,代码来源:LuaBindingActorPhysics.cpp


示例15: ActorSetPosition

int LuaBinding::ActorSetPosition()
{
    int actorId = 0;
    Vector2i position;
    if (!Peek(1, &actorId) || !Peek(2, &position))
    {
        return ERROR_TYPE_PARAMETER;
    }

    const boost::shared_ptr<Actor> actor = GetActor(actorId);
    if (!actor)
    {
        return ERROR_TYPE_STATE;
    }

    actor->SetPosition(position);
    return 0;
}
开发者ID:FooSoft,项目名称:moonfall,代码行数:18,代码来源:LuaBindingActor.cpp


示例16: ActorSetLayer

int LuaBinding::ActorSetLayer()
{
    int actorId = 0;
    int actorLayer = ACTOR_LAYER_COUNT;
    if (!Peek(1, &actorId) || !Peek(2, &actorLayer) || actorLayer >= ACTOR_LAYER_COUNT)
    {
        return ERROR_TYPE_PARAMETER;
    }

    const boost::shared_ptr<Actor> actor = GetActor(actorId);
    if (!actor)
    {
        return ERROR_TYPE_STATE;
    }

    actor->SetLayer(static_cast<ActorLayer>(actorLayer));
    return 0;
}
开发者ID:FooSoft,项目名称:moonfall,代码行数:18,代码来源:LuaBindingActor.cpp


示例17: ActorIsShapeEnabled

int LuaBinding::ActorIsShapeEnabled()
{
    int actorId = 0;
    int actorShapeType = ACTOR_SHAPE_TYPE_COUNT;
    if (!Peek(1, &actorId) || !Peek(2, &actorShapeType) || actorShapeType >= ACTOR_SHAPE_TYPE_COUNT)
    {
        return ERROR_TYPE_PARAMETER;
    }

    const boost::shared_ptr<Actor> actor = GetActor(actorId);
    if (!actor)
    {
        return ERROR_TYPE_STATE;
    }

    Push(actor->IsShapeEnabled(static_cast<ActorShapeType>(actorShapeType)));
    return 1;
}
开发者ID:FooSoft,项目名称:moonfall,代码行数:18,代码来源:LuaBindingActor.cpp


示例18: ActorHasProperty

int LuaBinding::ActorHasProperty()
{
    int actorId = 0;
    int actorPropertyType = ACTOR_PROPERTY_TYPE_COUNT;
    if (!Peek(1, &actorId) || !Peek(2, &actorPropertyType) || actorPropertyType >= ACTOR_PROPERTY_TYPE_COUNT)
    {
        return ERROR_TYPE_PARAMETER;
    }

    const boost::shared_ptr<Actor> actor = GetActor(actorId);
    if (!actor)
    {
        return ERROR_TYPE_STATE;
    }

    Push(actor->HasProperty(static_cast<ActorPropertyType>(actorPropertyType)));
    return 1;
}
开发者ID:FooSoft,项目名称:moonfall,代码行数:18,代码来源:LuaBindingActor.cpp


示例19: Peek

void Parser::assignments(MethodGenerationContext* mgenc, list<StdString>& l) {
    if (symIsIdentifier()) {
        l.push_back(assignment(mgenc));
        Peek();
        
        if (nextSym == Assign)
            assignments(mgenc, l);
    }
}
开发者ID:SOM-st,项目名称:SOMpp,代码行数:9,代码来源:Parser.cpp


示例20: GetLine

/*****************************************************************************
 * GetLine: Internal function used to dup a line of string from the buffer
 *****************************************************************************/
static char* GetLine( demux_t *p_demux, int *p_pos )
{
    demux_sys_t *p_sys = p_demux->p_sys;
    const uint8_t *p_buf;
    int         i_size;
    int         i;
    char        *p_line;

    while( *p_pos >= p_sys->i_data_peeked )
    {
        if( ! Peek( p_demux, false ) )
        {
            return NULL;
        }
    }
    p_buf = p_sys->p_peek + *p_pos;
    i_size = p_sys->i_data_peeked - *p_pos;
    i = 0;
    while( p_buf[i] != '\n' )
    {
        i++;
        if( i == i_size )
        {
            if( ! Peek( p_demux, false ) )
            {
                return NULL;
            }
            p_buf = p_sys->p_peek + *p_pos;
            i_size = p_sys->i_data_peeked - *p_pos;
        }
    }
    *p_pos += ( i + 1 );
    if( i > 0 && '\r' == p_buf[i - 1] )
    {
        i--;
    }
    p_line = malloc( i + 1 );
    if( p_line == NULL )
        return NULL;
    strncpy ( p_line, (char*)p_buf, i );
    p_line[i] = '\0';
//    msg_Dbg( p_demux, "i = %d, pos = %d, %s", i, *p_pos, p_line );
    return p_line;
}
开发者ID:Flameeyes,项目名称:vlc,代码行数:47,代码来源:mjpeg.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ PeekMessage函数代码示例发布时间:2022-05-30
下一篇:
C++ PcdGetPtr函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap