#ifdef __CYGWIN__
static string
-dos_to_posix (string file_name)
+dos_to_posix (const string &file_name)
{
char buf[PATH_MAX] = "";
char s[PATH_MAX] = {0};
}
string
-dir_name (string const file_name)
+dir_name (const string &file_name)
{
string s = file_name;
s = slashify (s);
#include <algorithm>
void
-File_path::parse_path (string p)
+File_path::parse_path (const string &p)
{
concat (dirs_, string_split (p, PATHSEP));
}
bool
-is_file (string file_name)
+is_file (const string &file_name)
{
#if !STAT_MACROS_BROKEN
struct stat sbuf;
The file name if found, or empty string if not found. */
string
-File_path::find (string name) const
+File_path::find (const string &name) const
{
if (!name.length () || (name == "-"))
return name;
where EXT is from EXTENSIONS.
*/
string
-File_path::find (string name, char const *extensions[])
+File_path::find (const string &name, char const *extensions[])
{
if (name.empty () || name == "-")
return name;
}
void
-File_path::append (string str)
+File_path::append (const string &str)
{
dirs_.push_back (str);
}
void
-File_path::prepend (string str)
+File_path::prepend (const string &str)
{
dirs_.insert (dirs_.begin (), str);
}
#include "std-vector.hh"
#include "std-string.hh"
-std::string dir_name (std::string file_name);
+std::string dir_name (const std::string &file_name);
std::string get_working_directory ();
class File_name
public:
vector<string> directories () const;
- string find (string name) const;
- string find (string name, char const *extensions[]);
+ string find (const string &name) const;
+ string find (const string &name, char const *extensions[]);
string to_string () const;
bool try_append (string str);
- void append (string str);
- void parse_path (string);
- void prepend (string str);
+ void append (const string&);
+ void parse_path (const string&);
+ void prepend (const string&);
};
-bool is_file (string file_name);
+bool is_file (const string &file_name);
bool is_dir (string file_name);
#endif /* FILE_PATH */
*/
string _f (char const *format, ...)
__attribute__ ((format (printf, 1, 2)));
-string _f (char const *format, string s, string s2 = "", string s3 = "");
+string _f (char const *format, const string &s, const string &s2 = "", const string &s3 = "");
/**
va_list version of _f
*/
typedef size_t ssize;
#define NPOS string::npos
-string to_string (string s);
+string to_string (const string&);
string to_string (char c, int n = 1);
string to_string (int i, char const *format = 0);
string to_string (double f, char const *format = 0);
string &replace_all (string *str, string const &find, string const &replace);
string &replace_all (string *str, char find, char replace);
-char *string_copy (string s);
+char *string_copy (const string &s);
int string_compare (string const &, string const &);
}
vector<string> string_split (string str, char c);
-string string_join (vector<string> const &strs, string infix);
+string string_join (vector<string> const &strs, const string &infix);
#define iterof(i,s) typeof((s).begin()) i((s).begin())
static int hex2nibble (Byte byte);
static Byte nibble2hex_byte (Byte byte);
public:
- static string pad_to (string s, size_t length);
+ static string pad_to (const string &s, size_t length);
static string bool_string (bool b);
static string bin2hex (Byte bin_char);
- static string bin2hex (string bin_string);
- static int bin2int (string bin_string);
- static unsigned bin2unsigned (string bin_string);
+ static string bin2hex (const string &bin_string);
+ static int bin2int (const string &bin_string);
+ static unsigned bin2unsigned (const string &bin_string);
static string char_string (char c, int n);
- static int dec2int (string dec_string);
- static double dec2double (string dec_string);
+ static int dec2int (const string &dec_string);
+ static double dec2double (const string &dec_string);
static string double_string (double f, char const *fmt = 0);
static string form_string (char const *format, ...) __attribute__ ((format (printf, 1, 2)));
static string vform_string (char const *format, va_list args);
- static string hex2bin (string str);
+ static string hex2bin (const string &str);
static string int_string (int i, char const *fmt = 0);
static string unsigned_string (unsigned);
static string unsigned_long_string (unsigned long);
extern bool warning_as_error;
/* output messages, in decreasing order of importance */
-void error (string s, string location = ""); // Fatal error, exits lilypond!
-void programming_error (string s, string location = "");
-void non_fatal_error (string, string location = "");
-void warning (string s, string location = "");
-void basic_progress (string s, string location = "");
+void error (string s, const string &location = ""); // Fatal error, exits lilypond!
+void programming_error (const string &s, const string &location = "");
+void non_fatal_error (const string&, const string &location = "");
+void warning (const string &s, const string &location = "");
+void basic_progress (const string &s, const string &location = "");
/* progress_indication does by default *NOT* start on a new line */
-void progress_indication (string s, bool newline = false, string location = "");
-void message (string s, bool newline = true, string location = "");
-void debug_output (string s, bool newline = true, string location = "");
+void progress_indication (const string &s, bool newline = false, const string &location = "");
+void message (const string &s, bool newline = true, const string &location = "");
+void debug_output (const string &s, bool newline = true, const string &location = "");
/* Helper functions that always print out the message. Callers should ensure
that the loglevel is obeyed */
-void print_message (int level, string location, string s, bool newline = true);
+void print_message (int level, const string &location, string s, bool newline = true);
bool is_loglevel (int level);
void set_loglevel (int level);
void set_loglevel (string level);
-void expect_warning (string msg);
+void expect_warning (const string &msg);
void check_expected_warnings ();
#endif /* WARN_HH */
}
string
-_f (char const *format, string s, string s2, string s3)
+_f (char const *format, const string &s, const string &s2, const string &s3)
{
return String_convert::form_string (gettext (format), s.c_str (), s2.c_str (),
s3.c_str ());
#include "string-convert.hh"
string
-to_string (string s)
+to_string (const string &s)
{
return s;
}
}
char *
-string_copy (string s)
+string_copy (const string &s)
{
ssize len = s.length ();
char *dest = new char[len + 1];
}
string
-string_join (vector<string> const &strs, string infix)
+string_join (vector<string> const &strs, const string &infix)
{
string result;
for (vsize i = 0; i < strs.size (); i++)
}
string
-String_convert::bin2hex (string bin_string)
+String_convert::bin2hex (const string &bin_string)
{
string str;
Byte const *byte = (Byte const *)bin_string.data ();
}
int
-String_convert::bin2int (string bin_string)
+String_convert::bin2int (const string &bin_string)
{
return bin2unsigned (bin_string);
}
unsigned
-String_convert::bin2unsigned (string bin_string)
+String_convert::bin2unsigned (const string &bin_string)
{
assert (bin_string.length () <= (int)sizeof (unsigned));
}
int
-String_convert::dec2int (string dec_string)
+String_convert::dec2int (const string &dec_string)
{
if (!dec_string.length ())
return 0;
}
// breendet imp from string
double
-String_convert::dec2double (string dec_string)
+String_convert::dec2double (const string &dec_string)
{
if (!dec_string.length ())
return 0;
}
string
-String_convert::hex2bin (string hex_string)
+String_convert::hex2bin (const string &hex_string)
{
string str;
}
string
-String_convert::pad_to (string s, size_t n)
+String_convert::pad_to (const string &s, size_t n)
{
return s + string (max (int (n - s.length ()), 0), ' ');
}
string
String_convert::to_upper (string s)
{
- return strnupr ((char *)s.c_str (), s.length ());
+ return strnupr (const_cast<char*>(s.c_str ()), s.length ());
}
string
String_convert::to_lower (string s)
{
- return strnlwr ((char *)s.c_str (), s.length ());
+ return strnlwr (const_cast<char*>(s.c_str ()), s.length ());
}
string
* expected warnings again.
*/
vector<string> expected_warnings;
-void expect_warning (string msg)
+void expect_warning (const string &msg)
{
expected_warnings.push_back (msg);
}
expected_warnings.clear ();
}
-bool is_expected (string s)
+bool is_expected (const string &s)
{
bool expected = false;
for (vsize i = 0; i < expected_warnings.size (); i++)
if newline is true, start the message on a new line.
*/
void
-print_message (int level, string location, string s, bool newline)
+print_message (int level, const string &location, string s, bool newline)
{
/* Only print the message if the current loglevel allows it: */
if (!is_loglevel (level))
/* Display a fatal error message. Also exits lilypond. */
void
-error (string s, string location)
+error (string s, const string &location)
{
print_message (LOG_ERROR, location, _f ("fatal error: %s", s) + "\n");
exit (1);
/* Display a severe programming error message, but don't exit. */
void
-programming_error (string s, string location)
+programming_error (const string &s, const string &location)
{
if (is_expected (s))
print_message (LOG_DEBUG, location, _f ("suppressed programming error: %s", s) + "\n");
/* Display a non-fatal error message, don't exit. */
void
-non_fatal_error (string s, string location)
+non_fatal_error (const string &s, const string &location)
{
if (is_expected (s))
print_message (LOG_DEBUG, location, _f ("suppressed error: %s", s) + "\n");
/* Display a warning message. */
void
-warning (string s, string location)
+warning (const string &s, const string &location)
{
if (is_expected (s))
print_message (LOG_DEBUG, location, _f ("suppressed warning: %s", s) + "\n");
/* Display a success message. */
void
-basic_progress (string s, string location)
+basic_progress (const string &s, const string &location)
{
print_message (LOG_BASIC, location, s + "\n", true);
}
/* Display information about the progress. */
void
-progress_indication (string s, bool newline, string location)
+progress_indication (const string &s, bool newline, const string &location)
{
print_message (LOG_PROGRESS, location, s, newline);
}
/* Display a single info message. */
void
-message (string s, bool newline, string location)
+message (const string &s, bool newline, const string &location)
{
// Use the progress loglevel for all normal messages (including progress msg)
print_message (LOG_INFO, location, s, newline);
/* Display a debug information, not necessarily on a new line. */
void
-debug_output (string s, bool newline, string location)
+debug_output (const string &s, bool newline, const string &location)
{
print_message (LOG_DEBUG, location, s, newline);
}
#include "warn.hh"
Index_to_charcode_map const *
-All_font_metrics::get_index_to_charcode_map (string filename,
+All_font_metrics::get_index_to_charcode_map (const string &filename,
int face_index,
FT_Face face)
{
return &filename_charcode_maps_map_[key];
}
-All_font_metrics::All_font_metrics (string path)
+All_font_metrics::All_font_metrics (const string &path)
{
otf_dict_ = new Scheme_hash_table;
#endif
Open_type_font *
-All_font_metrics::find_otf (string name)
+All_font_metrics::find_otf (const string &name)
{
SCM sname = ly_symbol2scm (name.c_str ());
SCM val;
}
Font_metric *
-All_font_metrics::find_font (string name)
+All_font_metrics::find_font (const string &name)
{
Font_metric *f = find_otf (name);
one_beat_ = one_beat;
}
-Audio_text::Audio_text (Audio_text::Type type, string text_string)
+Audio_text::Audio_text (Audio_text::Type type, const string &text_string)
{
text_string_ = text_string;
type_ = type;
private:
SCM split_list_;
Direction where_dir_;
- void change_to (Music_iterator *, SCM, string);
+ void change_to (Music_iterator *, SCM, const string&);
Moment start_moment_;
Context_handle up_;
void
Auto_change_iterator::change_to (Music_iterator *it, SCM to_type_sym,
- string to_id)
+ const string &to_id)
{
Context *current = it->get_outlet ();
Context *last = 0;
}
SCM
-Axis_group_interface::internal_calc_pure_relevant_grobs (Grob *me, string grob_set_name)
+Axis_group_interface::internal_calc_pure_relevant_grobs (Grob *me, const string &grob_set_name)
{
extract_grob_set (me, grob_set_name.c_str (), elts);
#include "warn.hh"
void
-Change_iterator::error (string reason)
+Change_iterator::error (const string &reason)
{
string to_type = ly_symbol2string (get_music ()->get_property ("change-to-type"));
string to_id = ly_scm2string (get_music ()->get_property ("change-to-id"));
/* TODO: this shares code with find_create_context (). */
Context *
-Context::create_unique_context (SCM name, string id, SCM operations)
+Context::create_unique_context (SCM name, const string &id, SCM operations)
{
/*
Don't create multiple score contexts.
}
Context *
-Context::find_create_context (SCM n, string id, SCM operations)
+Context::find_create_context (SCM n, const string &id, SCM operations)
{
/*
Don't create multiple score contexts.
Context *
Context::create_context (Context_def *cdef,
- string id,
+ const string &id,
SCM ops)
{
infant_event_ = 0;
}
Context *
-Context::get_default_interpreter (string context_id)
+Context::get_default_interpreter (const string &context_id)
{
if (!is_bottom_context ())
{
*/
Context *
find_context_below (Context *where,
- SCM type, string id)
+ SCM type, const string &id)
{
if (where->is_alias (type))
{
{
Audio_staff *control_track_;
- void add_text (Audio_text::Type, string);
+ void add_text (Audio_text::Type, const string&);
TRANSLATOR_DECLARATIONS (Control_track_performer);
protected:
}
void
-Control_track_performer::add_text (Audio_text::Type text_type, string str)
+Control_track_performer::add_text (Audio_text::Type text_type, const string &str)
{
Audio_item *text = new Audio_text (text_type, str);
control_track_->add_audio_item (text);
map<string, string> file_name_map_global;
string
-map_file_name (string s)
+map_file_name (const string &s)
{
if (file_name_map_global.find (s) != file_name_map_global.end ())
- s = file_name_map_global[s];
+ return file_name_map_global[s];
return s;
}
return Box (Interval (0, 0), Interval (0, 0));
}
-size_t
-Font_metric::name_to_index (string) const
-{
- return (size_t) - 1;
-}
-
Offset
Font_metric::get_indexed_wxwy (size_t) const
{
}
Offset
-Font_metric::attachment_point (string) const
+Font_metric::attachment_point (const string&) const
{
return Offset (0, 0);
}
Stencil
Font_metric::text_stencil (Output_def *state,
- string, bool) const
+ const string&, bool) const
{
(void) state;
static SCM doc_hash_table;
void
-ly_check_name (string cxx, string scm_name)
+ly_check_name (const string &cxx, const string &scm_name)
{
string mangle = mangle_cxx_identifier (cxx);
if (mangle != scm_name)
void
ly_add_function_documentation (SCM func,
- string fname,
- string varlist,
- string doc)
+ const string &fname,
+ const string &varlist,
+ const string &doc)
{
if (doc == "")
return;
void
ly_add_type_predicate (void *ptr,
- string name)
+ const string &name)
{
type_names[ptr] = name;
}
}
Context *
-Global_context::get_default_interpreter (string /* context_id */)
+Global_context::get_default_interpreter (const string &/* context_id */)
{
if (get_score_context ())
return get_score_context ()->get_default_interpreter ();
#include "grob.hh"
-void check_prefix (string name, int mask, int prefix_set, string *str)
+void check_prefix (const string &name, int mask, int prefix_set, string *str)
{
if (prefix_set & mask)
{
MESSAGES
****************************************************************/
void
-Grob::programming_error (string s) const
+Grob::programming_error (const string &s) const
{
SCM cause = self_scm ();
while (Grob *g = unsmob_grob (cause))
}
void
-Grob::warning (string s) const
+Grob::warning (const string &s) const
{
SCM cause = self_scm ();
while (Grob *g = unsmob_grob (cause))
/** Set the new input file to NAME, remember old file. */
void
-Includable_lexer::new_input (string name, Sources *sources)
+Includable_lexer::new_input (const string &name, Sources *sources)
{
string current_dir = dir_name (main_input_name_);
if (relative_includes)
}
void
-Includable_lexer::new_input (string name, string data, Sources *sources)
+Includable_lexer::new_input (const string &name, string data, Sources *sources)
{
Source_file *file = new Source_file (name, data);
sources->add (file);
All_font_metrics (All_font_metrics const &);
public:
- Index_to_charcode_map const *get_index_to_charcode_map (string filename,
+ Index_to_charcode_map const *get_index_to_charcode_map (const string &filename,
int face_index,
FT_Face face);
- All_font_metrics (string search_path);
+ All_font_metrics (const string &search_path);
~All_font_metrics ();
Pango_font *find_pango_font (PangoFontDescription const *description,
Real scale);
- Font_metric *find_font (string name);
- Open_type_font *find_otf (string name);
+ Font_metric *find_font (const string &name);
+ Open_type_font *find_otf (const string &name);
SCM font_descriptions () const;
};
MARKER, CUE_POINT
};
- Audio_text (Audio_text::Type type, string text_string);
+ Audio_text (Audio_text::Type type, const string &text_string);
Type type_;
string text_string_;
DECLARE_SCHEME_CALLBACK (calc_pure_relevant_items, (SCM));
DECLARE_SCHEME_CALLBACK (calc_pure_relevant_spanners, (SCM));
DECLARE_SCHEME_CALLBACK (calc_pure_y_common, (SCM));
- static SCM internal_calc_pure_relevant_grobs (Grob *, string);
+ static SCM internal_calc_pure_relevant_grobs (Grob *, const string&);
static Interval relative_group_extent (vector<Grob *> const &list,
Grob *common, Axis);
static Interval relative_maybe_bound_group_extent (vector<Grob *> const &list,
DECLARE_CLASSNAME (Change_iterator);
private:
- void error (string);
+ void error (const string&);
};
#endif
void instrumented_set_property (SCM, SCM, const char *, int, const char *);
void internal_set_property (SCM var_sym, SCM value);
- Context *create_context (Context_def *, string, SCM);
+ Context *create_context (Context_def *, const string&, SCM);
DECLARE_LISTENER (create_context_from_event);
DECLARE_LISTENER (acknowledge_infant);
DECLARE_LISTENER (remove_context);
virtual Context *get_score_context () const;
virtual Output_def *get_output_def () const;
virtual Moment now_mom () const;
- virtual Context *get_default_interpreter (string context_id = "");
+ virtual Context *get_default_interpreter (const string &context_id = "");
bool is_alias (SCM) const;
void add_alias (SCM);
bool is_removable () const;
Context *find_create_context (SCM context_name,
- string id, SCM ops);
- Context *create_unique_context (SCM context_name, string context_id,
+ const string &id, SCM ops);
+ Context *create_unique_context (SCM context_name, const string &context_id,
SCM ops);
vector<Context_def *> path_to_acceptable_context (SCM alias) const;
};
SCM context_property, SCM grob_property_path, SCM val);
SCM updated_grob_properties (Context *tg, SCM sym);
Context *find_context_below (Context *where,
- SCM type_sym, string id);
+ SCM type_sym, const string &id);
bool melisma_busy (Context *);
Context *get_voice_to_lyrics (Context *lyrics);
#include "std-string.hh"
-string map_file_name (string s);
+string map_file_name (const string &s);
#endif /* FILE_NAME_MAP_HH */
// Return stencil for given string. output_state may be modified to
// record the font.
virtual Stencil text_stencil (Output_def *output_state,
- string text, bool music) const;
+ const string &text, bool music) const;
virtual string font_name () const;
virtual size_t count () const;
- virtual Offset attachment_point (string) const;
+ virtual Offset attachment_point (const string&) const;
virtual Offset get_indexed_wxwy (size_t) const;
virtual Box get_indexed_char_dimensions (size_t index) const;
- virtual size_t name_to_index (string) const;
+ virtual size_t name_to_index (string) const=0;
virtual size_t index_to_charcode (size_t) const;
virtual Real design_size () const;
virtual Stencil find_by_name (string) const;
virtual SCM get_output ();
virtual Output_def *get_output_def () const;
virtual Moment now_mom () const;
- virtual Context *get_default_interpreter (string context_id = "");
+ virtual Context *get_default_interpreter (const string &context_id = "");
Moment previous_moment () const;
protected:
void internal_set_property (SCM sym, SCM val);
/* messages */
- void warning (string) const;
- void programming_error (string) const;
+ void warning (const string&) const;
+ void programming_error (const string&) const;
/* class hierarchy */
virtual System *get_system () const;
vector<string> file_name_strings_;
Source_file *get_source_file () const;
- virtual void new_input (string s, Sources *);
+ virtual void new_input (const string &s, Sources *);
- void new_input (string name, string data, Sources *);
+ void new_input (const string &name, string data, Sources *);
char const *here_str0 () const;
};
char const *end () const;
void set (Source_file *, char const *, char const *);
- void error (string) const;
- void programming_error (string) const;
- void non_fatal_error (string) const;
- void warning (string) const;
- void message (string) const;
- void debug_output (string) const;
+ void error (const string&) const;
+ void programming_error (const string&) const;
+ void non_fatal_error (const string&) const;
+ void warning (const string&) const;
+ void message (const string&) const;
+ void debug_output (const string&) const;
void set_spot (Input const &);
void step_forward ();
void set_location (Input const &, Input const &);
Input ();
protected:
string message_location () const;
- string message_string (string msg) const;
+ string message_string (const string &msg) const;
};
#include "smobs.hh"
string mangle_cxx_identifier (string);
-void ly_add_type_predicate (void *ptr, string name);
+void ly_add_type_predicate (void *ptr, const string &name);
string predicate_to_typename (void *ptr);
/*
#define MAKE_SCHEME_CALLBACK(TYPE, FUNC, ARGCOUNT) \
MAKE_SCHEME_CALLBACK_WITH_OPTARGS(TYPE,FUNC,ARGCOUNT, 0, "");
-void ly_add_function_documentation (SCM proc, string fname, string varlist, string doc);
-void ly_check_name (string cxx, string fname);
+void ly_add_function_documentation (SCM proc, const string &fname, const string &varlist, const string &doc);
+void ly_check_name (const string &cxx, const string &fname);
#define ADD_SCM_INIT_FUNC(name, func) \
class name ## _scm_initter \
extern SCM global_lily_module;
-string gulp_file_to_string (string fn, bool must_exist, int size);
+string gulp_file_to_string (const string &fn, bool must_exist, int size);
SCM ly_string2scm (string const &s);
string ly_scm2string (SCM s);
string ly_symbol2string (SCM);
-string robust_symbol2string (SCM, string);
+string robust_symbol2string (SCM, const string&);
Rational ly_scm2rational (SCM);
SCM ly_rational2scm (Rational);
SCM ly_offset2scm (Offset);
Drul_array<bool> robust_scm2booldrul (SCM, Drul_array<bool>);
Interval robust_scm2interval (SCM, Drul_array<Real>);
Offset robust_scm2offset (SCM, Offset);
-string robust_scm2string (SCM, string);
+string robust_scm2string (SCM, const string&);
Rational robust_scm2rational (SCM, Rational);
vector<Real> ly_scm2floatvector (SCM);
SCM ly_floatvector2scm (vector<Real> v);
DECLARE_SMOBS (Lily_lexer);
private:
- int lookup_keyword (string);
- int scan_bare_word (string);
- int scan_escaped_word (string);
- int scan_shorthand (string);
+ int lookup_keyword (const string&);
+ int scan_bare_word (const string&);
+ int scan_escaped_word (const string&);
+ int scan_shorthand (const string&);
int scan_scm_id (SCM);
int identifier_type (SCM);
char escaped_char (char) const;
void start_main_input ();
- virtual void new_input (string s, Sources *);
- virtual void new_input (string s, string d, Sources *);
+ virtual void new_input (const string &s, Sources *);
+ virtual void new_input (const string &s, string d, Sources *);
bool top_input () { return include_stack_.size () < 2; }
SCM keyword_list () const;
- SCM lookup_identifier (string s);
+ SCM lookup_identifier (const string &s);
SCM lookup_identifier_symbol (SCM s);
void push_extra_token (int token_type, SCM scm = SCM_UNSPECIFIED);
void push_chord_state (SCM alist);
void clear ();
void do_init_file ();
SCM do_yyparse ();
- void include_string (string ly_code);
- void parse_file (string init, string name, string out_name);
- void parse_string (string ly_code);
- SCM parse_string_expression (string ly_code, string filename, int line);
- void parser_error (string);
- void parser_error (Input const &, string);
+ void include_string (const string &ly_code);
+ void parse_file (const string &init, const string &name, const string &out_name);
+ void parse_string (const string &ly_code);
+ SCM parse_string_expression (const string &ly_code, const string &filename, int line);
+ void parser_error (const string&);
+ void parser_error (Input const &, const string&);
// The following is called as yyerror
- static void parser_error (Input const *i, Lily_parser *parser, SCM *, string s);
+ static void parser_error (Input const *i, Lily_parser *parser, SCM *, const string &s);
void set_yydebug (bool);
SCM make_scope () const;
struct Lilypond_version
{
Lilypond_version (int major, int minor, int patch);
- Lilypond_version (string str);
+ Lilypond_version (const string &str);
string to_string () const;
operator int () const;
class Midi_chunk
{
public:
- void set (string header_string, string data_string, string footer_string);
+ void set (const string &header_string, const string &data_string, const string &footer_string);
virtual string to_string () const;
virtual string data_string () const;
DECLARE_CLASSNAME (Midi_chunk);
struct Midi_stream
{
- Midi_stream (string file_name_string);
+ Midi_stream (const string &file_name_string);
~Midi_stream ();
- void write (string);
+ void write (const string&);
void write (Midi_chunk const &);
void open ();
Offset get_point_in_y_direction (Offset orig, Real slope, Real dist, Direction dir);
Real peak_around (Real epsilon, Real threshold, Real x);
Real convex_amplifier (Real standard_x, Real increase_factor, Real x);
-string camel_case_to_lisp_identifier (string in);
+string camel_case_to_lisp_identifier (const string &in);
#endif
struct Modified_font_metric : public Font_metric
{
public:
- Stencil text_stencil (Output_def *output_state, string, bool) const;
+ Stencil text_stencil (Output_def *output_state, const string&, bool) const;
Real get_magnification () const;
static SCM make_scaled_font_metric (Font_metric *fm, Real magnification);
size_t count () const;
Offset get_indexed_wxwy (size_t) const;
- Offset attachment_point (string) const;
+ Offset attachment_point (const string&) const;
size_t name_to_index (string) const;
size_t index_to_charcode (size_t) const;
Font_metric *original_font () const;
static Real stem_attachment_coordinate (Grob *, Axis a);
static int get_balltype (Grob *);
- static Offset get_stem_attachment (Font_metric *, string);
+ static Offset get_stem_attachment (Font_metric *, const string&);
};
#endif // NOTEHEAD_HH
SCM glyph_list () const;
SCM get_glyph_outline (size_t signed_idx) const;
Box get_glyph_outline_bbox (size_t signed_idx) const;
- string get_otf_table (string tag) const;
- static SCM make_otf (string);
+ string get_otf_table (const string &tag) const;
+ static SCM make_otf (const string&);
string font_name () const;
~Open_type_font ();
- Offset attachment_point (string) const;
+ Offset attachment_point (const string&) const;
size_t count () const;
Box get_indexed_char_dimensions (size_t) const;
Box get_unscaled_indexed_char_dimensions (size_t) const;
Real design_size () const;
};
-string get_otf_table (FT_Face face, string tag);
-FT_Face open_ft_face (string str, FT_Long idx);
+string get_otf_table (FT_Face face, const string &tag);
+FT_Face open_ft_face (const string&, FT_Long idx);
#endif /* OPEN_TYPE_FONT_HH */
/*
variables.
*/
- SCM c_variable (string id) const;
+ SCM c_variable (const string &id) const;
SCM lookup_variable (SCM sym) const;
void set_variable (SCM sym, SCM val);
void normalize ();
string description_string () const;
SCM font_file_name () const;
- void register_font_file (string, string, int);
+ void register_font_file (const string &filename, const string &ps_name, int face_index);
size_t name_to_index (string) const;
SCM get_glyph_outline (size_t signed_idx) const;
Stencil pango_item_string_stencil (PangoGlyphItem const *) const;
virtual Stencil text_stencil (Output_def *output_state,
- string text, bool music) const;
+ const string &text, bool music) const;
virtual void derived_mark () const;
};
DECLARE_SMOBS (Paper_outputter);
public:
- Paper_outputter (SCM port, string format);
+ Paper_outputter (SCM port, const string &format);
void close ();
SCM dump_string (SCM);
#include "std-string.hh"
-void read_relocation_dir (string dirname);
-void read_relocation_file (string filename);
-string expand_environment_variables (string orig);
+void read_relocation_dir (const string &dirname);
+void read_relocation_file (const string &filename);
+string expand_environment_variables (const string &orig);
-int sane_putenv (char const *key, string value, bool overwrite);
+int sane_putenv (char const *key, const string &value, bool overwrite);
void setup_paths (char const *argv0);
extern bool relocate_binary;
DECLARE_SCHEME_CALLBACK (y_offset_callback, (SCM));
DECLARE_SCHEME_CALLBACK (calc_cross_staff, (SCM));
DECLARE_GROB_INTERFACE ();
- static string glyph_name (Grob *, int, string, bool, Real);
+ static string glyph_name (Grob *, int durlog, const string &style, bool, Real);
static Real staff_position_internal (Grob *, int /* duration_log */,
int /* dir */);
static SCM brew_internal_stencil (Grob *, bool);
Real score () const { return score_; }
string card () const { return score_card_; }
- void add_score (Real, string);
+ void add_score (Real, const string&);
void generate_curve (Slur_score_state const &state, Real r0, Real h_inf,
vector<Offset> const &);
void stop_translation_timestep ();
void process_music ();
- bool can_create_slur (string, vsize, vsize *, Stream_event *);
- void create_slur (string spanner_id, Stream_event *ev_cause, Grob *g_cause, Direction dir, bool left_broken);
+ bool can_create_slur (const string&, vsize, vsize *, Stream_event *);
+ void create_slur (const string &spanner_id, Stream_event *ev_cause, Grob *g_cause, Direction dir, bool left_broken);
bool try_to_end (Stream_event *ev);
virtual void set_melisma (bool);
DECLARE_SMOBS (Source_file);
public:
- Source_file (string fn);
- Source_file (string, string);
+ Source_file (const string &fn);
+ Source_file (const string&, const string&);
char const *c_str () const;
virtual string quote_input (char const *pos_str0) const;
int line_offset_;
};
-vector<char> gulp_file (string fn, int desired);
+vector<char> gulp_file (const string &fn, int desired);
#endif /* SOURCE_FILE_HH */
/* computed. */
Interval attachment_x_;
- void add_score (Real, string);
+ void add_score (Real, const string&);
Tie_configuration ();
void center_tie_vertically (Tie_details const &);
Bezier get_transformed_bezier (Tie_details const &) const;
friend class Tie_formatting_problem;
public:
Ties_configuration ();
- void add_score (Real amount, string description);
- void add_tie_score (Real amount, int i, string description);
+ void add_score (Real amount, const string &description);
+ void add_tie_score (Real amount, int i, const string &description);
Real score () const;
void reset_score ();
string card () const;
[file:line:column:][warning:]message
*/
string
-Input::message_string (string msg) const
+Input::message_string (const string &msg) const
{
if (source_file_)
return msg + "\n" + source_file_->quote_input (start_);
return (source_file_) ? location_string () : "";
}
void
-Input::error (string s) const
+Input::error (const string &s) const
{
::non_fatal_error (message_string (s), message_location ());
// UGH, fix naming or usage (use non_fatal_error in most places, instead)
}
void
-Input::programming_error (string s) const
+Input::programming_error (const string &s) const
{
::programming_error (message_string (s), message_location ());
}
void
-Input::non_fatal_error (string s) const
+Input::non_fatal_error (const string &s) const
{
::non_fatal_error (message_string (s), message_location ());
}
void
-Input::warning (string s) const
+Input::warning (const string &s) const
{
::warning (message_string (s), message_location ());
}
void
-Input::message (string s) const
+Input::message (const string &s) const
{
::message (message_string (s), true, message_location ());
}
void
-Input::debug_output (string s) const
+Input::debug_output (const string &s) const
{
::debug_output (message_string (s), true, message_location ());
}
int
-Lily_lexer::scan_escaped_word (string str)
+Lily_lexer::scan_escaped_word (const string &str)
{
// use more SCM for this.
}
int
-Lily_lexer::scan_shorthand (string str)
+Lily_lexer::scan_shorthand (const string &str)
{
SCM sid = lookup_identifier (str);
if (Music *m = unsmob_music (sid))
}
int
-Lily_lexer::scan_bare_word (string str)
+Lily_lexer::scan_bare_word (const string &str)
{
SCM sym = ly_symbol2scm (str.c_str ());
if ((YYSTATE == notes) || (YYSTATE == chords)) {
}
string
-robust_symbol2string (SCM sym, string str)
+robust_symbol2string (SCM sym, const string &str)
{
return scm_is_symbol (sym) ? ly_symbol2string (sym) : str;
}
string
-gulp_file_to_string (string fn, bool must_exist, int size)
+gulp_file_to_string (const string &fn, bool must_exist, int size)
{
string s = global_path.find (fn);
if (s == "")
}
string
-robust_scm2string (SCM k, string s)
+robust_scm2string (SCM k, const string &s)
{
if (scm_is_string (k))
- s = ly_scm2string (k);
+ return ly_scm2string (k);
return s;
}
}
int
-Lily_lexer::lookup_keyword (string s)
+Lily_lexer::lookup_keyword (const string &s)
{
return keytable_->lookup (s.c_str ());
}
}
SCM
-Lily_lexer::lookup_identifier (string name)
+Lily_lexer::lookup_identifier (const string &name)
{
return lookup_identifier_symbol (ly_symbol2scm (name.c_str ()));
}
}
void
-Lily_lexer::new_input (string str, string d, Sources *ss)
+Lily_lexer::new_input (const string &str, string d, Sources *ss)
{
Includable_lexer::new_input (str, d, ss);
}
void
-Lily_lexer::new_input (string str, Sources *ss)
+Lily_lexer::new_input (const string &str, Sources *ss)
{
if (is_main_input_ && be_safe_global)
{
/* Process one .ly file, or book. */
void
-Lily_parser::parse_file (string init, string name, string out_name)
+Lily_parser::parse_file (const string &init, const string &name, const string &out_name)
{
lexer_->set_identifier (ly_symbol2scm ("parser"), self_scm ());
output_basename_ = out_name;
}
void
-Lily_parser::parse_string (string ly_code)
+Lily_parser::parse_string (const string &ly_code)
{
lexer_->main_input_name_ = "<string>";
lexer_->new_input (lexer_->main_input_name_, ly_code, sources_);
}
SCM
-Lily_parser::parse_string_expression (string ly_code, string filename,
+Lily_parser::parse_string_expression (const string &ly_code, const string &filename,
int line)
{
lexer_->main_input_name_ = filename;
}
void
-Lily_parser::include_string (string ly_code)
+Lily_parser::include_string (const string &ly_code)
{
lexer_->new_input ("<included string>", ly_code, sources_);
}
}
void
-Lily_parser::parser_error (string s)
+Lily_parser::parser_error (const string &s)
{
lexer_->here_input ().error (_ (s.c_str ()));
error_level_ = 1;
}
void
-Lily_parser::parser_error (Input const &i, string s)
+Lily_parser::parser_error (Input const &i, const string &s)
{
i.error (s);
error_level_ = 1;
patch_ = patch;
}
-Lilypond_version::Lilypond_version (string str)
+Lilypond_version::Lilypond_version (const string &str)
{
major_ = 0;
minor_ = 0;
}
static void
-prepend_scheme_list (string dir, string scmlist)
+prepend_scheme_list (const string &dir, const string &scmlist)
/*
* Inserts an item at the front of a Scheme list, e.g. %load-path
* Parameters:
}
static void
-add_output_format (string format)
+add_output_format (const string &format)
/*
* Capture information internally from command-line options
* re output format.
}
void
-Midi_chunk::set (string header_string, string data_string, string footer_string)
+Midi_chunk::set (const string &header_string, const string &data_string, const string &footer_string)
{
data_string_ = data_string;
footer_string_ = footer_string;
#include "string-convert.hh"
#include "warn.hh"
-Midi_stream::Midi_stream (string file_name)
+Midi_stream::Midi_stream (const string &file_name)
{
file_name_string_ = file_name;
out_file_ = fopen (file_name.c_str (), "wb");
}
void
-Midi_stream::write (string str)
+Midi_stream::write (const string &str)
{
size_t sz = sizeof (Byte);
size_t n = str.length ();
}
string
-camel_case_to_lisp_identifier (string in)
+camel_case_to_lisp_identifier (const string &in)
{
vector<char> out;
complex<Real> res = orig_c + to_move;
return Offset (real (res), imag (res));
-}
\ No newline at end of file
+}
}
Offset
-Modified_font_metric::attachment_point (string s) const
+Modified_font_metric::attachment_point (const string &s) const
{
Offset o = orig_->attachment_point (s);
return o * magnification_;
return o * magnification_;
}
-vsize
+size_t
Modified_font_metric::name_to_index (string s) const
{
return orig_->name_to_index (s);
Stencil
Modified_font_metric::text_stencil (Output_def *state,
- string text, bool feta) const
+ const string &text, bool feta) const
{
Box b;
if (Pango_font *pf = dynamic_cast<Pango_font *> (orig_))
}
Offset
-Note_head::get_stem_attachment (Font_metric *fm, string key)
+Note_head::get_stem_attachment (Font_metric *fm, const string &key)
{
Offset att;
}
string
-Open_type_font::get_otf_table (string tag) const
+Open_type_font::get_otf_table (const string &tag) const
{
return ::get_otf_table (face_, tag);
}
UGH fix naming
*/
string
-get_otf_table (FT_Face face, string tag)
+get_otf_table (FT_Face face, const string &tag)
{
FT_ULong len;
FT_Byte *tab = load_table (tag.c_str (), face, &len);
}
FT_Face
-open_ft_face (string str, FT_Long idx)
+open_ft_face (const string &str, FT_Long idx)
{
FT_Face face;
FT_Error error_code = FT_New_Face (freetype2_library, str.c_str (), idx, &face);
}
SCM
-Open_type_font::make_otf (string str)
+Open_type_font::make_otf (const string &str)
{
FT_Face face = open_ft_face (str, 0 /* index */);
Open_type_font *otf = new Open_type_font (face);
}
Offset
-Open_type_font::attachment_point (string glyph_name) const
+Open_type_font::attachment_point (const string &glyph_name) const
{
SCM sym = ly_symbol2scm (glyph_name.c_str ());
SCM entry = scm_hashq_ref (lily_character_table_, sym, SCM_BOOL_F);
}
SCM
-Output_def::c_variable (string s) const
+Output_def::c_variable (const string &s) const
{
return lookup_variable (ly_symbol2scm (s.c_str ()));
}
}
void
-Pango_font::register_font_file (string filename,
- string ps_name,
+Pango_font::register_font_file (const string &filename,
+ const string &ps_name,
int face_index)
{
scm_hash_set_x (physical_font_tab_,
Stencil
Pango_font::text_stencil (Output_def * /* state */,
- string str, bool music_string) const
+ const string &str, bool music_string) const
{
/*
The text assigned to a PangoLayout is automatically divided
#include "ly-smobs.icc"
-Paper_outputter::Paper_outputter (SCM port, string format)
+Paper_outputter::Paper_outputter (SCM port, const string &format)
{
file_ = port;
output_module_ = SCM_EOL;
#include "warn.hh"
void
-Lily_parser::parser_error (Input const *i, Lily_parser *parser, SCM *, string s)
+Lily_parser::parser_error (Input const *i, Lily_parser *parser, SCM *, const string &s)
{
parser->parser_error (*i, s);
}
#define FRAMEWORKDIR ".."
int
-sane_putenv (char const *key, string value, bool overwrite)
+sane_putenv (char const *key, const string &value, bool overwrite)
{
if (overwrite || !getenv (key))
{
}
static int
-set_env_file (char const *key, string value, bool overwrite = false)
+set_env_file (char const *key, const string &value, bool overwrite = false)
{
if (is_file (value))
return sane_putenv (key, value, overwrite);
}
static int
-set_env_dir (char const *key, string value)
+set_env_dir (char const *key, const string &value)
{
if (is_dir (value))
return sane_putenv (key, value, false);
#endif
static void
-prefix_relocation (string prefix)
+prefix_relocation (const string &prefix)
{
string bindir = prefix + "/bin";
string datadir = prefix + "/share";
*/
static void
-framework_relocation (string prefix)
+framework_relocation (const string &prefix)
{
debug_output (_f ("Relocation: framework_prefix=%s", prefix));
}
string
-expand_environment_variables (string orig)
+expand_environment_variables (const string &orig)
{
char const *start_ptr = orig.c_str ();
char const *ptr = orig.c_str ();
}
void
-read_relocation_file (string filename)
+read_relocation_file (const string &filename)
{
debug_output (_f ("Relocation file: %s", filename.c_str ()) + "\n");
char const *cname = filename.c_str ();
}
void
-read_relocation_dir (string dirname)
+read_relocation_dir (const string &dirname)
{
if (DIR *dir = opendir (dirname.c_str ()))
while (struct dirent *ent = readdir (dir))
make this function easily usable in C++
*/
string
-Rest::glyph_name (Grob *me, int durlog, string style, bool try_ledgers,
+Rest::glyph_name (Grob *me, int durlog, const string &style, bool try_ledgers,
Real offset)
{
bool is_ledgered = false;
};
void
-Slur_configuration::add_score (Real s, string desc)
+Slur_configuration::add_score (Real s, const string &desc)
{
if (s < 0)
{
}
void
-Slur_proto_engraver::create_slur (string spanner_id, Stream_event *ev_cause, Grob *g_cause, Direction dir, bool left_broken)
+Slur_proto_engraver::create_slur (const string &spanner_id, Stream_event *ev_cause, Grob *g_cause, Direction dir, bool left_broken)
{
Grob *ccc = unsmob_grob (get_property ("currentCommandColumn"));
SCM cause = ev_cause ? ev_cause->self_scm () : g_cause->self_scm ();
}
bool
-Slur_proto_engraver::can_create_slur (string id, vsize old_slurs, vsize *event_idx, Stream_event *ev)
+Slur_proto_engraver::can_create_slur (const string &id, vsize old_slurs, vsize *event_idx, Stream_event *ev)
{
for (vsize j = slurs_.size (); j--;)
{
return contents of FILENAME. *Not 0-terminated!*
*/
vector<char>
-gulp_file (string filename, int desired_size)
+gulp_file (const string &filename, int desired_size)
{
/* "b" must ensure to open literally, avoiding text (CR/LF)
conversions. */
smobify_self ();
}
-Source_file::Source_file (string filename, string data)
+Source_file::Source_file (const string &filename, const string &data)
{
init ();
newline_locations_.push_back (&characters_[0] + i);
}
-Source_file::Source_file (string filename_string)
+Source_file::Source_file (const string &filename_string)
{
init ();
private:
string new_instrument_string ();
- void set_instrument_name (string voice);
- void set_instrument (int channel, string voice);
- int get_channel (string instrument);
- Audio_staff *get_audio_staff (string voice);
- Audio_staff *new_audio_staff (string voice);
- Audio_dynamic *get_dynamic (string voice);
+ void set_instrument_name (const string &voice);
+ void set_instrument (int channel, const string &voice);
+ int get_channel (const string &instrument);
+ Audio_staff *get_audio_staff (const string &voice);
+ Audio_staff *new_audio_staff (const string &voice);
+ Audio_dynamic *get_dynamic (const string &voice);
string instrument_string_;
int channel_;
}
Audio_staff *
-Staff_performer::new_audio_staff (string voice)
+Staff_performer::new_audio_staff (const string &voice)
{
Audio_staff *audio_staff = new Audio_staff;
audio_staff->merge_unisons_
}
Audio_staff *
-Staff_performer::get_audio_staff (string voice)
+Staff_performer::get_audio_staff (const string &voice)
{
SCM channel_mapping = get_property ("midiChannelMapping");
if (channel_mapping != ly_symbol2scm ("instrument")
}
Audio_dynamic *
-Staff_performer::get_dynamic (string voice)
+Staff_performer::get_dynamic (const string &voice)
{
map<string, Audio_dynamic *>::const_iterator i = dynamic_map_.find (voice);
if (i != dynamic_map_.end ())
}
void
-Staff_performer::set_instrument (int channel, string voice)
+Staff_performer::set_instrument (int channel, const string &voice)
{
instrument_ = new Audio_instrument (instrument_string_);
instrument_->channel_ = channel;
}
void
-Staff_performer::set_instrument_name (string voice)
+Staff_performer::set_instrument_name (const string &voice)
{
instrument_name_ = new Audio_text (Audio_text::INSTRUMENT_NAME,
instrument_string_);
}
int
-Staff_performer::get_channel (string instrument)
+Staff_performer::get_channel (const string &instrument)
{
SCM channel_mapping = get_property ("midiChannelMapping");
map<string, int> &channel_map
}
void
-Tie_configuration::add_score (Real s, string desc)
+Tie_configuration::add_score (Real s, const string &desc)
{
assert (!scored_);
score_ += s;
}
void
-Ties_configuration::add_tie_score (Real s, int i, string desc)
+Ties_configuration::add_tie_score (Real s, int i, const string &desc)
{
assert (!scored_);
score_ += s;
}
void
-Ties_configuration::add_score (Real s, string desc)
+Ties_configuration::add_score (Real s, const string &desc)
{
assert (!scored_);
score_ += s;
}
static void
-create_type42_font (void *out, string name, int idx)
+create_type42_font (void *out, const string &name, int idx)
{
FT_Face face;