src/lemon/bits/item_reader.h
changeset 1418 afaa773d0ad0
parent 1408 892c29484414
child 1427 14c75970840e
equal deleted inserted replaced
0:5b8b5ec8a1da 1:29cf7c4dca61
    12  * express or implied, and with no claim as to its suitability for any
    12  * express or implied, and with no claim as to its suitability for any
    13  * purpose.
    13  * purpose.
    14  *
    14  *
    15  */
    15  */
    16 
    16 
    17 /// \ingroup io_group
    17 /// @defgroup item_io Item Readers and Writers
       
    18 /// @ingroup io_group
       
    19 /// \brief Item Readers and Writers
       
    20 /// 
       
    21 /// The Input-Output classes can handle more data type by example
       
    22 /// as map or attribute value. Each of these should be written and
       
    23 /// read some way. The module make possible to do this.  
       
    24 
       
    25 /// \ingroup item_io
    18 /// \file
    26 /// \file
    19 /// \brief Item reader bits for lemon input.
    27 /// \brief Item reader bits for lemon input.
    20 
    28 
    21 #ifndef LEMON_BITS_ITEM_READER_H
    29 #ifndef LEMON_BITS_ITEM_READER_H
    22 #define LEMON_BITS_ITEM_READER_H
    30 #define LEMON_BITS_ITEM_READER_H
    32 namespace lemon {
    40 namespace lemon {
    33   
    41   
    34   template <typename Value>
    42   template <typename Value>
    35   class DefaultReader;
    43   class DefaultReader;
    36 
    44 
    37   /// \ingroup io_group
    45   /// \ingroup item_io
    38   ///
    46   ///
    39   /// \brief Reader class for quoted strings.
    47   /// \brief Reader class for quoted strings.
    40   ///
    48   ///
    41   /// Reader class for quoted strings. It can process the escape
    49   /// Reader class for quoted strings. It can process the escape
    42   /// sequences in the string.
    50   /// sequences in the string.
   147     }
   155     }
   148 
   156 
   149     bool escaped;
   157     bool escaped;
   150   };
   158   };
   151 
   159 
   152   /// \ingroup io_group
   160   /// \ingroup item_io
   153   /// \brief Reader for standard containers.
   161   /// \brief Reader for standard containers.
   154   ///
   162   ///
   155   /// Reader for back insertable standard containers. The representation
   163   /// Reader for back insertable standard containers. The representation
   156   /// of the container is the values enumerated between an open and a
   164   /// of the container is the values enumerated between an open and a
   157   /// close parse. 
   165   /// close parse. 
   189       is.putback(c);
   197       is.putback(c);
   190     }
   198     }
   191 
   199 
   192   };
   200   };
   193 
   201 
   194   /// \ingroup io_group
   202   /// \ingroup item_io
   195   ///
   203   ///
   196   /// \brief Reader for standard containers.
   204   /// \brief Reader for standard containers.
   197   ///
   205   ///
   198   /// Reader for insertable standard containers. The representation
   206   /// Reader for insertable standard containers. The representation
   199   /// of the container is the values enumerated between an open and a
   207   /// of the container is the values enumerated between an open and a
   232       is.putback(c);
   240       is.putback(c);
   233     }
   241     }
   234 
   242 
   235   };
   243   };
   236 
   244 
   237   /// \ingroup io_group
   245   /// \ingroup item_io
   238   /// \brief Reader for parsed string.
   246   /// \brief Reader for parsed string.
   239   ///
   247   ///
   240   /// Reader for parsed strings. You can give the open and close
   248   /// Reader for parsed strings. You can give the open and close
   241   /// parse characters.
   249   /// parse characters.
   242   ///
   250   ///
   279   private:
   287   private:
   280     char open, close;
   288     char open, close;
   281 
   289 
   282   };
   290   };
   283 
   291 
   284   /// \ingroup io_group
   292   /// \ingroup item_io
   285   /// \brief Reader for read the whole line.
   293   /// \brief Reader for read the whole line.
   286   ///
   294   ///
   287   /// Reader for read the whole line.
   295   /// Reader for read the whole line.
   288   ///
   296   ///
   289   /// \author Balazs Dezso
   297   /// \author Balazs Dezso
   309     }
   317     }
   310   private:
   318   private:
   311     bool skipSpaces;
   319     bool skipSpaces;
   312   };
   320   };
   313 
   321 
   314   /// \ingroup io_group
   322   /// \ingroup item_io
   315   /// 
   323   /// 
   316   /// \brief The default item reader template class.
   324   /// \brief The default item reader template class.
   317   ///
   325   ///
   318   /// The default item reader template class. If some section reader
   326   /// The default item reader template class. If some section reader
   319   /// needs to read a value from a stream it will give the default way for it.
   327   /// needs to read a value from a stream it will give the default way for it.
   351 
   359 
   352   template <typename Item>
   360   template <typename Item>
   353   class DefaultReader<std::multiset<Item> > 
   361   class DefaultReader<std::multiset<Item> > 
   354     : public InsertReader<std::multiset<Item> > {};
   362     : public InsertReader<std::multiset<Item> > {};
   355 
   363 
   356   /// \ingroup io_group
   364   /// \ingroup item_io
       
   365   /// 
       
   366   /// \brief The default item reader for skipping a value in the stream.
       
   367   ///
       
   368   /// The default item reader for skipping a value in the stream.
       
   369   ///
       
   370   /// \author Balazs Dezso
   357   class DefaultSkipper {
   371   class DefaultSkipper {
   358   public:
   372   public:
   359     typedef std::string Value;
   373     typedef std::string Value;
   360     
   374     
   361     void read(std::istream& is, Value& value) const {
   375     void read(std::istream& is, Value& value) const {
   373 	DefaultReader<std::string>().read(is, value); 
   387 	DefaultReader<std::string>().read(is, value); 
   374 	break;
   388 	break;
   375       }
   389       }
   376     }
   390     }
   377   };
   391   };
   378   
   392 
       
   393   /// \ingroup item_io  
   379   /// \brief Standard ReaderTraits for the GraphReader class.
   394   /// \brief Standard ReaderTraits for the GraphReader class.
   380   ///
   395   ///
   381   /// Standard ReaderTraits for the GraphReader class.
   396   /// Standard ReaderTraits for the GraphReader class.
   382   /// It defines standard reading method for all type of value. 
   397   /// It defines standard reading method for all type of value. 
   383   /// \author Balazs Dezso
   398   /// \author Balazs Dezso