+2002-04-14 Herbert Voss <voss@perce.de>
+
+ * helper_funcs.[Ch]: move the getVectorFromString and the vice versa
+ into the support/lstrings for better use in other programs.
+
+ * biblio.[Ch] (getYear, getAbbreviatedAuthor, familyName): move out of
+ namespace anon and make globally accessible.
+ (familyName): test for the presence of a LaTeX Space at the front of
+ of a name; strip it if it exists.
+
2002-04-11 Herbert Voss <voss@perce.de>
* ControlGraphics.C: expand "browse-string" to all available formats
return keys.end();
}
+
+} // namespace anon
+
+
string const familyName(string const & name)
{
// Very simple parser
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;
}
return year;
}
-} // namespace anon
-
-
// A functor for use with std::sort, leading to case insensitive sorting
struct compareNoCase: public std::binary_function<string, string, bool>
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);
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,
#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.
+2002-04-14 Herbert Voss <voss@perce.de>
+
+ * FormCharacter.C
+ * FormExternal.C: adding #include "support/lstrings.h"
+ for the getStringFromVector and vice versa
+
2002-04-12 Angus Leeming <a.leeming@ic.ac.uk>
* FormParagraph.C (changedParagraph): ensure that the warning message
#include "combox.h"
#include "helper_funcs.h"
+#include "support/lstrings.h"
+
using std::vector;
using std::find;
#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)
+2002-04-14 Herbert Voss <voss@perce.de>
+
+ * lstrings.[Ch]: move the getVectorFromString and the vice versa
+ from frontends/controllers/helper_funcs for better use in other
+ programs
+
2002-04-15 Angus Leeming <a.leeming@ic.ac.uk>
* tempname.C (make_tempfile): simplify the #ifdef block by using
using std::count;
using std::transform;
+using std::vector;
#ifndef CXX_GLOBAL_CSTD
using std::tolower;
}
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;
+}
+
//#include <cstring>
//#include <cctype>
+//#include <cctype>
+#include <vector>
#include "Lsstream.h"
#include "LString.h"
-
///
int compare_no_case(string const & s, string const & s2);
/// Escapes non ASCII chars
string const escape(string const & lab);
+/// gives a vector of stringparts which have the delimiter delim
+std::vector<string> const getVectorFromString(string const & str,
+ string const & delim = ",");
+
+// the same vice versa
+string const getStringFromVector(std::vector<string> const & vec,
+ string const & delim = ",");
+
#endif