contrib/mul/mbl/mbl_parse_colon_pairs_list.h
Go to the documentation of this file.
00001 #ifndef mbl_parse_colon_pairs_list_h_
00002 #define mbl_parse_colon_pairs_list_h_
00003 
00004 //:
00005 // \file
00006 // \brief Parse list of string pairs separated by colons
00007 // \author Tim Cootes
00008 
00009 #include <vcl_string.h>
00010 #include <vcl_vector.h>
00011 #include <vcl_iostream.h>
00012 
00013 //: Parse list of string pairs separated by colons
00014 // Expects format of data string to contain pairs of
00015 // strings, with colons between items, eg
00016 // \verbatim
00017 // {
00018 //   item1_0 : item2_0
00019 //   item1_1 : item2_1
00020 //   item1_2 : item2_2
00021 // }
00022 // \endverbatim
00023 // Throws a mbl_exception_parse_error if it fails.
00024 void mbl_parse_colon_pairs_list(vcl_istream& is,
00025                           vcl_vector<vcl_string>& item1,
00026                           vcl_vector<vcl_string>& item2);
00027 
00028 //: Parse list of string pairs separated by colons
00029 // Expects format of data string to contain pairs of
00030 // strings, with colons between items, eg
00031 // \verbatim
00032 // {
00033 //   item1_0 : item2_0
00034 //   item1_1 : item2_1
00035 //   item1_2 : item2_2
00036 // }
00037 // \endverbatim
00038 // Throws a mbl_exception_parse_error if it fails.
00039 void mbl_parse_colon_pairs_list(const vcl_string& data,
00040                           vcl_vector<vcl_string>& item1,
00041                           vcl_vector<vcl_string>& item2);
00042 
00043 //: Writes pairs to a stream, separated by colons
00044 // Format of output
00045 // \verbatim
00046 // {
00047 //   item1[0] : item2[0]
00048 //   item1[1] : item2[1]
00049 // }
00050 // \endverbatim
00051 void mbl_write_colon_pairs_list(vcl_ostream& os,
00052                           const vcl_vector<vcl_string>& item1,
00053                           const vcl_vector<vcl_string>& item2);
00054 
00055 #endif // mbl_parse_colon_pairs_list_h_