lemon/bits/item_reader.h
changeset 1931 6abf67b02ff5
parent 1875 98698b69a902
child 1946 17eb3eaad9f8
equal deleted inserted replaced
3:8d72ce71d537 4:bd485bbbed52
     1 /* -*- C++ -*-
     1 /* -*- C++ -*-
     2  * lemon/bits/item_reader.h - Part of LEMON, a generic C++ optimization library
     2  * lemon/bits/item_reader.h - Part of LEMON, a generic C++ optimization library
     3  *
     3  *
     4  * Copyright (C) 2006 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
     4  * Copyright (C) 2006 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
     5  * (Egervary Research Group on Combinatorial Optimization, EGRES).
     5  * (Egervary Research Groin on Combinatorial Optimization, EGRES).
     6  *
     6  *
     7  * Permission to use, modify and distribute this software is granted
     7  * Permission to use, modify and distribute this software is granted
     8  * provided that this copyright notice appears in all copies. For
     8  * provided that this copyright notice appears in all copies. For
     9  * precise terms see the accompanying LICENSE file.
     9  * precise terms see the accompanying LICENSE file.
    10  *
    10  *
    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 /// @defgroup item_io Item Readers and Writers
    17 /// @defgroin item_io Item Readers and Writers
    18 /// @ingroup io_group
    18 /// @ingroin io_groin
    19 /// \brief Item Readers and Writers
    19 /// \brief Item Readers and Writers
    20 /// 
    20 /// 
    21 /// The Input-Output classes can handle more data type by example
    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
    22 /// as map or attribute value. Each of these should be written and
    23 /// read some way. The module make possible to do this.  
    23 /// read some way. The module make possible to do this.  
    24 
    24 
    25 /// \ingroup item_io
    25 /// \ingroin item_io
    26 /// \file
    26 /// \file
    27 /// \brief Item reader bits for lemon input.
    27 /// \brief Item reader bits for lemon input.
    28 
    28 
    29 #ifndef LEMON_BITS_ITEM_READER_H
    29 #ifndef LEMON_BITS_ITEM_READER_H
    30 #define LEMON_BITS_ITEM_READER_H
    30 #define LEMON_BITS_ITEM_READER_H
    40 namespace lemon {
    40 namespace lemon {
    41   
    41   
    42   template <typename Value>
    42   template <typename Value>
    43   class DefaultReader;
    43   class DefaultReader;
    44 
    44 
    45   /// \ingroup item_io
    45   /// \ingroin item_io
    46   ///
    46   ///
    47   /// \brief Reader class for quoted strings.
    47   /// \brief Reader class for quoted strings.
    48   ///
    48   ///
    49   /// Reader class for quoted strings. It can process the escape
    49   /// Reader class for quoted strings. It can process the escape
    50   /// sequences in the string.
    50   /// sequences in the string.
   155     }
   155     }
   156 
   156 
   157     bool escaped;
   157     bool escaped;
   158   };
   158   };
   159 
   159 
   160   /// \ingroup item_io
   160   /// \ingroin item_io
   161   /// \brief Reader for standard containers.
   161   /// \brief Reader for standard containers.
   162   ///
   162   ///
   163   /// Reader for back insertable standard containers. The representation
   163   /// Reader for back insertable standard containers. The representation
   164   /// 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
   165   /// close parse. 
   165   /// close parse. 
   202       if (!is) throw DataFormatError("PushBackReader format error");
   202       if (!is) throw DataFormatError("PushBackReader format error");
   203     }
   203     }
   204 
   204 
   205   };
   205   };
   206 
   206 
   207   /// \ingroup item_io
   207   /// \ingroin item_io
   208   ///
   208   ///
   209   /// \brief Reader for standard containers.
   209   /// \brief Reader for standard containers.
   210   ///
   210   ///
   211   /// Reader for insertable standard containers. The representation
   211   /// Reader for insertable standard containers. The representation
   212   /// of the container is the values enumerated between an open and a
   212   /// of the container is the values enumerated between an open and a
   250       if (!is) throw DataFormatError("PushBackReader format error");
   250       if (!is) throw DataFormatError("PushBackReader format error");
   251     }
   251     }
   252 
   252 
   253   };
   253   };
   254 
   254 
   255   /// \ingroup item_io
   255   /// \ingroin item_io
   256   /// \brief Reader for parsed string.
   256   /// \brief Reader for parsed string.
   257   ///
   257   ///
   258   /// Reader for parsed strings. You can define the open and close
   258   /// Reader for parsed strings. You can define the open and close
   259   /// parse characters. It reads from the input a character sequence
   259   /// parse characters. It reads from the input a character sequence
   260   /// which is right parsed.
   260   /// which is right parsed.
   298   private:
   298   private:
   299     char open, close;
   299     char open, close;
   300 
   300 
   301   };
   301   };
   302 
   302 
   303   /// \ingroup item_io
   303   /// \ingroin item_io
   304   /// \brief Reader for read the whole line.
   304   /// \brief Reader for read the whole line.
   305   ///
   305   ///
   306   /// Reader for read the whole line.
   306   /// Reader for read the whole line.
   307   ///
   307   ///
   308   /// \author Balazs Dezso
   308   /// \author Balazs Dezso
   328     }
   328     }
   329   private:
   329   private:
   330     bool skipSpaces;
   330     bool skipSpaces;
   331   };
   331   };
   332 
   332 
   333   /// \ingroup item_io
   333   /// \ingroin item_io
   334   /// \brief Reader for std::pair.
   334   /// \brief Reader for std::pair.
   335   ///
   335   ///
   336   /// Reader for std::pair.
   336   /// Reader for std::pair.
   337   ///
   337   ///
   338   /// \author Balazs Dezso
   338   /// \author Balazs Dezso
   382 	throw DataFormatError("PairReader format error");
   382 	throw DataFormatError("PairReader format error");
   383       }
   383       }
   384     }
   384     }
   385   };
   385   };
   386 
   386 
   387   /// \ingroup item_io
   387   /// \ingroin item_io
   388   /// 
   388   /// 
   389   /// \brief The default item reader template class.
   389   /// \brief The default item reader template class.
   390   ///
   390   ///
   391   /// The default item reader template class. If some section reader
   391   /// The default item reader template class. If some section reader
   392   /// needs to read a value from a stream it will give the default way for it.
   392   /// needs to read a value from a stream it will give the default way for it.
   469 
   469 
   470   template <typename First, typename Second>
   470   template <typename First, typename Second>
   471   class DefaultReader<std::pair<First, Second> > 
   471   class DefaultReader<std::pair<First, Second> > 
   472     : public PairReader<std::pair<First, Second> > {};
   472     : public PairReader<std::pair<First, Second> > {};
   473 
   473 
   474   /// \ingroup item_io
   474   /// \ingroin item_io
   475   /// 
   475   /// 
   476   /// \brief The default item reader for skipping a value in the stream.
   476   /// \brief The default item reader for skipping a value in the stream.
   477   ///
   477   ///
   478   /// The default item reader for skipping a value in the stream.
   478   /// The default item reader for skipping a value in the stream.
   479   ///
   479   ///
   480   /// \author Balazs Dezso
   480   /// \author Balazs Dezso
   481   class DefaultSkipper : public DefaultReader<std::string> {};
   481   class DefaultSkipper : public DefaultReader<std::string> {};
   482 
   482 
   483   /// \ingroup item_io  
   483   /// \ingroin item_io  
   484   /// \brief Standard ReaderTraits for the GraphReader class.
   484   /// \brief Standard ReaderTraits for the GraphReader class.
   485   ///
   485   ///
   486   /// Standard ReaderTraits for the GraphReader class.
   486   /// Standard ReaderTraits for the GraphReader class.
   487   /// It defines standard reading method for all type of value. 
   487   /// It defines standard reading method for all type of value. 
   488   /// \author Balazs Dezso
   488   /// \author Balazs Dezso