contrib/mul/mbl/mbl_parse_keyword_list.h
Go to the documentation of this file.
00001 #ifndef mbl_parse_keyword_list_h_
00002 #define mbl_parse_keyword_list_h_
00003 
00004 //:
00005 // \file
00006 // \brief Parse list of strings
00007 // \author Tim Cootes
00008 
00009 #include <vcl_string.h>
00010 #include <vcl_vector.h>
00011 #include <vcl_iostream.h>
00012 
00013 //: Read in keyword separated blocks of text from stream.
00014 // Assumes list of blocks separated by a keyword.
00015 //  keyword is always the same word, defined in the input variable.
00016 // Expects format of data:
00017 // \verbatim
00018 // {
00019 //   object: { data: fruit0 }
00020 //   object: { data: fruit1 }
00021 //   object: { data: fruit2 }
00022 // }
00023 // To parse this, require keyword="object:". 
00024 // For this example, on exit, items[1]=="{ data: fruit1 }", which could
00025 // be passed to mbl_read_props.
00026 // \endverbatim
00027 // Throws a mbl_exception_parse_error if it fails.
00028 void mbl_parse_keyword_list(vcl_istream& is, const vcl_string& keyword,
00029                 vcl_vector<vcl_string>& items,
00030                 bool discard_comments = false);
00031 
00032 
00033 //: Read in keyword separated blocks of text from stream.
00034 // Assumes list of blocks separated by a keyword.
00035 //  keyword is always the same word, defined in the input variable.
00036 // Expects format of data:
00037 // \verbatim
00038 // {
00039 //   object: thing0 { data: fruit0 }
00040 //   object: thing1 { data: fruit1 }
00041 //   object: thing2 { data: fruit2 }
00042 // }
00043 // To parse this, require keyword="object:". 
00044 // For this example, on exit, items[1]=="thing1 { data: fruit1 }".
00045 // \endverbatim
00046 // Throws a mbl_exception_parse_error if it fails.
00047 void mbl_parse_keyword_list2(vcl_istream& is, const vcl_string& keyword,
00048                 vcl_vector<vcl_string>& items,
00049                 bool discard_comments = false);
00050 
00051 #endif // mbl_parse_keyword_list_h_