]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/function-documentation.cc
Issue 4550 (1/2) Avoid "using namespace std;" in included files
[lilypond.git] / lily / function-documentation.cc
index 480ea6b0892bdebbc80526812ce87e41cdc44c63..e04188c7b5ba198e59b7dd23677572bec07fbad4 100644 (file)
@@ -1,7 +1,7 @@
 /*
   This file is part of LilyPond, the GNU music typesetter.
 
-  Copyright (C) 2004--2011 Han-Wen Nienhuys <hanwen@xs4all.nl>
+  Copyright (C) 2004--2015 Han-Wen Nienhuys <hanwen@xs4all.nl>
 
   LilyPond is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
 */
 
 #include <cstring>
+#include <map>
 using namespace std;
 
 #include "std-string.hh"
 #include "lily-guile.hh"
 #include "warn.hh"
 
+/* type predicates. */
+#include "global-context.hh"
+#include "input.hh"
+#include "item.hh"
+#include "music.hh"
+#include "music-function.hh"
+#include "paper-score.hh"
+#include "performance.hh"
+#include "spanner.hh"
+#include "stream-event.hh"
+#include "unpure-pure-container.hh"
+
+using std::map;
+using std::string;
+
 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)
@@ -38,9 +54,9 @@ ly_check_name (string cxx, string 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;
@@ -64,13 +80,11 @@ LY_DEFINE (ly_get_all_function_documentation, "ly:get-all-function-documentation
   return doc_hash_table;
 }
 
-#include <map>
-
 map<void *, string> type_names;
 
 void
 ly_add_type_predicate (void *ptr,
-                       string name)
+                       const string &name)
 {
   type_names[ptr] = name;
 }
@@ -87,30 +101,15 @@ predicate_to_typename (void *ptr)
     return type_names[ptr];
 }
 
-/* type predicates. */
-#include "global-context.hh"
-#include "input.hh"
-#include "item.hh"
-#include "music.hh"
-#include "music-function.hh"
-#include "paper-score.hh"
-#include "performance.hh"
-#include "spanner.hh"
-#include "stream-event.hh"
-
 void
 init_func_doc ()
 {
   ly_add_type_predicate ((void *) &is_direction, "direction");
-  ly_add_type_predicate ((void *) &is_music_function, "Music_function");
   ly_add_type_predicate ((void *) &ly_is_port, "port");
   ly_add_type_predicate ((void *) &ly_cheap_is_list, "list");
-  ly_add_type_predicate ((void *) &unsmob_global_context, "Global_context");
-  ly_add_type_predicate ((void *) &unsmob_input, "Input");
-  ly_add_type_predicate ((void *) &unsmob_moment, "Moment");
-  ly_add_type_predicate ((void *) &unsmob_paper_score, "Paper_score");
-  ly_add_type_predicate ((void *) &unsmob_performance, "Performance");
-
+  ly_add_type_predicate ((void *) &unsmob<Global_context>, "Global_context");
+  ly_add_type_predicate ((void *) &unsmob<Paper_score>, "Paper_score");
+  ly_add_type_predicate ((void *) &unsmob<Performance>, "Performance");
   ly_add_type_predicate ((void *) &is_axis, "axis");
   ly_add_type_predicate ((void *) &is_number_pair, "number pair");
   ly_add_type_predicate ((void *) &ly_is_list, "list");
@@ -123,10 +122,10 @@ init_func_doc ()
   ly_add_type_predicate ((void *) &scm_is_rational, "rational");
   ly_add_type_predicate ((void *) &scm_is_string, "string");
   ly_add_type_predicate ((void *) &scm_is_vector, "vector");
-  ly_add_type_predicate ((void *) &unsmob_item, "Item");
-  ly_add_type_predicate ((void *) &unsmob_music, "Music");
-  ly_add_type_predicate ((void *) &unsmob_spanner, "Spanner");
-  ly_add_type_predicate ((void *) &unsmob_stream_event, "Stream_event");
+  ly_add_type_predicate ((void *) &unsmob<Item>, "Item");
+  ly_add_type_predicate ((void *) &unsmob<Music>, "Music");
+  ly_add_type_predicate ((void *) &unsmob<Spanner>, "Spanner");
+  ly_add_type_predicate ((void *) &unsmob<Stream_event>, "Stream_event");
 }
 
 ADD_SCM_INIT_FUNC (func_doc, init_func_doc);