00001 #ifndef LIST_PARSING_CLASS 00002 #define LIST_PARSING_CLASS 00003 00004 /*****************************************************************************\ 00005 * * 00006 * Name : list_parsing * 00007 * Author : Chris Koeritz * 00008 * Author : Gary Hardley * 00009 * * 00010 ******************************************************************************* 00011 * Copyright (c) 2002-$now By Author. This program is free software; you can * 00012 * redistribute it and/or modify it under the terms of the GNU General Public * 00013 * License as published by the Free Software Foundation; either version 2 of * 00014 * the License or (at your option) any later version. This is online at: * 00015 * http://www.fsf.org/copyleft/gpl.html * 00016 * Please send any updates to: fred@gruntose.com * 00017 \*****************************************************************************/ 00018 00019 #include <basis/contracts.h> 00020 #include <structures/set.h> 00021 #include <structures/string_array.h> 00022 #include <structures/string_table.h> 00023 00024 namespace textual { 00025 00027 00028 class list_parsing 00029 { 00030 public: 00031 virtual ~list_parsing(); 00032 DEFINE_CLASS_NAME("list_parsing"); 00033 00034 static bool get_ids_from_string(const basis::astring &string, structures::int_set &ids); 00036 00040 static bool get_ids_from_string(const basis::astring &string, basis::int_array &ids); 00042 00044 static basis::astring put_ids_in_string(const structures::int_set &ids, char separator = ','); 00046 00047 static basis::astring put_ids_in_string(const basis::int_array &ids, char separator = ','); 00049 00050 static basis::astring emit_quoted_chunk(const basis::astring &to_emit); 00052 00053 static bool parse_csv_line(const basis::astring &to_parse, structures::string_array &fields); 00055 00061 static void create_csv_line(const structures::string_array &to_csv, basis::astring &target); 00062 static void create_csv_line(const structures::string_table &to_csv, basis::astring &target); 00064 00067 }; 00068 00069 } //namespace. 00070 00071 #endif 00072
1.6.3