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


C++ OFormatter类代码示例

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


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

示例1: SaveTxt

void SG_CoordContext::SaveTxt( OFormatter &txt, SynGram &sg ) const
{
 const UCString &class_name = sg.classes()[iclass].GetName();

 txt.printf(
            " %us:\"???\" { "
            , class_name.c_str()
           );

 for( Container::size_type k=0; k<coords.size(); k++ )
  {
   const int icoord = coords[k].GetCoord().GetIndex();
   const int istate = coords[k].GetState();

   const UCString &coord_name = sg.coords()[ icoord ].GetName().front();

   if( !sg.coords()[icoord].states().size() )
    {
     if( istate!=0 )
      txt.printf( " %us", coord_name.c_str() );
     else
      txt.printf( " ~%us", coord_name.c_str() );
    }
   else
    {
     const UCString &state_name = sg.coords()[ icoord ].GetStateName( istate );
     txt.printf( " %us:%us", coord_name.c_str(), state_name.c_str() );
    }
  }

 txt.printf( " }" );

 return;
}
开发者ID:mcdir,项目名称:GrammarEngine,代码行数:34,代码来源:sg_coord_context.cpp

示例2: SaveTagsTxt

void SG_NetLink::SaveTagsTxt( OFormatter &txtfile, SynGram &gram ) const
{
 if( tags!=0 )
  {
   txtfile.printf( " tags { " );

   SG_TagsList tags_ptr = gram.Get_Net().tag_sets->operator [](tags);

   for( lem::Container::size_type i=0; i<tags_ptr->size(); ++i )
    {
     const int itag = (*tags_ptr)[i].first;
     const int ival = (*tags_ptr)[i].second;

     const ThesaurusTag &tag = gram.Get_Net().GetTagDefs()[itag];

     txtfile.printf( " \"%us\"", tag.GetName().c_str() );

     if( ival!=UNKNOWN )
      {
       const lem::UCString &val = tag[ival];
       txtfile.printf( "=\"%us\"", val.c_str() );        
      }

     txtfile.printf( " }" );     
    }
  }

 return;
}
开发者ID:Koziev,项目名称:GrammarEngine,代码行数:29,代码来源:sg_net_link.cpp

示例3: SaveTxt

void SG_EntryForm::SaveTxt(
                           OFormatter& txtfile,
                           Grammar &gram,
                           const SG_Entry &entry
                          ) const
{
 const GramClass &c = gram.classes()[ entry.GetClass() ];
 txtfile.printf( "  " );

 for( Container::size_type i=0; i<coords().size(); i++ )
  {
   const GramCoordPair cp = coords()[i];

   if( find( c.attrs(), cp.GetCoord() )!=UNKNOWN )
    continue;

   const GramCoord& c = gram.coords()[cp.GetCoord().GetIndex()];
   const UCString& dim_name = c.GetName()[cp.GetCoord().GetVar()];

   if( !c.states().empty() )
    {
     const UCString &state_name = c.GetStateName(cp.GetState());

     if( c.IsDefState(cp.GetState()) && c.IsHeadState(cp.GetState() ) )
      txtfile.printf(
                     "%us%us%us%us%us ",
                     dim_name.c_str(),
                     sol_get_token(B_COLON).c_str(),
                     sol_get_token(B_OROUNDPAREN).c_str(),
                     state_name.c_str(),
                     sol_get_token(B_CROUNDPAREN).c_str()
                    );
     else
      txtfile.printf(
                     "%us%us%us ",
                     dim_name.c_str(),
                     sol_get_token(B_COLON).c_str(),
                     state_name.c_str()
                    );
    }
   else
    {
     UCString prefix;

     if(!cp.GetState())
      prefix=sol_get_token(B_NEGATIVE);

     txtfile.printf( "%us%us ", prefix.c_str(), dim_name.c_str() );
    }
  }

 txtfile.printf(
                " %us %us %us\n",
                sol_get_token(B_OFIGPAREN).c_str(),
                content->c_str(),
                sol_get_token(B_CFIGPAREN).c_str()
               );
 return;
}
开发者ID:mcdir,项目名称:GrammarEngine,代码行数:59,代码来源:sg_form.cpp

