a diff which - gives wysiwyg natbib labels and standard behaviour without natbib. - supports the "before" input textfield in the gui - fixes another bug with familyName in biblio.C
the citation-string looks like: \citet[<before>....</endbefore><after>....</endafter>]{...bibkeys...} switching between the different modes and between with or without a bibtex-datafile is no problem. Herbert -- http://www.lyx.org/help/
Index: src/frontends/controllers/ChangeLog =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/controllers/ChangeLog,v retrieving revision 1.159 diff -u -r1.159 ChangeLog --- src/frontends/controllers/ChangeLog 12 Apr 2002 15:25:11 -0000 1.159 +++ src/frontends/controllers/ChangeLog 14 Apr 2002 16:11:26 -0000 @@ -1,3 +1,12 @@ +2002-04-14 Herbert Voss <[EMAIL PROTECTED]> + + * ControlCitation.[Ch] + * biblio.[Ch]: show natbib citationlabels in wysiwyg. handle + before and after strings for citations + + * helper_funcs.[Ch]: move the getVectorFromString and the vice versa + into the support/lstrings for better use in other programs + 2002-04-11 Herbert Voss <[EMAIL PROTECTED]> * ControlGraphics.C: expand "browse-string" to all available formats Index: src/frontends/controllers/ControlCitation.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/controllers/ControlCitation.C,v retrieving revision 1.18 diff -u -r1.18 ControlCitation.C --- src/frontends/controllers/ControlCitation.C 21 Mar 2002 21:21:27 -0000 1.18 +++ src/frontends/controllers/ControlCitation.C 14 Apr 2002 16:11:26 -0000 @@ -1,14 +1,10 @@ -/* This file is part of - * ====================================================== - * - * LyX, The Document Processor - * - * Copyright 2001 The LyX Team. - * - * ====================================================== - * +/** * \file ControlCitation.C - * \author Angus Leeming <[EMAIL PROTECTED]> + * Copyright 2001 the LyX Team + * Read the file COPYING + * + * \author Angus Leeming, [EMAIL PROTECTED] + * \author Herbert Voss, [EMAIL PROTECTED] 2002-03-17 */ #include <config.h> @@ -25,13 +21,14 @@ #include "Dialogs.h" #include "LyXView.h" +#include "support/lstrings.h" + // need to #include this in _one_ of the ControlCommand-derived classses in // order to instantiate // ControlInset<InsetCommand, InsetCommandParams>::showInset // ControlInset<InsetCommand, InsetCommandParams>::createInset #include "ControlInset.tmpl" - using std::pair; using std::vector; using SigC::slot; @@ -100,4 +97,51 @@ styles = biblio::getAuthorYearStrings(key, bibkeysInfo_, cs); return styles; +} + + +string const ControlCitation::getBeforeString() const +{ + string const options = params().getOptions(); + if (!contains(options,"<\\before>")) + return string(); + else { + string::size_type start, countChars; + start = options.find("<\\before>")+9; + countChars = options.find("<\\end_before>")-start; + return options.substr(start,countChars); + } +} + + +string const ControlCitation::getAfterString() const +{ + string const options = params().getOptions(); + if (!contains(options,"<\\after>")) + return string(); + else { + string::size_type start, countChars; + start = options.find("<\\after>")+8; + countChars = options.find("<\\end_after>")-start; + return options.substr(start,countChars); + } +} + + +void ControlCitation::setCiteOptions( + string const & before, + string const & after) { + // we save the oiptions in the form + // <before>...</endbefore><after>...</endafter> + // until we have multiple options for citations + if (!usingNatbib()) + params().setOptions(after); + else { + string ba; // holds the before- and after-part + if (!before.empty()) + ba += ("<\\before>"+before+"<\\end_before>"); + if (!after.empty()) + ba += ("<\\after>"+after+"<\\end_after>"); + params().setOptions(ba); + } } Index: src/frontends/controllers/ControlCitation.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/controllers/ControlCitation.h,v retrieving revision 1.12 diff -u -r1.12 ControlCitation.h --- src/frontends/controllers/ControlCitation.h 21 Mar 2002 21:21:27 -0000 1.12 +++ src/frontends/controllers/ControlCitation.h 14 Apr 2002 16:11:26 -0000 @@ -42,6 +42,17 @@ static std::vector<biblio::CiteStyle> const & getCiteStyles() { return citeStyles_; } + /// return the "before"-part of the option string + string const getBeforeString() const; + + /// return the "after"-part of the option string + string const getAfterString() const; + + /// when using natbib store the options in modified form + void setCiteOptions( + string const & before, + string const & after); + private: /// create the InfoMap of keys and data virtual void setDaughterParams(); Index: src/frontends/controllers/biblio.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/controllers/biblio.C,v retrieving revision 1.21 diff -u -r1.21 biblio.C --- src/frontends/controllers/biblio.C 21 Mar 2002 21:21:28 -0000 1.21 +++ src/frontends/controllers/biblio.C 14 Apr 2002 16:11:27 -0000 @@ -142,81 +142,6 @@ return keys.end(); } -string const familyName(string const & name) -{ - // Very simple parser - string fname = name; - - // possible authorname combinations are: - // "Surname, FirstName" - // "Surname, F." - // "FirstName Surname" - // "F. Surname" - string::size_type idx = fname.find(","); - if (idx != string::npos) - return frontStrip(fname.substr(0,idx)); - idx = fname.rfind("."); - if (idx != string::npos) - fname = frontStrip(fname.substr(idx+1)); - - return fname; -} - - -string const getAbbreviatedAuthor(InfoMap const & map, string const & key) -{ - lyx::Assert(!map.empty()); - - InfoMap::const_iterator it = map.find(key); - - string author; - if (it != map.end()) { - author = parseBibTeX(it->second, "author"); - if (author.empty()) - author = parseBibTeX(it->second, "editor"); - - vector<string> authors = getVectorFromString(author, "and"); - - if (!authors.empty()) { - author.erase(); - - for (vector<string>::iterator it = authors.begin(); - it != authors.end(); ++it) { - *it = familyName(strip(*it)); - } - - author = authors[0]; - if (authors.size() == 2) - author += _(" and ") + authors[1]; - else if (authors.size() > 2) - author += _(" et al."); - } - } - - if (author.empty()) - author = _("Caesar et al."); - - return author; -} - - -string const getYear(InfoMap const & map, string const & key) -{ - lyx::Assert(!map.empty()); - - InfoMap::const_iterator it = map.find(key); - - string year; - - if (it != map.end()) - year = parseBibTeX(it->second, "year"); - - if (year.empty()) - year = "50BC"; - - return year; -} - } // namespace anon @@ -325,6 +250,83 @@ caseSensitive); return regexSearch(theMap, keys, search_expr, start, dir); +} + + +string const getYear(InfoMap const & map, string const & key) +{ + lyx::Assert(!map.empty()); + + InfoMap::const_iterator it = map.find(key); + string year; + if (it != map.end()) + year = parseBibTeX(it->second, "year"); + if (year.empty()) + year = "50BC"; + return year; +} + + +string const familyName(string const & name) +{ + // Very simple parser + string fname = name; + + // possible authorname combinations are: + // "Surname, FirstName" + // "Surname, F." + // "FirstName Surname" + // "F. Surname" + string::size_type idx = fname.find(","); + if (idx != string::npos) + return frontStrip(fname.substr(0,idx)); + idx = fname.rfind("."); + if (idx == string::npos) + idx = fname.rfind(" "); + if (idx != string::npos) + fname = frontStrip(fname.substr(idx+1)); + // test if we have a LaTeX Space in front + if (fname[0] == '\\') + return fname.substr(2); + + return fname; +} + + +string const getAbbreviatedAuthor(InfoMap const & map, string const & key) +{ + lyx::Assert(!map.empty()); + + InfoMap::const_iterator it = map.find(key); + + string author; + if (it != map.end()) { + author = parseBibTeX(it->second, "author"); + if (author.empty()) + author = parseBibTeX(it->second, "editor"); + + vector<string> authors = getVectorFromString(author, "and"); + + if (!authors.empty()) { + author.erase(); + + for (vector<string>::iterator it = authors.begin(); + it != authors.end(); ++it) { + *it = familyName(strip(*it)); + } + + author = authors[0]; + if (authors.size() == 2) + author += _(" and ") + authors[1]; + else if (authors.size() > 2) + author += _(" et al."); + } + } + + if (author.empty()) + author = _("Caesar et al."); + + return author; } Index: src/frontends/controllers/biblio.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/controllers/biblio.h,v retrieving revision 1.4 diff -u -r1.4 biblio.h --- src/frontends/controllers/biblio.h 21 Mar 2002 21:21:28 -0000 1.4 +++ src/frontends/controllers/biblio.h 14 Apr 2002 16:11:27 -0000 @@ -60,6 +60,15 @@ Empty if no info exists. */ string const getInfo(InfoMap const &, string const &); + // rturn the year from the bibtex data record + string const getYear(InfoMap const & map, string const & key); + + /// return the short form of an authorlist + string const getAbbreviatedAuthor(InfoMap const & map, string const & key); + + // return only the family name + string const familyName(string const & name); + /** Search a BibTeX info field for the given key and return the associated field. */ string const parseBibTeX(string data, string const & findkey); Index: src/frontends/controllers/helper_funcs.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/controllers/helper_funcs.C,v retrieving revision 1.16 diff -u -r1.16 helper_funcs.C --- src/frontends/controllers/helper_funcs.C 21 Mar 2002 21:21:28 -0000 1.16 +++ src/frontends/controllers/helper_funcs.C 14 Apr 2002 16:11:27 -0000 @@ -31,50 +31,6 @@ using std::vector; using std::make_pair; - -string const getStringFromVector(vector<string> const & vec, - string const & delim) -{ - string str; - int i = 0; - for (vector<string>::const_iterator it = vec.begin(); - it != vec.end(); ++it) { - string item = strip(frontStrip(*it)); - if (item.empty()) continue; - - if (i++ > 0) str += delim; - str += item; - } - return str; -} - -vector<string> const getVectorFromString(string const & str, - string const & delim) -{ - vector<string> vec; - if (str.empty()) - return vec; - - string keys(strip(str)); - - for(;;) { - string::size_type const idx = keys.find(delim); - if (idx == string::npos) { - vec.push_back(frontStrip(keys)); - break; - } - - string const key = strip(frontStrip(keys.substr(0, idx))); - if (!key.empty()) - vec.push_back(key); - - string::size_type const start = idx + delim.size(); - keys = keys.substr(start); - } - - return vec; -} - string const browseFile(LyXView * lv, string const & filename, string const & title, string const & pattern, Index: src/frontends/controllers/helper_funcs.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/controllers/helper_funcs.h,v retrieving revision 1.8 diff -u -r1.8 helper_funcs.h --- src/frontends/controllers/helper_funcs.h 21 Mar 2002 21:21:28 -0000 1.8 +++ src/frontends/controllers/helper_funcs.h 14 Apr 2002 16:11:27 -0000 @@ -21,16 +21,6 @@ #pragma interface #endif -/** Functions to convert a string to/from a vector. */ - -/// -string const -getStringFromVector(std::vector<string> const & vec, string const & delim=","); - -/// -std::vector<string> const -getVectorFromString(string const & str, string const & delim=","); - class LyXView; /** Launch a file dialog and return the chosen file. Index: src/frontends/xforms/ChangeLog =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/ChangeLog,v retrieving revision 1.351 diff -u -r1.351 ChangeLog --- src/frontends/xforms/ChangeLog 12 Apr 2002 09:35:50 -0000 1.351 +++ src/frontends/xforms/ChangeLog 14 Apr 2002 16:11:28 -0000 @@ -1,3 +1,12 @@ +2002-04-14 Herbert Voss <[EMAIL PROTECTED]> + + * FormCitation.C: enable the "before" input field, when using + natbib citation style + + * FormCharacter.C + * FormExternal.C: adding #include "support/lstrings.h" + for the getStringFromVector and vice versa + 2002-04-12 Angus Leeming <[EMAIL PROTECTED]> * FormParagraph.C (changedParagraph): ensure that the warning message Index: src/frontends/xforms/FormCharacter.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/FormCharacter.C,v retrieving revision 1.22 diff -u -r1.22 FormCharacter.C --- src/frontends/xforms/FormCharacter.C 3 Apr 2002 07:04:28 -0000 1.22 +++ src/frontends/xforms/FormCharacter.C 14 Apr 2002 16:11:28 -0000 @@ -23,6 +23,8 @@ #include "combox.h" #include "helper_funcs.h" +#include "support/lstrings.h" + using std::vector; using std::find; Index: src/frontends/xforms/FormExternal.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/FormExternal.C,v retrieving revision 1.14 diff -u -r1.14 FormExternal.C --- src/frontends/xforms/FormExternal.C 21 Mar 2002 16:59:12 -0000 1.14 +++ src/frontends/xforms/FormExternal.C 14 Apr 2002 16:11:28 -0000 @@ -22,6 +22,8 @@ #include "xforms_helpers.h" #include "helper_funcs.h" +#include "support/lstrings.h" + typedef FormCB<ControlExternal, FormDB<FD_form_external> > base_class; FormExternal::FormExternal(ControlExternal & c) Index: src/insets/ChangeLog =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/ChangeLog,v retrieving revision 1.389 diff -u -r1.389 ChangeLog --- src/insets/ChangeLog 12 Apr 2002 15:59:03 -0000 1.389 +++ src/insets/ChangeLog 14 Apr 2002 16:11:29 -0000 @@ -1,3 +1,8 @@ +2002-04-14 Herbert Voss <[EMAIL PROTECTED]> + + * insetcite.C: show natbib citationlabels in wysiwyg when using + natbib option + 2002-04-12 Juergen Vigna <[EMAIL PROTECTED]> * insettext.h: added cix() helper function and use it where appropriate Index: src/insets/insetcite.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetcite.C,v retrieving revision 1.30 diff -u -r1.30 insetcite.C --- src/insets/insetcite.C 21 Mar 2002 17:09:48 -0000 1.30 +++ src/insets/insetcite.C 14 Apr 2002 16:11:29 -0000 @@ -1,11 +1,11 @@ -/* This file is part of* - * ====================================================== +/** + * \file insetcite.C + * Copyright 2001 the LyX Team + * Read the file COPYING * - * LyX, The Document Processor - * - * Copyright 2000-2001 The LyX Team. - * - * ====================================================== */ + * \author Angus Leeming, [EMAIL PROTECTED] + * \author Herbert Voss, [EMAIL PROTECTED] 2002-03-17 + */ #include <config.h> @@ -18,34 +18,162 @@ #include "BufferView.h" #include "LaTeXFeatures.h" #include "LyXView.h" +#include "debug.h" +#include "gettext.h" +#include "frontends/controllers/biblio.h" #include "frontends/Dialogs.h" +#include "support/filetools.h" #include "support/lstrings.h" - +#include "support/path.h" +#include "support/os.h" +#include "support/lstrings.h" +#include "support/LAssert.h" using std::ostream; - +using std::vector; +using std::pair; InsetCitation::InsetCitation(InsetCommandParams const & p, bool) : InsetCommand(p) {} -string const InsetCitation::getScreenLabel(Buffer const *) const -{ - string keys(getContents()); +namespace { - // If keys is "too long" then only print out the first few tokens +unsigned int const maxLabelChars = 45; +enum optionType { BEFORE, AFTER }; +// The info associated with each key +biblio::InfoMap bibkeysInfo; + +string const getString(string const & options, optionType type) +{ + string::size_type start, countChars; + switch (type) { + case BEFORE: + start = options.find("<\\before>"); + if (start != string::npos) { + start += 9; + countChars = options.find("<\\end_before>")-start; + return options.substr(start, countChars); + } + break; + case AFTER: + start = options.find("<\\after>"); + if (start != string::npos) { + start += 8; + countChars = options.find("<\\end_after>")-start; + return options.substr(start, countChars); + } else if (getString(options, ::BEFORE).empty()) + // no special options -> is after + return options; + break; + default:; + } + return string(); // all other situations +} + + +string const getNatbibLabel( + Buffer const * buf, + string const & citeType, string const & keyList, + string const & before, string const & after) { + // build the keylist + Buffer * tmp = const_cast<Buffer *>(buf); + vector<pair<string, string> > bibkeys = tmp->getBibkeyList(); + typedef std::map<string, string>::value_type InfoMapValue; + for (vector<pair<string,string> >::size_type i=0; i<bibkeys.size(); ++i) { + ::bibkeysInfo.insert(InfoMapValue(bibkeys[i].first, + bibkeys[i].second)); + } string label; + + // some of these citestyles have NO "before"!! + // the natbib citation-styles + // CITET: author (year) + // CITEP: (author,year) + // CITEALT: author year + // CITEALP: author, year + // CITEAUTHOR: author + // CITEYEAR: year + // CITEYEARPAR: (year) + vector<string> keys = getVectorFromString(keyList); + vector<string>::const_iterator sit; + for (sit = keys.begin(); sit != keys.end(); ++sit) { + // get the bibdata corresponding to the key + string const author(biblio::getAbbreviatedAuthor(bibkeysInfo, *sit)); + string const year(biblio::getYear(bibkeysInfo, *sit)); + + // ( ... (<before> year); ... (<before> year, <after>) (1) + if (citeType == "citet") { + if (!before.empty()) + label += (author + " (" + before + ' ' + year + "); "); + else + label += (author + " (" + year + "); "); + + // author,year; author,year; ... (2/4) + } else if (citeType == "citep" || citeType == "citealp") { + label += (author + ',' + year + "; "); + + // ( ... <before> year; ... <before> year, <after> (3) + } else if (citeType == "citealt") { + if (!before.empty()) + label += (author + ' ' + before + ' ' + year + "; "); + else + label += (author + ' ' + year + "; "); + + // author; author; ... (5) + } else if (citeType == "citeauthor") { + label += (author + ';'); + + // year; year; ... (6/7) + } else if (citeType == "citeyear" || citeType == "citeyearpar") { + label += (year + ';'); + } + } + label = strip(strip(label), ';'); + + // ( ... (<before> year) ... , <after>) + if (citeType == "citet") { + if (!after.empty()) + // insert "after" before last ')' + return label.substr(0,label.size()-1) + ", " + after + ')'; + + // <before> ... , <after> and for citealp/citeyearpar with parenthesis + } else if (citeType == "citep" || citeType == "citealp" || + citeType == "citeyearpar") { + if (!before.empty()) + label = before + ' ' + label; + if (!after.empty()) + label = label + ", " + after; + if (citeType == "citep" || citeType == "citeyearpar") + return '(' + label + ')'; + + // ... <before> year, <after> + } else if (citeType == "citealt") { + if (!after.empty()) + return label.substr(0,label.size()-1) + ", " + after; + + // no before-option! ... , <after> + } else if (citeType == "citeauthor" || citeType == "citeyear") { + if (!after.empty()) + return label + ", " + after; + } + return label; +} + + +string const getKeyLabel(string const & keyList, string const & after) { + string keys(keyList); + string label; + // If keys is "too long" then only print out the first few tokens if (contains(keys, ",")) { // Final comma allows while loop to cover all keys keys = frontStrip(split(keys, label, ',')) + ","; - string::size_type const maxSize = 40; while (contains(keys, ",")) { string key; keys = frontStrip(split(keys, key, ',')); - string::size_type size = label.size() + 2 + key.size(); if (size >= maxSize) { label += ", ..."; @@ -53,16 +181,38 @@ } label += ", " + key; } - } else { + } else label = keys; - } - - if (!getOptions().empty()) - label += ", " + getOptions(); + if (!after.empty()) + label += ", " + after; + return "[" + label + "]"; } +} // anon namespace + + +string const InsetCitation::getScreenLabel(Buffer const * buffer) const +{ + string const options(getOptions()); + string label; + // do we have natbibstyle without numerical citations?? + if (buffer->params.use_natbib && !buffer->params.use_numerical_citations) { + label = getNatbibLabel(buffer, + getCmdName(), getContents(), + getString(options, ::BEFORE), + getString(options, ::AFTER)); + + if (label.size() > maxLabelChars) + return (label.substr(0,maxLabelChars-3)+"..."); + else if (!label.empty()) + return label; + } + // no natbibstyle or no bibtexfile (bibliographystyle in lyx) + return getKeyLabel(getContents(), getString(options, ::AFTER)); +} + void InsetCitation::edit(BufferView * bv, int, int, unsigned int) { @@ -92,9 +242,13 @@ os << getCmdName(); else os << "cite"; - - if (!getOptions().empty()) - os << "[" << getOptions() << "]"; + + string const before = getString(getOptions(), ::BEFORE); + string const after = getString(getOptions(), ::AFTER); + if (!before.empty() && buffer->params.use_natbib) + os << "[" << before << "][" << after << "]"; + else if (!after.empty()) + os << "[" << after << "]"; // Paranoia check: make sure that there is no whitespace in here string content; @@ -114,3 +268,4 @@ if (features.bufferParams().use_natbib) features.require("natbib"); } + Index: src/support/ChangeLog =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/ChangeLog,v retrieving revision 1.96 diff -u -r1.96 ChangeLog --- src/support/ChangeLog 8 Apr 2002 16:52:33 -0000 1.96 +++ src/support/ChangeLog 14 Apr 2002 16:11:30 -0000 @@ -1,3 +1,8 @@ +2002-04-14 Herbert Voss <[EMAIL PROTECTED]> + + * helper_funcs.[Ch]: move the getVectorFromString and the vice versa + from frontends/controlelrs/helper_funcs for better use in other programs + 2002-04-08 Herbert Voss <[EMAIL PROTECTED]> * filetools.C (getExtFromContents): get tgif run Index: src/support/lstrings.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/lstrings.C,v retrieving revision 1.51 diff -u -r1.51 lstrings.C --- src/support/lstrings.C 21 Mar 2002 17:06:35 -0000 1.51 +++ src/support/lstrings.C 14 Apr 2002 16:11:30 -0000 @@ -27,6 +27,7 @@ using std::count; using std::transform; +using std::vector; #ifndef CXX_GLOBAL_CSTD using std::tolower; @@ -632,3 +633,45 @@ } return enc; } + + +/// gives a vector of stringparts which have the delimiter delim +vector<string> const getVectorFromString(string const & str, + string const & delim = ",") +{ + vector<string> vec; + if (str.empty()) + return vec; + string keys(strip(str)); + for(;;) { + string::size_type const idx = keys.find(delim); + if (idx == string::npos) { + vec.push_back(frontStrip(keys)); + break; + } + string const key = strip(frontStrip(keys.substr(0, idx))); + if (!key.empty()) + vec.push_back(key); + string::size_type const start = idx + delim.size(); + keys = keys.substr(start); + } + return vec; +} + +// the same vice versa +string const getStringFromVector(vector<string> const & vec, + string const & delim = ",") +{ + string str; + int i = 0; + for (vector<string>::const_iterator it = vec.begin(); + it != vec.end(); ++it) { + string item = strip(frontStrip(*it)); + if (item.empty()) continue; + + if (i++ > 0) str += delim; + str += item; + } + return str; +} + Index: src/support/lstrings.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/lstrings.h,v retrieving revision 1.36 diff -u -r1.36 lstrings.h --- src/support/lstrings.h 21 Mar 2002 17:06:35 -0000 1.36 +++ src/support/lstrings.h 14 Apr 2002 16:11:30 -0000 @@ -18,11 +18,14 @@ //#include <cstring> //#include <cctype> +//#include <cctype> +#include <vector> #include "Lsstream.h" #include "LString.h" +using std::vector; /// int compare_no_case(string const & s, string const & s2); @@ -249,5 +252,13 @@ /// Escapes non ASCII chars string const escape(string const & lab); + +/// gives a vector of stringparts which have the delimiter delim +vector<string> const getVectorFromString(string const & str, + string const & delim = ","); + +// the same vice versa +string const getStringFromVector(vector<string> const & vec, + string const & delim = ","); #endif