]> git.lyx.org Git - lyx.git/blobdiff - src/insets/ExternalTemplate.cpp
This should be the last of the commits refactoring the InsetLayout code.
[lyx.git] / src / insets / ExternalTemplate.cpp
index 4c2eaddb22438d3ee9d335a1b6a97ae4c2b95222..f3884f91d6acf8d5237420bd91e4b10ad6074f73 100644 (file)
 
 #include "ExternalTemplate.h"
 
-#include "debug.h"
 #include "Lexer.h"
 
+#include "support/debug.h"
 #include "support/filetools.h"
 #include "support/lstrings.h"
 #include "support/Package.h"
 #include "support/Path.h"
 
-using std::endl;
-using std::for_each;
-using std::string;
-using std::ostream;
-using std::vector;
+#include <ostream>
+
+using namespace std;
+using namespace lyx::support;
 
 namespace lyx {
 namespace external {
@@ -61,7 +60,7 @@ Template::Format::Format()
 
 TemplateManager::TemplateManager()
 {
-       readTemplates(support::package().user_support());
+       readTemplates(package().user_support());
        if (lyxerr.debugging(Debug::EXTERNAL)) {
                dumpPreambleDefs(lyxerr);
                lyxerr << '\n';
@@ -70,11 +69,11 @@ TemplateManager::TemplateManager()
 }
 
 
-class dumpPreambleDef {
+class DumpPreambleDef {
 public:
        typedef TemplateManager::PreambleDefs::value_type value_type;
 
-       dumpPreambleDef(ostream & o) : ost(o) {}
+       DumpPreambleDef(ostream & o) : ost(o) {}
 
        void operator()(value_type const & vt) {
                ost << "PreambleDef " << vt.first << '\n'
@@ -87,11 +86,11 @@ private:
 };
 
 
-class dumpTemplate {
+class DumpTemplate {
 public:
        typedef TemplateManager::Templates::value_type value_type;
 
-       dumpTemplate(ostream & o) : ost(o) {}
+       DumpTemplate(ostream & o) : ost(o) {}
 
        void operator()(value_type const & vt) {
                Template const & et = vt.second;
@@ -122,11 +121,11 @@ private:
        ostream & ost;
 };
 
-class dumpFormat {
+class DumpFormat {
 public:
        typedef Template::Formats::value_type value_type;
 
-       dumpFormat(ostream & o) : ost(o) {}
+       DumpFormat(ostream & o) : ost(o) {}
 
        void operator()(value_type const & vt) const {
                Template::Format const & ft = vt.second;
@@ -138,7 +137,7 @@ public:
                vector<string>::const_iterator qit = ft.requirements.begin();
                vector<string>::const_iterator qend = ft.requirements.end();
                for (; qit != qend; ++qit) {
-                       lyxerr << "req:" << *qit << std::endl;
+                       lyxerr << "req:" << *qit << endl;
                        ost << "\t\tRequirement " << *qit << '\n';
                }
 
@@ -180,19 +179,19 @@ private:
 
 void Template::dumpFormats(ostream & os) const
 {
-       for_each(formats.begin(), formats.end(), dumpFormat(os));
+       for_each(formats.begin(), formats.end(), DumpFormat(os));
 }
 
 
 void TemplateManager::dumpPreambleDefs(ostream & os) const
 {
-       for_each(preambledefs.begin(), preambledefs.end(), dumpPreambleDef(os));
+       for_each(preambledefs.begin(), preambledefs.end(), DumpPreambleDef(os));
 }
 
 
 void TemplateManager::dumpTemplates(ostream & os) const
 {
-       for_each(templates.begin(), templates.end(), dumpTemplate(os));
+       for_each(templates.begin(), templates.end(), DumpTemplate(os));
 }
 
 
@@ -221,7 +220,7 @@ TemplateManager::getTemplateByName(string const & name) const
 string const
 TemplateManager::getPreambleDefByName(string const & name) const
 {
-       string const trimmed_name = support::trim(name);
+       string const trimmed_name = trim(name);
        if (trimmed_name.empty())
                return string();
 
@@ -233,9 +232,9 @@ TemplateManager::getPreambleDefByName(string const & name) const
 }
 
 
-void TemplateManager::readTemplates(support::FileName const & path)
+void TemplateManager::readTemplates(FileName const & path)
 {
-       support::PathChanger p(path);
+       PathChanger p(path);
 
        enum TemplateTags {
                TM_PREAMBLEDEF = 1,
@@ -253,7 +252,7 @@ void TemplateManager::readTemplates(support::FileName const & path)
 
        Lexer lex(templatetags, TM_TEMPLATE_END);
 
-       support::FileName const filename = support::libFileSearch("", "external_templates");
+       FileName const filename = libFileSearch("", "external_templates");
        if (filename.empty() || !lex.setFile(filename)) {
                lex.printError("external::TemplateManager::readTemplates: "
                               "No template file");
@@ -301,7 +300,7 @@ void add(vector<TransformID> & ids, string const & name)
        if (int(id) == -1) {
                lyxerr << "external::Template::readTemplate\n"
                       << "Transform " << name << " is not recognized"
-                      << std::endl;
+                      << endl;
        } else {
                ids.push_back(id);
        }
@@ -387,17 +386,17 @@ void Template::readTemplate(Lexer & lex)
 
 namespace {
 
-void transform_not_found(std::ostream & os, string const & transform)
+void transform_not_found(ostream & os, string const & transform)
 {
        os << "external::Format::readFormat. Transformation \""
-          << transform << "\" is unrecognized." << std::endl;
+          << transform << "\" is unrecognized." << endl;
 }
 
 
-void transform_class_not_found(std::ostream & os, string const & tclass)
+void transform_class_not_found(ostream & os, string const & tclass)
 {
        os << "external::Format::readFormat. Transformation class \""
-          << tclass << "\" is unrecognized." << std::endl;
+          << tclass << "\" is unrecognized." << endl;
 }