示例4: SaveTxtPreciser

void Word_Form::SaveTxtPreciser(
                                OFormatter &txtfile,
                                const SynGram *gram
                               ) const
{
 if( !gram )
  return;

 const int npair = GetnPair();
 for( int ipair=0; ipair<npair; ipair++ )
  {
   if(ipair) txtfile.uprintf(L' ');

   const GramCoordAdr icoord = GetPair(ipair).GetCoord();
   const int istate          = GetPair(ipair).GetState();
   const UCString dim_name     = gram->coords()[icoord.GetIndex()].GetName().front();

   if( gram->coords()[icoord.GetIndex()].states().empty() )
    {
     if( istate==ANY_STATE )
      txtfile.printf(
                     "%us%us%us"
                     , dim_name.c_str()
                     , sol_get_token(B_COLON).c_str()
                     , sol_get_token(B_ANY).c_str()
                    );
     else
      {
       // Бистабильные координаты выводим особым образом
       const UCString prefix = istate ?
                                        UCString("") :
                                        sol_get_token(B_NEGATIVE);
       txtfile.printf( "%us%us", prefix.c_str(), dim_name.c_str() );
      }
    }
   else
    {
     UCString state_name;

     if( istate!=ANY_STATE )
      state_name = gram->coords()[icoord.GetIndex()].GetStateName(istate);
     else
      state_name = sol_get_token(B_ANY);

     txtfile.printf(
                    "%us%us%us"
                    , dim_name.c_str()
                    , sol_get_token(B_COLON).c_str()
                    , state_name.c_str()
                   );
    }
  }

 return;
}
开发者ID:mcdir,项目名称:GrammarEngine,代码行数:55,代码来源:word_form.cpp

示例5: Print

// ********************************************************************
// Распечатка карты: краткая информация для прочтения программистом в
// отладочных целях.
// ********************************************************************
void SG_EntryGroup::Print( OFormatter &out ) const
{
 if( key.second==0 )
  out.printf( "%uc -> ", key.first );
 else if( key.third==0 )
  out.printf( "%uc%uc -> ", key.first, key.second );
 else
  out.printf( "%uc%uc%uc -> ", key.first, key.second, key.third );

 const int n=CastSizeToInt(size());
 out.printf( "%d item(s), ", n );

 if( !int1.empty() )
  out.printf( "[%d...%d] ", int1.from, int1.from+int1.n-1 );

 if( !int2.empty() )
  out.printf( "[%d...%d] ", int2.from, int2.from+int2.n-1 );

 if( !ientry.empty() )
  {
   out.printf( "{ " );

   for( Container::size_type i=0; i<ientry.size(); i++ )
    out.printf( "%d ", ientry[i] );

   out.printf( "}" );
  }

 return;
}
开发者ID:mcdir,项目名称:GrammarEngine,代码行数:34,代码来源:sg_entry_group.cpp

示例6: Save_SQL

void ThesaurusTag::Save_SQL(OFormatter &out, const SQL_Production &sql_version) const
{
    out.printf("INSERT INTO sg_tag( id, name ) VALUES ( %d, %us'%us' );\n"
        , id, sql_version.GetNPrefix(), sql_version.SqlStr(name).c_str());

    for (lem::Container::size_type i = 0; i < values.size(); ++i)
    {
        out.printf("INSERT INTO sg_tag_value( id_tag, ivalue, name ) VALUES ( %d, %d, %us'%us' );\n",
            id, ivalues[i], sql_version.GetNPrefix(), sql_version.SqlStr(values[i]).c_str());
    }

    return;
}
开发者ID:Koziev,项目名称:GrammarEngine,代码行数:13,代码来源:ThesaurusTag.cpp

示例7: Print

