+2006-02-16 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * flower/include/std-vector.hh[!HAVE_STL_DATA_METHOD]: Add copy
+ constructor.
+
+ * lily/std-string.cc:
+ * lily/include/std-vector.hh (split_string): Move and rename from
+ lily/include/misc.hh, lily/misc.cc. Update callers.
+
2006-02-16 Han-Wen Nienhuys <hanwen@xs4all.nl>
* lily/include/pango-font.hh: HAVE_PANGO_FT2 iso. HAVE_PANGO_16
return dirs_;
}
-/*
- TODO: use split_string.
-
- */
-
#include <algorithm>
void
File_path::parse_path (string p)
{
- ssize len;
- while ((len = p.length ()))
- {
- ssize i = p.find (PATHSEP);
- if (i == NPOS)
- i = len;
- append (p.substr (0, i));
- p = p.substr (min (len, i + 1));
- }
+ concat (dirs_, string_split (p, PATHSEP));
}
bool
public:
typedef typename __vector<T>::iterator iterator;
typedef typename __vector<T>::const_iterator const_iterator;
-
+
vector<T, A> () : __vector<T, A> ()
{
}
-
+
+ vector<T, A> (vector<T, A> const& v) : __vector<T, A> (v)
+ {
+ }
+
vector<T, A> (const_iterator b, const_iterator e) : __vector<T, A> (b, e)
{
}
-
+
T*
data ()
{
return &(*this)[0];
}
-
+
T const*
data () const
{
{
v.insert (v.end (), w.begin (), w.end ());
}
-
+
template<class T>
void
binary_search_bounds (vector<T> const &table,
vector_sort (v, compare, last + 1, upper);
}
#endif
-
+
template<typename T>
void
reverse (vector<T> &v)
}
#endif /* HAVE_BOOST_LAMBDA */
+vector<string> string_split (string str, char c);
+
#endif /* STD_VECTOR_HH */
{
return a.compare (b);
}
+
+#include "std-vector.hh"
+vector<string>
+string_split (string str, char c)
+{
+ vector<string> a;
+ ssize i = str.find (c);
+ while (i != NPOS)
+ {
+ string s = str.substr (0, i);
+ a.push_back (s);
+ while (str[++i] == c)
+ ;
+ str = str.substr (i);
+ i = str.find (c);
+ }
+ if (str.length ())
+ a.push_back (str);
+ return a;
+}
"Formats passed to --format as a list of strings, "
"used for the output.")
{
- vector<string> output_formats = split_string (output_format_global, ',');
+ vector<string> output_formats = string_split (output_format_global, ',');
SCM lst = SCM_EOL;
int output_formats_count = output_formats.size ();
else return 0;
}
-vector<string> split_string (string s, char c);
-
inline Real
linear_interpolate (Real x, Real x1, Real x2, Real y1, Real y2)
{
string s = symbols;
replace_all (s, '\n', ' ');
replace_all (s, '\t', ' ');
- return ly_string_array_to_scm (split_string (s, ' '));
+ return ly_string_array_to_scm (string_split (s, ' '));
}
SCM
patch_ = 0;
vector<string> version;
- version = split_string (str, '.');
+ version = string_split (str, '.');
if (version.size () > 0 && isdigit (version[0][0]))
major_ = String_convert::dec2int (version[0]);
USER_NAME, GROUP_NAME, JAIL, DIR, JAIL_MAX
};
- vector<string> components = split_string (jail_spec, ',');
+ vector<string> components = string_split (jail_spec, ',');
if (components.size () != JAIL_MAX)
{
error (_f ("expected %d arguments with jail, found: %d", JAIL_MAX,
#include "misc.hh"
-#include "std-string.hh"
/*
Return the 2-log, rounded down
return log (x) / log (2.0);
}
-vector<string>
-split_string (string str, char c)
-{
- vector<string> a;
- ssize i = str.find (c);
- while (i != NPOS)
- {
- string s = str.substr (0, i);
- a.push_back (s);
- while (str[++i] == c)
- ;
- str = str.substr (i);
- i = str.find (c);
- }
- if (str.length ())
- a.push_back (str);
- return a;
-}
-
-#if 0
-vector<string>
-split_string (string s, char c)
-{
- vector<string> rv;
- while (s.length ())
- {
- ssize i = s.find (c);
-
- if (i == 0)
- {
- s = s.substr (1, s.length () -1);
- continue;
- }
-
- if (i == NPOS)
- i = s.length ();
-
- rv.push_back (s.substr (0, i));
- s = s.substr (i, s.length () - i);
- }
-
- return rv;
-}
-#endif
-
-
Real
directed_round (Real f, Direction d)
{