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


C++ Alternative类代码示例

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


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

示例1: serialize

		static void serialize(storage_type& s, const Alternative<T1, T2>& in)
			{
			s.serialize(in.isLeft());
			if (in.isLeft())
				s.serialize(in.left());
				else
				s.serialize(in.right());
			}
开发者ID:WantonSoup,项目名称:ufora,代码行数:8,代码来源:Alternative.hpp

示例2: addItem

    void ControlList::addItem(const Alternative<String, const XBMCAddon::xbmcgui::ListItem* > & item, bool sendMessage)
    {
      XBMC_TRACE;

      if (item.which() == first)
        internAddListItem(ListItem::fromString(item.former()),sendMessage);
      else
        internAddListItem(item.later(),sendMessage);
    }
开发者ID:Saner2oo2,项目名称:xbmc,代码行数:9,代码来源:Control.cpp

示例3: Alternative

void AddAlternativeDefinitionImpl::operator()( boost::ptr_vector<Alternative> & alts, boost::ptr_vector<Matcher> & matchers, boost::ptr_map<AttributeKey,Expression> & bindings, const std::string & source, const std::string & transformSource ) const {
	Alternative * alternative = new Alternative( source, transformSource ); // Добавляем новую альтернативу к шаблону

	alternative->addMatchers( matchers ); // Добавляем сопоставители
	alternative->addBindings( bindings ); // Добавляем связывания
	alternative->updateDependencies(); // Обновляем зависимости альтернативы

	alts.push_back( alternative );
}
开发者ID:alesapin,项目名称:lspl,代码行数:9,代码来源:Functions.cpp

示例4: left

		bool operator==(const Alternative& in) const
			{
			if (isLeft() != in.isLeft())
				return false;
			if (isLeft())
				return in.left() == left();
				else
				return in.right() == right();
			}
开发者ID:WantonSoup,项目名称:ufora,代码行数:9,代码来源:Alternative.hpp

示例5: play

    void Player::play(const Alternative<String, const PlayList* > & item,
                      const XBMCAddon::xbmcgui::ListItem* listitem, bool windowed, int startpos)
    {
      XBMC_TRACE;

      if (&item == &defaultPlayParameter)
        playCurrent(windowed);
      else if (item.which() == XBMCAddon::first)
        playStream(item.former(), listitem, windowed);
      else // item is a PlayListItem
        playPlaylist(item.later(),windowed,startpos);
    }
开发者ID:asskikerus,项目名称:xbmc,代码行数:12,代码来源:Player.cpp

示例6: play

    void Player::play(const Alternative<String, const PlayList* > & item,
                      const XBMCAddon::xbmcgui::ListItem* listitem, bool windowed, int startpos)
    {
      TRACE;

      if (Alternative<String, const PlayList*>::isNullReference(item))
        playCurrent(windowed);
      else if (item.which() == XBMCAddon::first)
        playStream(item.former(), listitem, windowed);
      else // item is a PlayListItem
        playPlaylist(item.later(),windowed,startpos);
    }
开发者ID:EternalStare,项目名称:xbmc,代码行数:12,代码来源:Player.cpp

示例7:

void EpsilonNFA::NFAGenerator::visit(Alternative& node)
{
    NFAGenerator left, right;
    node.left()->accept(left);
    node.right()->accept(right);

    adopt_pool(left._pool);
    adopt_pool(right._pool);

    right.start->edges.push_back(Edge{ '\0', left.start });
    left.end->edges.push_back(Edge{ '\0', right.end });

    start = right.start;
    end = right.end;
    end->stateInfo = _info;
}
开发者ID:MichaelSuen-thePointer,项目名称:simpleregex,代码行数:16,代码来源:simpleregexepsilonnfa.cpp

示例8: ParseAtom

// Atom ::= "(" Expression ")" | "[" [^] Range "]" | Characters
Instruction* ParseAtom(const char **ppc, ParseInfo &info)
{
  Instruction *i = 0;
  const char *pc = *ppc;
  
  switch (*pc)
  {
    case '(':
    {
      Group::TriState dnl = Group::Inherit;
      Group::TriState nc = Group::Inherit;
      Group::TriState ml = Group::Inherit;
      bool capture = true;
      bool consume = true;
      bool invert = false;
      bool reverse = false;
      std::string name = "";
      
      ++pc;
      
      if (*pc == '?')
      {
        ++pc;
        if (*pc == '#')
        {
          // skip everything until ) and from behave as if ParseAtom was
          // called starting next character
          ++pc;
          while (*pc != ')')
          {
            if (*pc == '\0')
            {
              return 0;
            }
            ++pc;
          }
          *ppc = ++pc;
          return ParseAtom(ppc, info);
        }
        if (*pc == ':')
        {
          capture = false;
          ++pc;
        }
        else if (*pc == '(')
        {
          // conditional
          ++pc;
          
          std::string cond;
          while (*pc != ')')
          {
            if (*pc == '\0')
            {
              return 0;
            }
            cond.push_back(*pc);
            ++pc;
          }
          ++pc;
          
          Instruction *ci = ParseExpression(&pc, info);
          if (!ci || *pc != ')')
          {
            if (ci)
            {
              delete ci;
            }
            return 0;
          }
          ++pc;
          
          Alternative *alt = dynamic_cast<Alternative*>(ci);
          Instruction *ifTrue, *ifFalse;
          if (alt == 0)
          {
            ifTrue = ci;
            ifFalse = 0;
          }
          else
          {
            ifTrue = alt->first()->clone();
            ifFalse = alt->second()->clone();
            delete alt;
          }
          
          *ppc = pc;
          int index = 0;
          if (sscanf(cond.c_str(), "%d", &index) != 1)
          {
            return new Conditional(cond, ifTrue, ifFalse);
          }
          else
          {
            return new Conditional(index, ifTrue, ifFalse);
          }
        }
        else if (*pc == 'P')
        {
//.........这里部分代码省略.........
开发者ID:gatgui,项目名称:gcore,代码行数:101,代码来源:parse.cpp

示例9:

bool operator | (const Alternative<T1, T2>& alt, const Match<TMatch>& m)
	{
	return (alt.isLeft() ? (alt.left() |  m) : (alt.right() | m));
	}
开发者ID:WantonSoup,项目名称:ufora,代码行数:4,代码来源:Alternative.hpp

示例10: handle_read

 virtual ParserResult handle_read(sip0x::utils::InputTokenStream& iss, FactoryContext* ctx) const override {
   return _alternative.read(iss, ctx);
 }
开发者ID:zanfire,项目名称:sip-0x,代码行数:3,代码来源:TokenSIPMethod.hpp


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