/*********************************************************************
 Свободная печать содержимого множества. Обычно вызывается при печати
 имен словарных статей во время компиляции с трассировкой.
**********************************************************************/
void UCStringSet::Print( OFormatter &s ) const
{
 s.printf( "%vfE" );

 const int n=CastSizeToInt(size());
 for( int i=0; i<n; i++ )
  {
   s << get(i);

   if( i<n-1 )
    s << " "; // Отдельные слова разделяем пробелом.
  }

 s.printf( "%vn" );
 return;
}
开发者ID:mcdir,项目名称:GrammarEngine,代码行数:20,代码来源:string_set.cpp

示例8: Report

/**************************************************
 Распечатка краткой справки о состоянии кэша.
***************************************************/
void LA_WordProjBuffer::Report(
                               OFormatter &s,
                               const LexicalAutomat &la
                              ) const
{
 const int n=NTOT;

 const int perc     = int(n_succ*100l/(n_calls ? n_calls : 1));
 const int stor_use = int((n*100l)/(nmaxproj ? nmaxproj : 1));
 const int pus      = int( n_succ_prim*100l/(n_succ ? n_succ : 1));

 s.printf(
          "Word Projection Cache:\n"
          "%23h primary buffer contains %d items\n"
          "%23h this buffer successfully does %d%% of all projections through cache\n"
          "%23h secondary buffer contains %d items (%d%%)\n"
          "%23h maximum capacity of the secondary buffer is %d items\n"
          "%23h there were %d cache call(s)\n"
          "%23h there were %d successful cache hit(s) (%d%%)\n\n"
          , buffer.size()
          , pus
          , n
          , stor_use
          , nmaxproj
          , n_calls
          , n_succ
          , perc
         );

 return;
}
开发者ID:mcdir,项目名称:GrammarEngine,代码行数:34,代码来源:la_project_buffer.cpp

示例9: PrintPlain

void Word_Form::PrintPlain( OFormatter &s, bool EntryKey ) const
{
 if( EntryKey )
  s.printf( "(" );

 const int nver = 1+CastSizeToInt(GetAlts().size());
 if( nver>1 )
  s.printf( "%vf6((%vn" );

 for( int iver=0; iver<nver; ++iver )
  {
   if( iver>0 )
    s.printf( " " );

   const Word_Form &alt = iver==0 ? *this : *GetAlts()[iver-1];

   if( name->Count_Lexems()==1 )
    s.printf( "%vfE%us%vn", alt.name->c_str() );
   else  
    s.printf( "[%vfE%us%vn]", alt.name->c_str() );

   if( EntryKey )
    s.printf( " key=%d)", alt.GetEntryKey() );
  }

 if( nver>1 )
  s.printf( "%vf6))%vn" );

 return;
}
开发者ID:mcdir,项目名称:GrammarEngine,代码行数:30,代码来源:word_form.cpp

示例10: SaveTxt

void Word_Form::SaveTxt(
                        OFormatter &txtfile,
                        SynGram &gram,
                        bool detailed
                       ) const
{
/*
 if( GetTField().IsDefined() )
  {
   GetTField().SaveTxt(txtfile,gram);
   return;
  }*/

 switch( GetEntryKey() )
  {
   case ANY_STATE:
    txtfile.printf( "\"%us\"", sol_get_token(B_ANY).c_str() );
    break;

   case UNKNOWN_STATE:
    {
     txtfile.printf( "\"%us\"", name->ToString().c_str() );
     break;
    }

   default:
    {
     // ЏҐз в Ґ¬ Љ‹Ђ‘‘:‘’Ђ’њџ
     sol_print_class_entry( txtfile, gram, GetEntryKey() );

     txtfile<<" ";
     break;
    }
  }

 // Ќ «ЁзЁҐ дЁЈга­ле бЄ®Ў®Є ў ®ЎйҐ¬ б«гз Ґ ®Ўп§ вҐ«м­® - ®­Ё пў«повбп
 // ®Ја ­ЁзЁвҐ«Ґ¬ ¬г«мвЁ«ҐЄбҐ¬­®Ј® Ё¬Ґ­Ё бв вмЁ.
 txtfile<<sol_get_token(B_OFIGPAREN);

 if( detailed )
  SaveTxtPreciser( txtfile, &gram );

 txtfile<<sol_get_token(B_CFIGPAREN)<<" ";
 return;
}
开发者ID:mcdir,项目名称:GrammarEngine,代码行数:45,代码来源:word_form.cpp

