=    Cls. .

==     Cls 

Cls-       --   :

  ||  
  {tag_name
    ||    nonspace (:tok_nonspace)
    nonspace-value
    ||    string (:tok_string)
    "string-value"
  }

    : nonspace,      
 ,  string (      
 ).       
, ..        nonspace,  
 string.

     :
  {name "my name" }
  :
  {names "first" "second" ... "last" }

   (   )   
,     .

==     Cls 

,      Cls   
  (. 
{service_description}[link://files/docs/examples/service_description.html]).
  ,  IP-,    ,
  ,    .  
    ,          ,
      .

     {service}:
  {service ...}
       .

     {name},    
  string (     ):
  {name <str> }

IP-    . -,    
{ip}   IP-. -,     {ips},   
  --    .   
{ips}     nonspace (  IP   
 ,    nonspace):
  {ips <nonspace>+ }

     {message}  
    nonspace --   ( 
,      )    {field}
   :
  {message <nonspace> {field ...}* }
 {field}        {name}  {type}:
  {field {name <str>} {type <nonspace>}}

   :
  {service
    {name <str> }
    {ips <nonspace>+ }
    {message <nonspace>
      {field
        {name <str> }
        {type <nonspace }
      }*
    }*
  }
,     :
  {service
    {name "Remote Service Manager" }
    {ips 0.0.0.0:3333 localhost:4444 }
    {message GetServicesList}
    {message StartService
      {field {name "service"} {type String}}
      {field {name "mode"} {type StartMode}}
    }
    {message StopService
      {field {name "service"} {type String}}
    }
  }
  {service
    {name "Test Service" }
    {ips localhost:5000 }
  }

==    Cls 

     ,      
 -,    ClsRuby::Tag. 
(ClsRuby#parse_io, ClsRuby#parse_string, ClsRuby#parse_file)  
-   --    
     (..    ).

       ,   
      ,   
  (   ClsRuby::Tag#tag_compare_name). 
 , :
*      ClsRuby::Tag#tag_on_start;
*      .
   ,    ( 
ClsRuby::ParsingErrorEx).

         
 .       
:tok_nonspace,  ,     nonspace   
   ClsRuby::Tag#tag_on_tok_nonspace.   
 :tok_string,      
ClsRuby#tag_on_tok_string. ,    
  , :
*    ;
*   ;
*  -  .

    ,      
  (ClsRuby::Tag#tag_tags)      
  ( ClsRuby::Tag#tag_compare_name).  
, :
*      ClsRuby::Tag#tag_on_start;
*      ;
*      .

 ..   ,       , 
   .  :
*      ClsRuby::Tag#tag_on_finsh;
*          
    ;
*      
  ClsRuby::Tag#tag_on_tag.

     ,     
 .    ,     
   (..     
     ).

     tag_on_finish,  ,   
<i></i> -- ..  ,    
     . ,      
  ClsRuby::Tag#tag_defined?,  ClsRuby::Tag#tag_make_defined
  ,   ,    (  
,        ).

    (mandatory)   (optional).  
  (..   ClsRuby::Tag#tag_mandatory? 
true),          
 (..   ClsRuby::Tag#tag_defined?   true).
      (..   
    )     
 .      ,   
,      . 
      . 

=     

   ,   Cls- 
  ,    ClsRuby::Tag. ClsRuby
    ,   
   Cls-    
.

    ,       Cls-
.    .

==       -

     ClsRuby::Tag 
,    Tag#tag_on_finish, Tag#tag_on_tok_nonspace 
Tag#tag_on_tok_string     - .
,     ,  :
  {include <str>}+
    :
  :include: docs/fragments/custom_tag_include.rb
,     .    
,     . ,    TagInclude 
 - ,        
{include}         nonspace .
        
    ClsRuby::TagStringScalar.

==   ClsRuby   

    ClsRuby      
. , :
  {field {name <str>} {type <nonspace>}}
      TagField:
  :include: docs/fragments/custom_tag_field.rb

   ,  ,    
     getter-  
 .  ,    
(..   Cls-)     -- - , 
      {field}   
ClsRuby::TagNoValue.

==    

 Cls-  C++ ,     
.      ,   -- 
 Cls-.

,    Field,      
{field}:
  Field = Struct.new( :name, :type )
   TagField,       {field} 
   Field:
  :include: docs/fragments/tag_field.rb

   ,      
 . ,      Cls 
     Cls   XML, YAML  JSON,  
   .

          Cls
.         
,         
   Cls-.

,     :
  {message {field ...}* }
     :
  :include: docs/fragments/tag_message.rb

===      

  --  .     
     . , , 
,        .  
     ,   .  :
  {<name>
    [{hours <unit:1..24>}]
    [{minutes <uint:1..59>}]
    [{seconds <uint:1..59>}]
  }
  :
  class TagTimePeriod < ClsRuby::TagNoValue
    child_tag :hours, ClsRuby::TagUintScalar,
        :constraint => 1..24

    child_tag :minutes, ClsRuby::TagUintScalar,
        :constraint => 1...60

    child_tag :seconds, ClsRuby::TagUintScalar,
        :constraint => 1...60

    #    :value,     ,
    #   .   ,  
    #   .
    def initialize( params = {} )
      super( params )

      tag_handle_opt_param( :value ) do |v| self.value = v end
    end

    def tag_on_finish
      super

      fail 'at least one tag ({hours}/{minutes}/{seconds}) ' +
          "must be defined for {#{tag_name}}" unless
          @hours.tag_defined? ||
          @minutes.tag_defined? ||
          @seconds.tag_defined?
    end

    def value
      @hours.fetch( 0 ) * 3600 + @minutes.fetch( 0 ) * 60 + @seconds.fetch( 0 )
    end

    def value=( seconds )
      tag_reset

      h = seconds / 3600; seconds %= 3600
      @hours.value = h if 0 != h

      m = seconds / 60; seconds %= 60
      @minutes.value = m if 0 != m

      @seconds.value = seconds if 0 != seconds

      tag_make_defined if @hours.tag_defined? || @minutes.tag_defined? ||
          @seconds.tag_defined?
    end
  end

      . :
  {service
    {config-reload-period <TagTimePeriod> }
    {channel-params
      {ping-timeout <TagTimePeriod> }
      ...
    }
    {request-processing
      {max-wait-time <TagTimePeriod> }
      ...
    }
  }
 {config-reload-period}, {ping-timeout}  {max-wait-time}  
   TagTimePeriod:
  class TagChannelParams < ClsRuby::TagNoValue
    mandatory_child_tag :ping_timeout, TagTimePeriod,
        :name => 'ping-timeout'
    ...
  end
  class TagRequestProcessing < ClsRuby::TagNoValue
    mandatory_child_tag :max_wait_time, TagTimePeriod,
        :name => 'max-wait-time'
    ...
  end
  class TagService < ClsRuby::TagNoValue
    mandatory_child_tag :config_reload_period, TagTimePeriod,
        :name => 'config-reload-period'
    mandatory_child_tag :channel_params, TagChannelParams,
        :name => 'channel-params'
    mandatory_child_tag :requiest_processing, TagRequestProcessing,
        :name => 'request-processing'
    ...
  end

   --       
Cls-.       Cls 
   -       
.  ,        , 
     (    
).

    --     .  
     {field}   {message}.  
  --   TagField.   TagMessage
   ,  ,    
 Field   .

==      

   ClsRuby       
     . ,   
 TagTimePeriod    ,     
  {hours}, {minutes}  {seconds}:
  {config-reload-period {hours 3} {seconds 15} {minutes 40}}
  {config-reload-period {minutes 40} {seconds 15} {hours 3}}
  {config-reload-period {minutes 40} {hours 3} {seconds 15}}
         .

   ,    ClsRuby --
  ,    . 
        
 ,       .

     ClsRuby    
    .    
ClsRuby::TagVectorOfTags (    ) 
ClsRuby::TagScalarVector (    ).  
    ClsRuby,     
 ,      :
  {compilation-params
    ||  {include-path}    TagVectorOfTags.
    ||     , ..  
    ||    .
    {include-path "/home/eao197" }
    {include-path "/usr/share/include" }
    ...
    ||  {copyright-info}    TagScalarVector.
    ||      , ..  
    ||      .
    {copyright-info
      "Copyright (C) 2006, 2007 The ClsRuby Project. All rights reserved."
      "Redistribution and use in source and ..."
    }
    ...
  }

  ClsRuby::TagVectorOfTags  ,   
       .  
         , 
        
ClsRuby::TagVectorOfTags   --    
     :
  :include: docs/fragments/tags_order.rb
     :
  {compilation-params
    {include-path "/home/eao197" }
    {include-path "/usr/share/include" }
    {include-path "/usr/local/include" }
    {define "NDEBUG" }
    {define "X86_ARCH" }
    {define "STATIC_LIB" } }
..       ,  
    .

   ,      
     ClsRuby.    
     ,   
     ClsRuby::TagAny.

    ClsRuby::TagVectorOfDifferentTags.    
  ClsRuby::TagVectorOfTags  ,   
       .

# vim:ts=2:sts=2:sw=2:expandtab:ft=txt:tw=78