示例11: Report

/********************************************************************
 Метод вызывается обычно для печати в Журнале сведений о занимаемой
 Автоматом памяти, числе загруженных структур и так далее.
*********************************************************************/
void Automaton::Report( OFormatter &mrep )
{
 mrep.printf(
             "Automaton [%us]:\n"
             , GetName().c_str()
            );

 return;
}
开发者ID:mcdir,项目名称:GrammarEngine,代码行数:13,代码来源:automaton.cpp

示例12: SaveRules_SQL

void GraphGram::SaveRules_SQL(OFormatter &out, OFormatter &alters, const SQL_Production &sql_version)
{
    std::unique_ptr<CharOperationEnumerator> opers(GetCharOperations().ListOperations());

    int id_seq = 1;
    while (opers->Fetch())
    {
        const GG_CharOperation &op = opers->GetOperation();

        out.printf("\n\nINSERT INTO abc_operation( id, name ) VALUES ( %d, '%us' );\n", op.GetId(), op.GetName().c_str());

        for (std::map< lem::uint32_t, lem::uint32_t >::const_iterator it = op.Items().begin(); it != op.Items().end(); ++it)
        {
            out.printf("INSERT INTO abc_operation_item( id, id_operation, src_char_ucs4, res_char_ucs4, src_char, res_char )"
                " VALUES( %d, %d, %d, %d, '%uc', '%uc' );\n", id_seq++, op.GetId(), it->first, it->second, it->first, it->second);
        }
    }

    return;
}
开发者ID:Koziev,项目名称:GrammarEngine,代码行数:20,代码来源:gg_autom.cpp

示例13: PrintPlain

void Tree_Node::PrintPlain(OFormatter &s, bool EntryKey) const
{
    GetNode().PrintPlain(s, EntryKey);

    if (!child.Empty())
    {
        s.printf(" ( ");
        for (Container::size_type i = 0; i < child.size(); i++)
        {
            if (i)
                s.printf(", ");

            child[i].PrintPlain(s, EntryKey);
        }

        s.printf(" ) ");
    }

    return;
}
开发者ID:Koziev,项目名称:GrammarEngine,代码行数:20,代码来源:tree_node.cpp

示例14: PrintMap

void LA_WordProjBuffer::PrintMap(
                                 OFormatter &txtfile,
                                 SynGram &gram
                                ) const
{
 Report(txtfile,gram.GetDict().GetLexAuto());

 txtfile.printf(
                "There are %d item(s) in word projection cache:\n",
                list.size()
               );

 for( Container::size_type i=0; i<list.size(); i++ )
  {
   list[i].PrintInfo(txtfile,gram);
  }

 txtfile.printf( "The end of word projection cache map.\n" );

 return;
}
开发者ID:mcdir,项目名称:GrammarEngine,代码行数:21,代码来源:la_project_buffer.cpp

示例15: SaveSQL

    void SaveSQL(OFormatter &out, const SQL_Production &sql_version)
    {
        const wchar_t* NPrefix = sql_version.GetNPrefix();

        int id_pair = 0;
        for (lem::Container::size_type i = 0; i < ints_list.size(); ++i)
        {
            int id_pairs = CastSizeToInt(i);

            out.printf("INSERT INTO abc_pairs( id, str_pairs )"
                " VALUES( %d, %us'%us' );\n",
                id_pairs, NPrefix, ints_list[i]->c_str());

            const CP_Array &p = *pairs_list[i];
            for (lem::Container::size_type j = 0; j < p.size(); ++j)
            {
                out.printf("INSERT INTO abc_pair( id, id_pairs, id_coord, id_state )"
                    " VALUES ( %d, %d, %d, %d );\n",
                    id_pair++, id_pairs, p[j].GetCoord().GetIndex(), p[j].GetState());
            }
        }

        return;
    }
开发者ID:Koziev,项目名称:GrammarEngine,代码行数:24,代码来源:gg_autom.cpp


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