From 7c392af6eab5e06a4836146859cbd9f2c3764420 Mon Sep 17 00:00:00 2001 From: Abdelrazak Younes Date: Wed, 12 Dec 2007 19:57:42 +0000 Subject: [PATCH] getting rid of superfluous lyx::support:: statements. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22106 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/Buffer.cpp | 6 +- src/Converter.cpp | 4 +- src/ConverterCache.cpp | 18 +++--- src/Encoding.cpp | 2 +- src/Format.cpp | 2 +- src/Lexer.cpp | 4 +- src/LyX.cpp | 14 ++--- src/LyXFunc.cpp | 12 ++-- src/LyXRC.cpp | 4 +- src/ModuleList.cpp | 4 +- src/Mover.cpp | 32 +++++----- src/Paragraph.cpp | 2 +- src/ParagraphParameters.cpp | 2 +- src/ServerSocket.cpp | 15 ++--- src/Session.cpp | 5 +- src/Text3.cpp | 6 +- src/TextClass.cpp | 8 +-- src/TextClassList.cpp | 2 +- src/Trans.cpp | 2 +- src/client/client.cpp | 6 +- src/client/debug.cpp | 2 +- src/factory.cpp | 7 ++- src/frontends/qt4/GuiApplication.cpp | 11 ++-- src/frontends/qt4/GuiCitation.cpp | 3 +- src/frontends/qt4/GuiDocument.cpp | 6 +- src/frontends/qt4/GuiFontLoader.cpp | 6 +- src/frontends/qt4/GuiImage.cpp | 2 +- src/frontends/qt4/GuiPrint.cpp | 4 +- src/frontends/qt4/GuiShowFile.cpp | 3 +- src/frontends/qt4/GuiTexinfo.cpp | 2 +- src/frontends/qt4/GuiToolbar.cpp | 6 +- src/frontends/qt4/GuiView.cpp | 8 +-- src/frontends/qt4/GuiWorkArea.cpp | 2 +- src/frontends/qt4/qt_helpers.cpp | 4 +- src/graphics/GraphicsConverter.cpp | 6 +- src/graphics/PreviewLoader.cpp | 16 ++--- src/insets/ExternalSupport.cpp | 94 ++++++++++++++-------------- src/insets/ExternalTemplate.cpp | 11 ++-- src/insets/ExternalTransforms.cpp | 2 +- src/insets/InsetBibitem.cpp | 3 +- src/insets/InsetBibtex.cpp | 6 +- src/insets/InsetCaption.cpp | 4 +- src/insets/InsetCitation.cpp | 2 - src/insets/InsetExternal.cpp | 7 +-- src/insets/InsetGraphics.cpp | 24 +++---- src/insets/InsetLabel.cpp | 3 +- src/mathed/InsetMathGrid.cpp | 5 +- src/mathed/InsetMathHull.cpp | 2 +- src/mathed/InsetMathNest.cpp | 3 +- src/mathed/MathExtern.cpp | 2 +- src/mathed/MathFactory.cpp | 2 +- src/support/debug.cpp | 2 +- src/support/docstring.cpp | 4 +- src/tex2lyx/Context.cpp | 3 +- src/tex2lyx/preamble.cpp | 2 +- src/tex2lyx/tex2lyx.cpp | 12 ++-- src/tex2lyx/text.cpp | 4 +- 57 files changed, 208 insertions(+), 227 deletions(-) diff --git a/src/Buffer.cpp b/src/Buffer.cpp index 1918850afb..53fc334544 100644 --- a/src/Buffer.cpp +++ b/src/Buffer.cpp @@ -1253,7 +1253,7 @@ int Buffer::runChktex() string const name = addName(path.absFilename(), latexName()); string const org_path = filePath(); - support::PathChanger p(path); // path to LaTeX file + PathChanger p(path); // path to LaTeX file message(_("Running chktex...")); // Generate the LaTeX file if neccessary @@ -1942,7 +1942,7 @@ void Buffer::setGuiDelegate(frontend::GuiBufferDelegate * gui) namespace { -class AutoSaveBuffer : public support::ForkedProcess { +class AutoSaveBuffer : public ForkedProcess { public: /// AutoSaveBuffer(Buffer const & buffer, FileName const & fname) @@ -2149,7 +2149,7 @@ bool Buffer::doExport(string const & format, bool put_in_tempdir, if (!makeLaTeXFile(FileName(filename), string(), runparams)) return false; } else if (!lyxrc.tex_allows_spaces - && support::contains(filePath(), ' ')) { + && contains(filePath(), ' ')) { Alert::error(_("File name error"), _("The directory path to the document cannot contain spaces.")); return false; diff --git a/src/Converter.cpp b/src/Converter.cpp index 085ed5fb2f..03814f10b5 100644 --- a/src/Converter.cpp +++ b/src/Converter.cpp @@ -287,7 +287,7 @@ bool Converters::convert(Buffer const * buffer, formats.extension(from_format); string const to_ext = formats.extension(to_format); string const command = - support::os::python() + ' ' + + os::python() + ' ' + quoteName(libFileSearch("scripts", "convertDefault.py").toFilesystemEncoding()) + ' ' + quoteName(from_ext + ':' + from_file.toFilesystemEncoding()) + @@ -325,7 +325,7 @@ bool Converters::convert(Buffer const * buffer, string const path(onlyPath(from_file.absFilename())); // Prevent the compiler from optimizing away p FileName pp(path); - support::PathChanger p(pp); + PathChanger p(pp); // empty the error list before any new conversion takes place. errorList.clear(); diff --git a/src/ConverterCache.cpp b/src/ConverterCache.cpp index ea3bfc70f3..cdb8ae20bc 100644 --- a/src/ConverterCache.cpp +++ b/src/ConverterCache.cpp @@ -169,7 +169,7 @@ void ConverterCache::Impl::writeIndex() FileName const index(addName(cache_dir.absFilename(), "index")); ofstream os(index.toFilesystemEncoding().c_str()); os.close(); - if (!lyx::support::chmod(index, 0600)) + if (!chmod(index, 0600)) return; os.open(index.toFilesystemEncoding().c_str()); CacheType::iterator it1 = cache.begin(); @@ -238,7 +238,7 @@ void ConverterCache::init() return; // We do this here and not in the constructor because package() gets // initialized after all static variables. - cache_dir = FileName(addName(support::package().user_support().absFilename(), "cache")); + cache_dir = FileName(addName(package().user_support().absFilename(), "cache")); if (!cache_dir.exists()) if (support::mkdir(cache_dir, 0700) != 0) { lyxerr << "Could not create cache directory `" @@ -260,10 +260,10 @@ void ConverterCache::add(FileName const & orig_from, string const & to_format, // FIXME: Should not hardcode this (see bug 3819 for details) if (to_format == "pstex") { - FileName const converted_eps(support::changeExtension(converted_file.absFilename(), "eps")); + FileName const converted_eps(changeExtension(converted_file.absFilename(), "eps")); add(orig_from, "eps", converted_eps); } else if (to_format == "pdftex") { - FileName const converted_pdf(support::changeExtension(converted_file.absFilename(), "pdf")); + FileName const converted_pdf(changeExtension(converted_file.absFilename(), "pdf")); add(orig_from, "pdf", converted_pdf); } @@ -289,7 +289,7 @@ void ConverterCache::add(FileName const & orig_from, string const & to_format, } item->checksum = checksum; if (!mover.copy(converted_file, item->cache_name, - support::onlyFilename(item->cache_name.absFilename()), 0600)) { + onlyFilename(item->cache_name.absFilename()), 0600)) { LYXERR(Debug::FILES, "ConverterCache::add(" << orig_from << "):\n" "Could not copy file."); } @@ -297,7 +297,7 @@ void ConverterCache::add(FileName const & orig_from, string const & to_format, CacheItem new_item(orig_from, to_format, timestamp, orig_from.checksum()); if (mover.copy(converted_file, new_item.cache_name, - support::onlyFilename(new_item.cache_name.absFilename()), 0600)) { + onlyFilename(new_item.cache_name.absFilename()), 0600)) { FormatCache & format_cache = pimpl_->cache[orig_from]; if (format_cache.from_format.empty()) format_cache.from_format = @@ -417,11 +417,11 @@ bool ConverterCache::copy(FileName const & orig_from, string const & to_format, // FIXME: Should not hardcode this (see bug 3819 for details) if (to_format == "pstex") { - FileName const dest_eps(support::changeExtension(dest.absFilename(), "eps")); + FileName const dest_eps(changeExtension(dest.absFilename(), "eps")); if (!copy(orig_from, "eps", dest_eps)) return false; } else if (to_format == "pdftex") { - FileName const dest_pdf(support::changeExtension(dest.absFilename(), "pdf")); + FileName const dest_pdf(changeExtension(dest.absFilename(), "pdf")); if (!copy(orig_from, "pdf", dest_pdf)) return false; } @@ -430,7 +430,7 @@ bool ConverterCache::copy(FileName const & orig_from, string const & to_format, BOOST_ASSERT(item); Mover const & mover = getMover(to_format); return mover.copy(item->cache_name, dest, - support::onlyFilename(dest.absFilename())); + onlyFilename(dest.absFilename())); } } // namespace lyx diff --git a/src/Encoding.cpp b/src/Encoding.cpp index 37e85ccf76..248bdae6bc 100644 --- a/src/Encoding.cpp +++ b/src/Encoding.cpp @@ -485,7 +485,7 @@ void Encodings::read(FileName const & encfile, FileName const & symbolsfile) info.force = false; while (!flags.empty()) { string flag; - flags = support::split(flags, flag, ','); + flags = split(flags, flag, ','); if (flag == "combining") info.combining = true; else if (flag == "force") diff --git a/src/Format.cpp b/src/Format.cpp index 2ece9f8742..edfdf4135b 100644 --- a/src/Format.cpp +++ b/src/Format.cpp @@ -129,7 +129,7 @@ string Formats::getFormatFromFile(FileName const & filename) const return format; // try to find a format from the file extension. - string const ext = support::getExtension(filename.absFilename()); + string const ext = getExtension(filename.absFilename()); if (!ext.empty()) { // this is ambigous if two formats have the same extension, // but better than nothing diff --git a/src/Lexer.cpp b/src/Lexer.cpp index 8a80758874..ad6f860c6f 100644 --- a/src/Lexer.cpp +++ b/src/Lexer.cpp @@ -63,7 +63,7 @@ public: /// void popTable(); /// - bool setFile(support::FileName const & filename); + bool setFile(FileName const & filename); /// void setStream(istream & i); /// @@ -669,7 +669,7 @@ void Lexer::printError(string const & message) const } -bool Lexer::setFile(support::FileName const & filename) +bool Lexer::setFile(FileName const & filename) { return pimpl_->setFile(filename); } diff --git a/src/LyX.cpp b/src/LyX.cpp index 1d13df399b..a5c5093cde 100644 --- a/src/LyX.cpp +++ b/src/LyX.cpp @@ -110,7 +110,7 @@ void reconfigureUserLyXDir() string const configure_command = package().configure_command(); lyxerr << to_utf8(_("LyX: reconfiguring user directory")) << endl; - support::PathChanger p(package().user_support()); + PathChanger p(package().user_support()); Systemcall one; one.startscript(Systemcall::Wait, configure_command); lyxerr << "LyX: " << to_utf8(_("Done!")) << endl; @@ -351,14 +351,14 @@ int LyX::exec(int & argc, char * argv[]) easyParse(argc, argv); try { - support::init_package(to_utf8(from_local8bit(argv[0])), + init_package(to_utf8(from_local8bit(argv[0])), cl_system_support, cl_user_support, - support::top_build_dir_is_one_level_up); - } catch (support::ExceptionMessage const & message) { - if (message.type_ == support::ErrorException) { + top_build_dir_is_one_level_up); + } catch (ExceptionMessage const & message) { + if (message.type_ == ErrorException) { Alert::error(message.title_, message.details_); exit(1); - } else if (message.type_ == support::WarningException) { + } else if (message.type_ == WarningException) { Alert::warning(message.title_, message.details_); } } @@ -510,7 +510,7 @@ int LyX::init(int & argc, char * argv[]) // the filename if necessary pimpl_->files_to_load_.push_back(fileSearch(string(), os::internal_path(to_utf8(from_local8bit(argv[argi]))), - "lyx", support::allow_unreadable)); + "lyx", allow_unreadable)); } if (first_start) diff --git a/src/LyXFunc.cpp b/src/LyXFunc.cpp index 66d295e970..4e1f808c74 100644 --- a/src/LyXFunc.cpp +++ b/src/LyXFunc.cpp @@ -185,7 +185,7 @@ void reconfigure(LyXView & lv, string const & option) lv.message(_("Running configure...")); // Run configure in user lyx directory - support::PathChanger p(package().user_support()); + PathChanger p(package().user_support()); string configure_command = package().configure_command(); configure_command += option; Systemcall one; @@ -193,7 +193,7 @@ void reconfigure(LyXView & lv, string const & option) p.pop(); // emit message signal. lv.message(_("Reloading configuration...")); - lyxrc.read(support::libFileSearch(string(), "lyxrc.defaults")); + lyxrc.read(libFileSearch(string(), "lyxrc.defaults")); // Re-read packages.lst LaTeXFeatures::getAvailable(); @@ -1011,7 +1011,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd) string const path = buffer->temppath(); // Prevent the compiler from optimizing away p FileName pp(path); - support::PathChanger p(pp); + PathChanger p(pp); // there are three cases here: // 1. we print to a file @@ -2170,7 +2170,7 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new) if (lyxrc_orig.document_path != lyxrc_new.document_path) { FileName path(lyxrc_new.document_path); if (path.exists() && path.isDirectory()) - support::package().document_dir() = FileName(lyxrc.document_path); + package().document_dir() = FileName(lyxrc.document_path); } case LyXRC::RC_ESC_CHARS: case LyXRC::RC_EXAMPLEPATH: @@ -2195,7 +2195,7 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new) case LyXRC::RC_NUMLASTFILES: case LyXRC::RC_PATH_PREFIX: if (lyxrc_orig.path_prefix != lyxrc_new.path_prefix) { - support::prependEnvPath("PATH", lyxrc.path_prefix); + prependEnvPath("PATH", lyxrc.path_prefix); } case LyXRC::RC_PERS_DICT: case LyXRC::RC_PREVIEW: @@ -2240,7 +2240,7 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new) case LyXRC::RC_TEX_ALLOWS_SPACES: case LyXRC::RC_TEX_EXPECTS_WINDOWS_PATHS: if (lyxrc_orig.windows_style_tex_paths != lyxrc_new.windows_style_tex_paths) { - support::os::windows_style_tex_paths(lyxrc_new.windows_style_tex_paths); + os::windows_style_tex_paths(lyxrc_new.windows_style_tex_paths); } case LyXRC::RC_UIFILE: case LyXRC::RC_USER_EMAIL: diff --git a/src/LyXRC.cpp b/src/LyXRC.cpp index db89b3b216..0cf9f6dd18 100644 --- a/src/LyXRC.cpp +++ b/src/LyXRC.cpp @@ -1061,7 +1061,7 @@ int LyXRC::read(Lexer & lexrc) int flgs = Format::none; while (!flags.empty()) { string flag; - flags = support::split(flags, flag, ','); + flags = split(flags, flag, ','); if (flag == "document") flgs |= Format::document; else if (flag == "vector") @@ -2220,7 +2220,7 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c flags.push_back("document"); if (cit->vectorFormat()) flags.push_back("vector"); - os << support::getStringFromVector(flags); + os << getStringFromVector(flags); os << "\"\n"; } } diff --git a/src/ModuleList.cpp b/src/ModuleList.cpp index b1100929d0..99d8b7e394 100644 --- a/src/ModuleList.cpp +++ b/src/ModuleList.cpp @@ -46,7 +46,7 @@ public: //Much of this is borrowed from TextClassList::read() bool ModuleList::load() { - support::FileName const real_file = libFileSearch("", "lyxmodules.lst"); + FileName const real_file = libFileSearch("", "lyxmodules.lst"); LYXERR(Debug::TCLASS, "Reading modules from `" << real_file << '\''); if (real_file.empty()) { @@ -102,7 +102,7 @@ bool ModuleList::load() vector pkgs; while (!packages.empty()) { string p; - packages = support::split(packages, p, ','); + packages = split(packages, p, ','); pkgs.push_back(p); } // This code is run when we have diff --git a/src/Mover.cpp b/src/Mover.cpp index 8a54b7a8c8..17cb7ba57a 100644 --- a/src/Mover.cpp +++ b/src/Mover.cpp @@ -26,35 +26,35 @@ using namespace lyx::support; namespace lyx { -bool Mover::copy(support::FileName const & from, support::FileName const & to, +bool Mover::copy(FileName const & from, FileName const & to, unsigned long int mode) const { return do_copy(from, to, to.absFilename(), mode); } -bool Mover::do_copy(support::FileName const & from, support::FileName const & to, +bool Mover::do_copy(FileName const & from, FileName const & to, string const &, unsigned long int mode) const { - return support::copy(from, to, mode); + return copy(from, to, mode); } -bool Mover::rename(support::FileName const & from, - support::FileName const & to) const +bool Mover::rename(FileName const & from, + FileName const & to) const { return do_rename(from, to, to.absFilename()); } -bool Mover::do_rename(support::FileName const & from, support::FileName const & to, +bool Mover::do_rename(FileName const & from, FileName const & to, string const &) const { - return support::rename(from, to); + return rename(from, to); } -bool SpecialisedMover::do_copy(support::FileName const & from, support::FileName const & to, +bool SpecialisedMover::do_copy(FileName const & from, FileName const & to, string const & latex, unsigned long int mode) const { if (command_.empty()) @@ -65,21 +65,21 @@ bool SpecialisedMover::do_copy(support::FileName const & from, support::FileName if (!ofs) return false; ofs.close(); - if (!support::chmod(to, mode)) + if (!chmod(to, mode)) return false; } - string command = support::libScriptSearch(command_); - command = support::subst(command, "$$i", quoteName(from.toFilesystemEncoding())); - command = support::subst(command, "$$o", quoteName(to.toFilesystemEncoding())); - command = support::subst(command, "$$l", quoteName(latex)); + string command = libScriptSearch(command_); + command = subst(command, "$$i", quoteName(from.toFilesystemEncoding())); + command = subst(command, "$$o", quoteName(to.toFilesystemEncoding())); + command = subst(command, "$$l", quoteName(latex)); - support::Systemcall one; - return one.startscript(support::Systemcall::Wait, command) == 0; + Systemcall one; + return one.startscript(Systemcall::Wait, command) == 0; } -bool SpecialisedMover::do_rename(support::FileName const & from, support::FileName const & to, +bool SpecialisedMover::do_rename(FileName const & from, FileName const & to, string const & latex) const { if (command_.empty()) diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp index 78b58c51a7..6b6287d9f8 100644 --- a/src/Paragraph.cpp +++ b/src/Paragraph.cpp @@ -1519,7 +1519,7 @@ void Paragraph::setLabelWidthString(docstring const & s) docstring const Paragraph::translateIfPossible(docstring const & s, BufferParams const & bparams) const { - if (!support::isAscii(s) || s.empty()) { + if (!isAscii(s) || s.empty()) { // This must be a user defined layout. We cannot translate // this, since gettext accepts only ascii keys. return s; diff --git a/src/ParagraphParameters.cpp b/src/ParagraphParameters.cpp index 4534ba4c5e..d0d4b26127 100644 --- a/src/ParagraphParameters.cpp +++ b/src/ParagraphParameters.cpp @@ -229,7 +229,7 @@ void ParagraphParameters::read(Lexer & lex, bool merge) } } else if (token == "\\align") { lex.next(); - int tmpret = support::findToken(string_align, lex.getString()); + int tmpret = findToken(string_align, lex.getString()); if (tmpret == -1) ++tmpret; align(LyXAlignment(1 << tmpret)); diff --git a/src/ServerSocket.cpp b/src/ServerSocket.cpp index 063f3471c1..3b9061fd16 100644 --- a/src/ServerSocket.cpp +++ b/src/ServerSocket.cpp @@ -37,18 +37,19 @@ # include #endif -using boost::shared_ptr; - using namespace std; +using namespace lyx::support; + +using boost::shared_ptr; namespace lyx { // Address is the unix address for the socket. // MAX_CLIENTS is the maximum number of clients // that can connect at the same time. -ServerSocket::ServerSocket(LyXFunc * f, support::FileName const & addr) +ServerSocket::ServerSocket(LyXFunc * f, FileName const & addr) : func(f), - fd_(support::socktools::listen(addr, 3)), + fd_(socktools::listen(addr, 3)), address_(addr) { if (fd_ == -1) { @@ -58,9 +59,9 @@ ServerSocket::ServerSocket(LyXFunc * f, support::FileName const & addr) // These env vars are used by DVI inverse search // Needed by xdvi - support::setEnv("XEDITOR", "lyxclient -g %f %l"); + setEnv("XEDITOR", "lyxclient -g %f %l"); // Needed by lyxclient - support::setEnv("LYXSOCKET", address_.absFilename()); + setEnv("LYXSOCKET", address_.absFilename()); theApp()->registerSocketCallback( fd_, @@ -97,7 +98,7 @@ string const ServerSocket::address() const // is OK and if the number of clients does not exceed MAX_CLIENTS void ServerSocket::serverCallback() { - int const client_fd = support::socktools::accept(fd_); + int const client_fd = socktools::accept(fd_); if (fd_ == -1) { LYXERR(Debug::LYXSERVER, "lyx: Failed to accept new client"); diff --git a/src/Session.cpp b/src/Session.cpp index 7fec7336d8..05f02230eb 100644 --- a/src/Session.cpp +++ b/src/Session.cpp @@ -22,6 +22,7 @@ #include using namespace std; +using namespace lyx::support; namespace { @@ -37,10 +38,6 @@ string const sec_toolbars = "[toolbars]"; namespace lyx { -using support::absolutePath; -using support::addName; -using support::FileName; -using support::package; LastFilesSection::LastFilesSection(unsigned int num) : default_num_last_files(4), diff --git a/src/Text3.cpp b/src/Text3.cpp index c80886e9b7..1a09aba007 100644 --- a/src/Text3.cpp +++ b/src/Text3.cpp @@ -191,7 +191,7 @@ static bool doInsertInset(Cursor & cur, Text * text, cur.recordUndo(); if (cmd.action == LFUN_INDEX_INSERT) { - docstring ds = support::subst(text->getStringToIndex(cur), '\n', ' '); + docstring ds = subst(text->getStringToIndex(cur), '\n', ' '); text->insertInset(cur, inset); if (edit) inset->edit(cur, true); @@ -1028,8 +1028,8 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd) if (cmd.argument().empty()) break; docstring hexstring = cmd.argument(); - if (lyx::support::isHex(hexstring)) { - char_type c = lyx::support::hexToInt(hexstring); + if (isHex(hexstring)) { + char_type c = hexToInt(hexstring); if (c >= 32 && c < 0x10ffff) { lyxerr << "Inserting c: " << c << endl; docstring s = docstring(1, c); diff --git a/src/TextClass.cpp b/src/TextClass.cpp index 4f97b89a11..a61c52f05a 100644 --- a/src/TextClass.cpp +++ b/src/TextClass.cpp @@ -69,15 +69,15 @@ bool layout2layout(FileName const & filename, FileName const & tempfile) } ostringstream command; - command << support::os::python() << ' ' << quoteName(script.toFilesystemEncoding()) + command << os::python() << ' ' << quoteName(script.toFilesystemEncoding()) << ' ' << quoteName(filename.toFilesystemEncoding()) << ' ' << quoteName(tempfile.toFilesystemEncoding()); string const command_str = command.str(); LYXERR(Debug::TCLASS, "Running `" << command_str << '\''); - support::cmd_ret const ret = - support::runCommand(command_str); + cmd_ret const ret = + runCommand(command_str); if (ret.first != 0) { lyxerr << "Could not run layout conversion " "script layout2layout.py." << endl; @@ -433,7 +433,7 @@ bool TextClass::read(FileName const & filename, ReadType rt) if (format != FORMAT) { LYXERR(Debug::TCLASS, "Converting layout file from format " << format << " to " << FORMAT); - FileName const tempfile(support::tempName()); + FileName const tempfile(tempName()); error = !layout2layout(filename, tempfile); if (!error) error = read(tempfile, rt); diff --git a/src/TextClassList.cpp b/src/TextClassList.cpp index ea0bfbc447..42d294ff58 100644 --- a/src/TextClassList.cpp +++ b/src/TextClassList.cpp @@ -84,7 +84,7 @@ public: bool TextClassList::read() { Lexer lex(0, 0); - support::FileName const real_file = libFileSearch("", "textclass.lst"); + FileName const real_file = libFileSearch("", "textclass.lst"); LYXERR(Debug::TCLASS, "Reading textclasses from `" << real_file << '\''); if (real_file.empty()) { diff --git a/src/Trans.cpp b/src/Trans.cpp index 4ba78080e7..d6f7ca1d67 100644 --- a/src/Trans.cpp +++ b/src/Trans.cpp @@ -386,7 +386,7 @@ docstring const Trans::process(char_type c, TransManager & k) int Trans::load(string const & language) { - support::FileName const filename = libFileSearch("kbd", language, "kmap"); + FileName const filename = libFileSearch("kbd", language, "kmap"); if (filename.empty()) return -1; diff --git a/src/client/client.cpp b/src/client/client.cpp index 441e48c4fe..e65e7ae731 100644 --- a/src/client/client.cpp +++ b/src/client/client.cpp @@ -248,7 +248,7 @@ private: LyXDataSocket::LyXDataSocket(FileName const & address) { - if ((fd_ = support::socktools::connect(address)) == -1) { + if ((fd_ = socktools::connect(address)) == -1) { connected_ = false; } else { connected_ = true; @@ -421,7 +421,7 @@ int h(vector const &) docstring clientName = - from_ascii(support::itoa(::getppid()) + ">" + support::itoa(::getpid())); + from_ascii(itoa(::getppid()) + ">" + itoa(::getpid())); int n(vector const & arg) { @@ -553,7 +553,7 @@ int main(int argc, char * argv[]) } else { // We have to look for an address. // serverPid can be empty. - vector addrs = support::lyxSockets(to_filesystem8bit(cmdline::mainTmp), cmdline::serverPid); + vector addrs = lyxSockets(to_filesystem8bit(cmdline::mainTmp), cmdline::serverPid); vector::const_iterator addr = addrs.begin(); vector::const_iterator end = addrs.end(); for (; addr != end; ++addr) { diff --git a/src/client/debug.cpp b/src/client/debug.cpp index cf6f5f3ad9..a024a206ee 100644 --- a/src/client/debug.cpp +++ b/src/client/debug.cpp @@ -146,7 +146,7 @@ LyXErr & operator<<(LyXErr & l, string const & t) { l.stream() << t; return l; } LyXErr & operator<<(LyXErr & l, docstring const & t) { l.stream() << to_utf8(t); return l; } -LyXErr & operator<<(LyXErr & l, support::FileName const & t) +LyXErr & operator<<(LyXErr & l, FileName const & t) { l.stream() << t; return l; } LyXErr & operator<<(LyXErr & l, ostream &(*t)(ostream &)) { l.stream() << t; return l; } diff --git a/src/factory.cpp b/src/factory.cpp index 7eeaa23804..d5c1ddd1f6 100644 --- a/src/factory.cpp +++ b/src/factory.cpp @@ -68,6 +68,7 @@ #include using namespace std; +using namespace lyx::support; namespace lyx { @@ -358,12 +359,12 @@ Inset * createInset(Buffer & buf, FuncRequest const & cmd) break; } - } catch (support::ExceptionMessage const & message) { - if (message.type_ == support::ErrorException) { + } catch (ExceptionMessage const & message) { + if (message.type_ == ErrorException) { Alert::error(message.title_, message.details_); LyX::cref().emergencyCleanup(); abort(); - } else if (message.type_ == support::WarningException) { + } else if (message.type_ == WarningException) { Alert::warning(message.title_, message.details_); return 0; } diff --git a/src/frontends/qt4/GuiApplication.cpp b/src/frontends/qt4/GuiApplication.cpp index 10aeaa62a1..0a9d9e2e86 100644 --- a/src/frontends/qt4/GuiApplication.cpp +++ b/src/frontends/qt4/GuiApplication.cpp @@ -72,6 +72,7 @@ #include using namespace std; +using namespace lyx::support; namespace lyx { @@ -127,8 +128,6 @@ public: /////////////////////////////////////////////////////////////// -using support::FileName; - GuiApplication * guiApp; @@ -434,12 +433,12 @@ bool GuiApplication::notify(QObject * receiver, QEvent * event) try { return QApplication::notify(receiver, event); } - catch (support::ExceptionMessage const & e) { - if (e.type_ == support::ErrorException) { + catch (ExceptionMessage const & e) { + if (e.type_ == ErrorException) { Alert::error(e.title_, e.details_); LyX::cref().emergencyCleanup(); QApplication::exit(1); - } else if (e.type_ == support::WarningException) { + } else if (e.type_ == WarningException) { Alert::warning(e.title_, e.details_); return false; } @@ -483,7 +482,7 @@ bool GuiApplication::getRgbColor(ColorCode col, RGBColor & rgbcol) string const GuiApplication::hexName(ColorCode col) { - return support::ltrim(fromqstr(color_cache_.get(col).name()), "#"); + return ltrim(fromqstr(color_cache_.get(col).name()), "#"); } diff --git a/src/frontends/qt4/GuiCitation.cpp b/src/frontends/qt4/GuiCitation.cpp index f0fbc7ccf4..fa5099d33f 100644 --- a/src/frontends/qt4/GuiCitation.cpp +++ b/src/frontends/qt4/GuiCitation.cpp @@ -41,6 +41,7 @@ #include using namespace std; +using namespace lyx::support; namespace lyx { namespace frontend { @@ -682,7 +683,7 @@ vector GuiCitation::searchKeys( { vector foundKeys; - docstring expr = support::trim(search_expression); + docstring expr = trim(search_expression); if (expr.empty()) return foundKeys; diff --git a/src/frontends/qt4/GuiDocument.cpp b/src/frontends/qt4/GuiDocument.cpp index 8a36a89ed9..d884e9b9f6 100644 --- a/src/frontends/qt4/GuiDocument.cpp +++ b/src/frontends/qt4/GuiDocument.cpp @@ -56,6 +56,7 @@ #include using namespace std; +using namespace lyx::support; /// template @@ -133,11 +134,6 @@ vector > pagestyles; namespace lyx { namespace frontend { -using support::token; -using support::bformat; -using support::findToken; -using support::getVectorFromString; - ///////////////////////////////////////////////////////////////////// // // PreambleModule diff --git a/src/frontends/qt4/GuiFontLoader.cpp b/src/frontends/qt4/GuiFontLoader.cpp index 5c8f162066..3d53007248 100644 --- a/src/frontends/qt4/GuiFontLoader.cpp +++ b/src/frontends/qt4/GuiFontLoader.cpp @@ -28,6 +28,7 @@ #include using namespace std; +using namespace lyx::support; QString const math_fonts[] = {"cmex10", "cmmi10", "cmr10", "cmsy10", "eufm10", "msam10", "msbm10", "wasy10", "esint10"}; @@ -36,11 +37,6 @@ int const num_math_fonts = sizeof(math_fonts) / sizeof(*math_fonts); namespace lyx { -using support::contains; -using support::package; -using support::addPath; -using support::addName; - extern docstring const stateText(FontInfo const & f); namespace frontend { diff --git a/src/frontends/qt4/GuiImage.cpp b/src/frontends/qt4/GuiImage.cpp index 2c22d65107..75c78a6ee8 100644 --- a/src/frontends/qt4/GuiImage.cpp +++ b/src/frontends/qt4/GuiImage.cpp @@ -125,7 +125,7 @@ unsigned int GuiImage::height() const } -void GuiImage::load(support::FileName const & filename) +void GuiImage::load(FileName const & filename) { if (!original_.isNull()) { LYXERR(Debug::GRAPHICS, "Image is loaded already!"); diff --git a/src/frontends/qt4/GuiPrint.cpp b/src/frontends/qt4/GuiPrint.cpp index 7227064ab3..56b22d3a72 100644 --- a/src/frontends/qt4/GuiPrint.cpp +++ b/src/frontends/qt4/GuiPrint.cpp @@ -167,7 +167,7 @@ void GuiPrint::applyView() params_ = PrinterParams(t, fromqstr(printerED->text()), - support::os::internal_path(fromqstr(fileED->text())), + os::internal_path(fromqstr(fileED->text())), allRB->isChecked(), fromED->text().toUInt(), toED->text().toUInt(), @@ -183,7 +183,7 @@ void GuiPrint::applyView() bool GuiPrint::initialiseParams(string const &) { /// get global printer parameters - string const name = support::changeExtension(buffer().absFileName(), + string const name = changeExtension(buffer().absFileName(), lyxrc.print_file_extension); params_ = PrinterParams(PrinterParams::PRINTER, lyxrc.printer, name); diff --git a/src/frontends/qt4/GuiShowFile.cpp b/src/frontends/qt4/GuiShowFile.cpp index c7c4c37319..ac4e514fd7 100644 --- a/src/frontends/qt4/GuiShowFile.cpp +++ b/src/frontends/qt4/GuiShowFile.cpp @@ -21,12 +21,11 @@ #include using namespace std; +using namespace lyx::support; namespace lyx { namespace frontend { -using support::FileName; -using support::onlyFilename; GuiShowFile::GuiShowFile(GuiView & lv) : GuiDialog(lv, "file") diff --git a/src/frontends/qt4/GuiTexinfo.cpp b/src/frontends/qt4/GuiTexinfo.cpp index b9e37777ef..dfa5b8356b 100644 --- a/src/frontends/qt4/GuiTexinfo.cpp +++ b/src/frontends/qt4/GuiTexinfo.cpp @@ -176,7 +176,7 @@ void GuiTexInfo::updateStyles(TexFileType type) vector::iterator it1 = data.begin(); vector::iterator end1 = data.end(); for (; it1 != end1; ++it1) - *it1 = support::onlyFilename(*it1); + *it1 = onlyFilename(*it1); // sort on filename only (no path) sort(data.begin(), data.end()); diff --git a/src/frontends/qt4/GuiToolbar.cpp b/src/frontends/qt4/GuiToolbar.cpp index 9aa758dcbf..ecba34a10d 100644 --- a/src/frontends/qt4/GuiToolbar.cpp +++ b/src/frontends/qt4/GuiToolbar.cpp @@ -51,6 +51,7 @@ #include using namespace std; +using namespace lyx::support; static void initializeResources() { @@ -65,11 +66,6 @@ static void initializeResources() namespace lyx { namespace frontend { -using support::libFileSearch; -using support::subst; -using support::compare; - - namespace { struct PngMap { diff --git a/src/frontends/qt4/GuiView.cpp b/src/frontends/qt4/GuiView.cpp index 21a323efb6..af555a69bd 100644 --- a/src/frontends/qt4/GuiView.cpp +++ b/src/frontends/qt4/GuiView.cpp @@ -451,7 +451,7 @@ void GuiView::dropEvent(QDropEvent* event) LYXERR(Debug::GUI, "GuiView::dropEvent: got URLs!"); for (int i = 0; i != files.size(); ++i) { - string const file = support::os::internal_path(fromqstr( + string const file = os::internal_path(fromqstr( files.at(i).toLocalFile())); if (!file.empty()) lyx::dispatch(FuncRequest(LFUN_FILE_OPEN, file)); @@ -1176,10 +1176,10 @@ bool GuiView::renameBuffer(Buffer & b, docstring const & newname) dlg.setButton1(_("Documents|#o#O"), from_utf8(lyxrc.document_path)); dlg.setButton2(_("Templates|#T#t"), from_utf8(lyxrc.template_path)); - if (!support::isLyXFilename(fname.absFilename())) + if (!isLyXFilename(fname.absFilename())) fname.changeExtension(".lyx"); - support::FileFilterList const filter(_("LyX Documents (*.lyx)")); + FileFilterList const filter(_("LyX Documents (*.lyx)")); FileDialog::Result result = dlg.save(from_utf8(fname.onlyPath().absFilename()), @@ -1194,7 +1194,7 @@ bool GuiView::renameBuffer(Buffer & b, docstring const & newname) if (fname.empty()) return false; - if (!support::isLyXFilename(fname.absFilename())) + if (!isLyXFilename(fname.absFilename())) fname.changeExtension(".lyx"); } diff --git a/src/frontends/qt4/GuiWorkArea.cpp b/src/frontends/qt4/GuiWorkArea.cpp index 933a86b485..77aaa9bf27 100644 --- a/src/frontends/qt4/GuiWorkArea.cpp +++ b/src/frontends/qt4/GuiWorkArea.cpp @@ -452,7 +452,7 @@ void GuiWorkArea::toggleCursor() // Use this opportunity to deal with any child processes that // have finished but are waiting to communicate this fact // to the rest of LyX. - support::ForkedCallsController::handleCompletedProcesses(); + ForkedCallsController::handleCompletedProcesses(); } diff --git a/src/frontends/qt4/qt_helpers.cpp b/src/frontends/qt4/qt_helpers.cpp index df7cdd1895..3b09d9a941 100644 --- a/src/frontends/qt4/qt_helpers.cpp +++ b/src/frontends/qt4/qt_helpers.cpp @@ -306,11 +306,11 @@ docstring browseDir(docstring const & pathname, docstring const & title, void rescanTexStyles() { // Run rescan in user lyx directory - support::PathChanger p(package().user_support()); + PathChanger p(package().user_support()); FileName const command = libFileSearch("scripts", "TeXFiles.py"); Systemcall one; int const status = one.startscript(Systemcall::Wait, - support::os::python() + ' ' + + os::python() + ' ' + quoteName(command.toFilesystemEncoding())); if (status == 0) return; diff --git a/src/graphics/GraphicsConverter.cpp b/src/graphics/GraphicsConverter.cpp index 817768e489..1f00028ce7 100644 --- a/src/graphics/GraphicsConverter.cpp +++ b/src/graphics/GraphicsConverter.cpp @@ -159,7 +159,7 @@ Converter::Impl::Impl(FileName const & from_file, string const & to_file_base, // We create a dummy command for ease of understanding of the // list of forked processes. // Note: 'python ' is absolutely essential, or execvp will fail. - script_command_ = support::os::python() + ' ' + + script_command_ = os::python() + ' ' + quoteName(script_file_.toFilesystemEncoding()) + ' ' + quoteName(onlyFilename(from_file.toFilesystemEncoding())) + ' ' + quoteName(to_format); @@ -176,7 +176,7 @@ void Converter::Impl::startConversion() } ForkedCall::SignalTypePtr ptr = - support::ForkedCallQueue::add(script_command_); + ForkedCallQueue::add(script_command_); ptr->connect(boost::bind(&Impl::converted, this, _1, _2)); } @@ -325,7 +325,7 @@ static void build_script(FileName const & from_file, << quoteName(to_file, quote_python) << ")\n"; ostringstream os; - os << support::os::python() << ' ' + os << os::python() << ' ' << libScriptSearch("$$s/scripts/convertDefault.py", quote_python) << ' '; if (!from_format.empty()) diff --git a/src/graphics/PreviewLoader.cpp b/src/graphics/PreviewLoader.cpp index 4c668120eb..32bbed0a71 100644 --- a/src/graphics/PreviewLoader.cpp +++ b/src/graphics/PreviewLoader.cpp @@ -63,7 +63,7 @@ string const unique_filename(string const & bufferpath) { static int theCounter = 0; string const filename = lyx::convert(theCounter++) + "lyxpreview"; - return lyx::support::addName(bufferpath, filename); + return addName(bufferpath, filename); } @@ -369,7 +369,7 @@ InProgress::InProgress(string const & filename_base, void InProgress::stop() const { if (pid) - lyx::support::ForkedCallsController::kill(pid, 0); + ForkedCallsController::kill(pid, 0); if (!metrics_file.empty()) metrics_file.removeFile(); @@ -469,7 +469,7 @@ void PreviewLoader::Impl::add(string const & latex_snippet) if (!pconverter_ || status(latex_snippet) != NotFound) return; - string const snippet = support::trim(latex_snippet); + string const snippet = trim(latex_snippet); if (snippet.empty()) return; @@ -584,19 +584,19 @@ void PreviewLoader::Impl::startLoading() // The conversion command. ostringstream cs; cs << pconverter_->command << ' ' << pconverter_->to << ' ' - << support::quoteName(latexfile.toFilesystemEncoding()) << ' ' + << quoteName(latexfile.toFilesystemEncoding()) << ' ' << int(font_scaling_factor_) << ' ' << theApp()->hexName(Color_preview) << ' ' << theApp()->hexName(Color_background); - string const command = support::libScriptSearch(cs.str()); + string const command = libScriptSearch(cs.str()); // Initiate the conversion from LaTeX to bitmap images files. - support::ForkedCall::SignalTypePtr - convert_ptr(new support::ForkedCall::SignalType); + ForkedCall::SignalTypePtr + convert_ptr(new ForkedCall::SignalType); convert_ptr->connect(bind(&Impl::finishedGenerating, this, _1, _2)); - support::ForkedCall call; + ForkedCall call; int ret = call.startScript(command, convert_ptr); if (ret != 0) { diff --git a/src/insets/ExternalSupport.cpp b/src/insets/ExternalSupport.cpp index 7831f76bc4..075313667e 100644 --- a/src/insets/ExternalSupport.cpp +++ b/src/insets/ExternalSupport.cpp @@ -62,8 +62,8 @@ string const subst_path(string const & input, string const & placeholder, string const & path, bool use_latex_path, - support::latex_path_extension ext = support::PROTECT_EXTENSION, - support::latex_path_dots dots = support::LEAVE_DOTS) + latex_path_extension ext = PROTECT_EXTENSION, + latex_path_dots dots = LEAVE_DOTS) { if (input.find(placeholder) == string::npos) return input; @@ -71,8 +71,8 @@ string const subst_path(string const & input, // path will be compared with another one in internal style later // in Converters::move. string const path2 = use_latex_path ? - support::latex_path(path, ext, dots) : path; - return support::subst(input, placeholder, path2); + latex_path(path, ext, dots) : path; + return subst(input, placeholder, path2); } } // namespace anon @@ -91,64 +91,64 @@ string const doSubstitution(InsetExternalParams const & params, string const filename = external_in_tmpdir ? params.filename.mangledFilename() : params.filename.outputFilename(parentpath); - string const basename = support::changeExtension( - support::onlyFilename(filename), string()); - string const absname = support::makeAbsPath(filename, parentpath).absFilename(); + string const basename = changeExtension( + onlyFilename(filename), string()); + string const absname = makeAbsPath(filename, parentpath).absFilename(); string result = s; if (what != ALL_BUT_PATHS) { - string const filepath = support::onlyPath(filename); - string const abspath = support::onlyPath(absname); + string const filepath = onlyPath(filename); + string const abspath = onlyPath(absname); string const masterpath = external_in_tmpdir ? masterBuffer->temppath() : masterBuffer->filePath(); // FIXME UNICODE - string relToMasterPath = support::onlyPath( - to_utf8(support::makeRelPath(from_utf8(absname), + string relToMasterPath = onlyPath( + to_utf8(makeRelPath(from_utf8(absname), from_utf8(masterpath)))); if (relToMasterPath == "./") relToMasterPath.clear(); // FIXME UNICODE - string relToParentPath = support::onlyPath( - to_utf8(support::makeRelPath(from_utf8(absname), + string relToParentPath = onlyPath( + to_utf8(makeRelPath(from_utf8(absname), from_utf8(parentpath)))); if (relToParentPath == "./") relToParentPath.clear(); result = subst_path(result, "$$FPath", filepath, use_latex_path, - support::PROTECT_EXTENSION, - support::ESCAPE_DOTS); + PROTECT_EXTENSION, + ESCAPE_DOTS); result = subst_path(result, "$$AbsPath", abspath, use_latex_path, - support::PROTECT_EXTENSION, - support::ESCAPE_DOTS); + PROTECT_EXTENSION, + ESCAPE_DOTS); result = subst_path(result, "$$RelPathMaster", relToMasterPath, use_latex_path, - support::PROTECT_EXTENSION, - support::ESCAPE_DOTS); + PROTECT_EXTENSION, + ESCAPE_DOTS); result = subst_path(result, "$$RelPathParent", relToParentPath, use_latex_path, - support::PROTECT_EXTENSION, - support::ESCAPE_DOTS); - if (support::absolutePath(filename)) { + PROTECT_EXTENSION, + ESCAPE_DOTS); + if (absolutePath(filename)) { result = subst_path(result, "$$AbsOrRelPathMaster", abspath, use_latex_path, - support::PROTECT_EXTENSION, - support::ESCAPE_DOTS); + PROTECT_EXTENSION, + ESCAPE_DOTS); result = subst_path(result, "$$AbsOrRelPathParent", abspath, use_latex_path, - support::PROTECT_EXTENSION, - support::ESCAPE_DOTS); + PROTECT_EXTENSION, + ESCAPE_DOTS); } else { result = subst_path(result, "$$AbsOrRelPathMaster", relToMasterPath, use_latex_path, - support::PROTECT_EXTENSION, - support::ESCAPE_DOTS); + PROTECT_EXTENSION, + ESCAPE_DOTS); result = subst_path(result, "$$AbsOrRelPathParent", relToParentPath, use_latex_path, - support::PROTECT_EXTENSION, - support::ESCAPE_DOTS); + PROTECT_EXTENSION, + ESCAPE_DOTS); } } @@ -156,17 +156,17 @@ string const doSubstitution(InsetExternalParams const & params, return result; result = subst_path(result, "$$FName", filename, use_latex_path, - support::EXCLUDE_EXTENSION); + EXCLUDE_EXTENSION); result = subst_path(result, "$$Basename", basename, use_latex_path, - support::PROTECT_EXTENSION, support::ESCAPE_DOTS); + PROTECT_EXTENSION, ESCAPE_DOTS); result = subst_path(result, "$$Extension", - '.' + support::getExtension(filename), use_latex_path); + '.' + getExtension(filename), use_latex_path); result = subst_path(result, "$$Tempname", params.tempname().absFilename(), use_latex_path); result = subst_path(result, "$$Sysdir", - support::package().system_support().absFilename(), use_latex_path); + package().system_support().absFilename(), use_latex_path); // Handle the $$Contents(filename) syntax - if (support::contains(result, "$$Contents(\"")) { + if (contains(result, "$$Contents(\"")) { // Since use_latex_path may be true we must extract the file // name from s instead of result and do the substitutions // again, this time with use_latex_path false. @@ -179,7 +179,7 @@ string const doSubstitution(InsetExternalParams const & params, string contents; FileName const absfile( - support::makeAbsPath(file, masterBuffer->temppath())); + makeAbsPath(file, masterBuffer->temppath())); if (absfile.isReadableFile()) // FIXME UNICODE contents = to_utf8(absfile.fileContents("UTF-8")); @@ -247,7 +247,7 @@ void updateExternal(InsetExternalParams const & params, // We copy the source file to the temp dir and do the conversion // there if necessary FileName const temp_file( - support::makeAbsPath(params.filename.mangledFilename(), + makeAbsPath(params.filename.mangledFilename(), masterBuffer->temppath())); if (!params.filename.empty() && !params.filename.isDirectory()) { unsigned long const from_checksum = params.filename.checksum(); @@ -268,7 +268,7 @@ void updateExternal(InsetExternalParams const & params, outputFormat.updateResult, false, true); FileName const abs_to_file( - support::makeAbsPath(to_file, masterBuffer->temppath())); + makeAbsPath(to_file, masterBuffer->temppath())); if (!dryrun) { // Record the referenced files for the exporter. @@ -280,7 +280,7 @@ void updateExternal(InsetExternalParams const & params, vector::const_iterator fit = rit->second.begin(); vector::const_iterator fend = rit->second.end(); for (; fit != fend; ++fit) { - FileName const source(support::makeAbsPath( + FileName const source(makeAbsPath( doSubstitution(params, buffer, *fit, false, true), masterBuffer->temppath())); @@ -288,7 +288,7 @@ void updateExternal(InsetExternalParams const & params, // temp path, but the filename may be the mangled // or the real name. Therefore we substitute the // paths and names separately. - string file = support::subst(*fit, "$$FName", + string file = subst(*fit, "$$FName", "$$FPath$$Basename$$Extension"); file = doSubstitution(params, buffer, file, false, false, PATHS); @@ -304,7 +304,7 @@ void updateExternal(InsetExternalParams const & params, // Do we need to perform the conversion? // Yes if to_file does not exist or if from_file is newer than to_file - if (support::compare_timestamps(temp_file, abs_to_file) < 0) + if (compare_timestamps(temp_file, abs_to_file) < 0) return; // SUCCESS // FIXME (Abdel 12/08/06): Is there a need to show these errors? @@ -351,7 +351,7 @@ int writeExternal(InsetExternalParams const & params, return 0; } - if (!dryrun || support::contains(cit->second.product, "$$Contents")) + if (!dryrun || contains(cit->second.product, "$$Contents")) updateExternal(params, format, buffer, exportdata, external_in_tmpdir, dryrun); @@ -359,7 +359,7 @@ int writeExternal(InsetExternalParams const & params, string str = doSubstitution(params, buffer, cit->second.product, use_latex_path, external_in_tmpdir); - string const absname = support::makeAbsPath( + string const absname = makeAbsPath( params.filename.outputFilename(buffer.filePath()), buffer.filePath()).absFilename(); if (!external_in_tmpdir && !isValidLaTeXFilename(absname)) { @@ -411,8 +411,8 @@ string const substituteIt(string const & input, return input; string result = - support::subst(input, ptr->front_placeholder(), ptr->front()); - return support::subst(result, ptr->back_placeholder(), ptr->back()); + subst(input, ptr->front_placeholder(), ptr->front()); + return subst(result, ptr->back_placeholder(), ptr->back()); } @@ -449,7 +449,7 @@ string const substituteIt(string const & input, if (!ptr.get()) return input; - return support::subst(input, ptr->placeholder(), ptr->option()); + return subst(input, ptr->placeholder(), ptr->option()); } @@ -519,7 +519,7 @@ string const substituteOptions(InsetExternalParams const & params, for (; it != end; ++it) { string const opt = substituteOption(params, it->option, format); string const placeholder = "$$" + it->name; - output = support::subst(output, placeholder, opt); + output = subst(output, placeholder, opt); } return output; diff --git a/src/insets/ExternalTemplate.cpp b/src/insets/ExternalTemplate.cpp index efc9b8c4f9..01600c07ba 100644 --- a/src/insets/ExternalTemplate.cpp +++ b/src/insets/ExternalTemplate.cpp @@ -24,6 +24,7 @@ #include using namespace std; +using namespace lyx::support; namespace lyx { namespace external { @@ -59,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'; @@ -219,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(); @@ -231,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, @@ -251,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"); diff --git a/src/insets/ExternalTransforms.cpp b/src/insets/ExternalTransforms.cpp index 2ca1fceda3..ca1c5c5443 100644 --- a/src/insets/ExternalTransforms.cpp +++ b/src/insets/ExternalTransforms.cpp @@ -317,7 +317,7 @@ string const sanitizeLatexOption(string const & input) output = what.str(1); // Remove any surrounding whitespace - output = support::trim(output); + output = trim(output); // If the thing is empty, leave it so, else wrap it in square brackets. return output.empty() ? output : "[" + output + "]"; diff --git a/src/insets/InsetBibitem.cpp b/src/insets/InsetBibitem.cpp index c8b11cd3b4..db5bc53e4e 100644 --- a/src/insets/InsetBibitem.cpp +++ b/src/insets/InsetBibitem.cpp @@ -32,6 +32,7 @@ #include using namespace std; +using namespace lyx::support; namespace lyx { @@ -95,7 +96,7 @@ void InsetBibitem::read(Buffer const & buf, Lexer & lex) { InsetCommand::read(buf, lex); - if (support::prefixIs(getParam("key"), key_prefix)) { + if (prefixIs(getParam("key"), key_prefix)) { int const key = convert(getParam("key").substr(key_prefix.length())); key_counter = max(key_counter, key); } diff --git a/src/insets/InsetBibtex.cpp b/src/insets/InsetBibtex.cpp index 434bb0b0a4..0c6ee63bb1 100644 --- a/src/insets/InsetBibtex.cpp +++ b/src/insets/InsetBibtex.cpp @@ -81,8 +81,8 @@ void InsetBibtex::doDispatch(Cursor & cur, FuncRequest & cmd) cur.noUpdate(); break; } - } catch (support::ExceptionMessage const & message) { - if (message.type_ == support::WarningException) { + } catch (ExceptionMessage const & message) { + if (message.type_ == WarningException) { Alert::warning(message.title_, message.details_); cur.noUpdate(); } else @@ -309,7 +309,7 @@ int InsetBibtex::latex(Buffer const & buffer, odocstream & os, FileNameList const InsetBibtex::getFiles(Buffer const & buffer) const { FileName path(buffer.filePath()); - support::PathChanger p(path); + PathChanger p(path); FileNameList vec; diff --git a/src/insets/InsetCaption.cpp b/src/insets/InsetCaption.cpp index b50d89356b..f741289801 100644 --- a/src/insets/InsetCaption.cpp +++ b/src/insets/InsetCaption.cpp @@ -42,6 +42,7 @@ #include using namespace std; +using namespace lyx::support; namespace lyx { @@ -101,7 +102,7 @@ void InsetCaption::cursorPos(BufferView const & bv, void InsetCaption::setCustomLabel(docstring const & label) { - if (!support::isAscii(label) || label.empty()) + if (!isAscii(label) || label.empty()) // This must be a user defined layout. We cannot translate // this, since gettext accepts only ascii keys. custom_label_ = label; @@ -270,7 +271,6 @@ int InsetCaption::getOptArg(Buffer const & buf, odocstream & os, void InsetCaption::updateLabels(Buffer const & buf, ParIterator const & it) { - using support::bformat; TextClass const & tclass = buf.params().getTextClass(); Counters & cnts = tclass.counters(); string const & type = cnts.current_float(); diff --git a/src/insets/InsetCitation.cpp b/src/insets/InsetCitation.cpp index 8a87042fa1..b7faae15e2 100644 --- a/src/insets/InsetCitation.cpp +++ b/src/insets/InsetCitation.cpp @@ -333,8 +333,6 @@ docstring const getNatbibLabel(Buffer const & buffer, docstring const getBasicLabel(docstring const & keyList, docstring const & after) { - using support::contains; - docstring keys = keyList; docstring label; diff --git a/src/insets/InsetExternal.cpp b/src/insets/InsetExternal.cpp index ff4e19c990..8fb3ba80b7 100644 --- a/src/insets/InsetExternal.cpp +++ b/src/insets/InsetExternal.cpp @@ -65,11 +65,11 @@ namespace external { TempName::TempName() { - support::FileName const tempname(support::tempName(support::FileName(), "lyxext")); + FileName const tempname(tempName(FileName(), "lyxext")); // FIXME: This is unsafe tempname.removeFile(); // must have an extension for the converter code to work correctly. - tempname_ = support::FileName(tempname.absFilename() + ".tmp"); + tempname_ = FileName(tempname.absFilename() + ".tmp"); } @@ -224,7 +224,6 @@ void InsetExternalParams::write(Buffer const & buffer, ostream & os) const } if (!resizedata.no_resize()) { - using support::float_equal; double const scl = convert(resizedata.scale); if (!float_equal(scl, 0.0, 0.05)) { if (!float_equal(scl, 100.0, 0.05)) @@ -587,7 +586,7 @@ docstring const getScreenLabel(InsetExternalParams const & params, external::getTemplatePtr(params); if (!ptr) // FIXME UNICODE - return support::bformat((_("External template %1$s is not installed")), + return bformat((_("External template %1$s is not installed")), from_utf8(params.templatename())); // FIXME UNICODE docstring gui = _(ptr->guiName); diff --git a/src/insets/InsetGraphics.cpp b/src/insets/InsetGraphics.cpp index 7e98a60109..3b33d9957f 100644 --- a/src/insets/InsetGraphics.cpp +++ b/src/insets/InsetGraphics.cpp @@ -484,7 +484,7 @@ copyFileIfNeeded(FileName const & file_in, FileName const & file_out) if (!success) { // FIXME UNICODE LYXERR(Debug::GRAPHICS, - to_utf8(support::bformat(_("Could not copy the file\n%1$s\n" + to_utf8(bformat(_("Could not copy the file\n%1$s\n" "into the temporary directory."), from_utf8(file_in.absFilename())))); } @@ -497,11 +497,9 @@ copyFileIfNeeded(FileName const & file_in, FileName const & file_out) pair const copyToDirIfNeeded(DocFileName const & file, string const & dir) { - using support::rtrim; - string const file_in = file.absFilename(); - string const only_path = support::onlyPath(file_in); - if (rtrim(support::onlyPath(file_in) , "/") == rtrim(dir, "/")) + string const only_path = onlyPath(file_in); + if (rtrim(onlyPath(file_in) , "/") == rtrim(dir, "/")) return make_pair(IDENTICAL_PATHS, file_in); string mangled = file.mangledFilename(); @@ -516,7 +514,7 @@ copyToDirIfNeeded(DocFileName const & file, string const & dir) string::size_type const ext_len = file_in.length() - base.length(); mangled[mangled.length() - ext_len] = '.'; } - FileName const file_out(support::makeAbsPath(mangled, dir)); + FileName const file_out(makeAbsPath(mangled, dir)); return copyFileIfNeeded(file, file_out); } @@ -535,13 +533,10 @@ string const stripExtensionIfPossible(string const & file, bool nice) // dots with a macro whose definition is just a dot ;-) // The automatic format selection does not work if the file // name is escaped. - string const latex_name = latex_path(file, - support::EXCLUDE_EXTENSION); + string const latex_name = latex_path(file, EXCLUDE_EXTENSION); if (!nice || contains(latex_name, '"')) return latex_name; - return latex_path(removeExtension(file), - support::PROTECT_EXTENSION, - support::ESCAPE_DOTS); + return latex_path(removeExtension(file), PROTECT_EXTENSION, ESCAPE_DOTS); } @@ -556,7 +551,7 @@ string const stripExtensionIfPossible(string const & file, string const & to, bo (to_format == "eps" && file_format == "ps") || (to_format == "ps" && file_format == "eps")) return stripExtensionIfPossible(file, nice); - return latex_path(file, support::EXCLUDE_EXTENSION); + return latex_path(file, EXCLUDE_EXTENSION); } } // namespace anon @@ -654,8 +649,7 @@ string const InsetGraphics::prepareFile(Buffer const & buf, source_file, output_file); // We can't strip the extension, because we don't know // the unzipped file format - return latex_path(output_file, - support::EXCLUDE_EXTENSION); + return latex_path(output_file, EXCLUDE_EXTENSION); } FileName const unzipped_temp_file = @@ -694,7 +688,7 @@ string const InsetGraphics::prepareFile(Buffer const & buf, // the file format from the extension, so we must // change it. FileName const new_file = FileName(changeExtension(temp_file.absFilename(), ext)); - if (support::rename(temp_file, new_file)) { + if (rename(temp_file, new_file)) { temp_file = new_file; output_file = changeExtension(output_file, ext); source_file = FileName(changeExtension(source_file.absFilename(), ext)); diff --git a/src/insets/InsetLabel.cpp b/src/insets/InsetLabel.cpp index 07488dfa6a..b0cf6dfcf5 100644 --- a/src/insets/InsetLabel.cpp +++ b/src/insets/InsetLabel.cpp @@ -23,6 +23,7 @@ #include "support/lyxalgo.h" using namespace std; +using namespace lyx::support; namespace lyx { @@ -88,7 +89,7 @@ void InsetLabel::doDispatch(Cursor & cur, FuncRequest & cmd) int InsetLabel::latex(Buffer const &, odocstream & os, OutputParams const &) const { - os << support::escape(getCommand()); + os << escape(getCommand()); return 0; } diff --git a/src/mathed/InsetMathGrid.cpp b/src/mathed/InsetMathGrid.cpp index e83eaeb9a7..cc542399c2 100644 --- a/src/mathed/InsetMathGrid.cpp +++ b/src/mathed/InsetMathGrid.cpp @@ -34,11 +34,10 @@ #include using namespace std; +using namespace lyx::support; namespace lyx { -using support::bformat; - namespace { docstring verboseHLine(int n) @@ -1419,7 +1418,7 @@ bool InsetMathGrid::getStatus(Cursor & cur, FuncRequest const & cmd, status.enable(false); break; } - if (!support::contains("tcb", cmd.argument()[0])) { + if (!contains("tcb", cmd.argument()[0])) { status.enable(false); break; } diff --git a/src/mathed/InsetMathHull.cpp b/src/mathed/InsetMathHull.cpp index 5a15104f83..d099a762d7 100644 --- a/src/mathed/InsetMathHull.cpp +++ b/src/mathed/InsetMathHull.cpp @@ -1105,7 +1105,7 @@ void InsetMathHull::doDispatch(Cursor & cur, FuncRequest & cmd) docstring str = p["name"]; cur.recordUndoInset(); row_type const r = (type_ == hullMultline) ? nrows() - 1 : cur.row(); - str = support::trim(str); + str = trim(str); if (!str.empty()) numbered(r, true); docstring old = label(r); diff --git a/src/mathed/InsetMathNest.cpp b/src/mathed/InsetMathNest.cpp index c1f9c7032c..0844b4d8a9 100644 --- a/src/mathed/InsetMathNest.cpp +++ b/src/mathed/InsetMathNest.cpp @@ -60,6 +60,7 @@ #include using namespace std; +using namespace lyx::support; namespace lyx { @@ -922,7 +923,7 @@ void InsetMathNest::doDispatch(Cursor & cur, FuncRequest & cmd) case LFUN_MATH_DELIM: { docstring ls; - docstring rs = support::split(cmd.argument(), ls, ' '); + docstring rs = split(cmd.argument(), ls, ' '); // Reasonable default values if (ls.empty()) ls = '('; diff --git a/src/mathed/MathExtern.cpp b/src/mathed/MathExtern.cpp index 94e5c330a3..19275c6925 100644 --- a/src/mathed/MathExtern.cpp +++ b/src/mathed/MathExtern.cpp @@ -1427,7 +1427,7 @@ MathData pipeThroughExtern(string const & lang, docstring const & extra, string data = to_utf8(os.str()); // search external script - support::FileName const file = libFileSearch("mathed", "extern_" + lang); + FileName const file = libFileSearch("mathed", "extern_" + lang); if (file.empty()) { lyxerr << "converter to '" << lang << "' not found" << endl; return MathData(); diff --git a/src/mathed/MathFactory.cpp b/src/mathed/MathFactory.cpp index 2025bd46c8..a3a77d1123 100644 --- a/src/mathed/MathFactory.cpp +++ b/src/mathed/MathFactory.cpp @@ -96,7 +96,7 @@ bool math_font_available(docstring & name) void initSymbols() { - support::FileName const filename = libFileSearch(string(), "symbols"); + FileName const filename = libFileSearch(string(), "symbols"); LYXERR(Debug::MATHED, "read symbols from " << filename); if (filename.empty()) { lyxerr << "Could not find symbols file" << endl; diff --git a/src/support/debug.cpp b/src/support/debug.cpp index ddf90ccebd..21f2dea3a0 100644 --- a/src/support/debug.cpp +++ b/src/support/debug.cpp @@ -172,7 +172,7 @@ LyXErr & operator<<(LyXErr & l, string const & t) { if (l.enabled()) l.stream() << t; return l; } LyXErr & operator<<(LyXErr & l, docstring const & t) { if (l.enabled()) l.stream() << to_utf8(t); return l; } -LyXErr & operator<<(LyXErr & l, support::FileName const & t) +LyXErr & operator<<(LyXErr & l, FileName const & t) { if (l.enabled()) l.stream() << t; return l; } LyXErr & operator<<(LyXErr & l, ostream &(*t)(ostream &)) { if (l.enabled()) l.stream() << t; return l; } diff --git a/src/support/docstring.cpp b/src/support/docstring.cpp index 4d39b22efe..8a59d40d4f 100644 --- a/src/support/docstring.cpp +++ b/src/support/docstring.cpp @@ -596,8 +596,8 @@ protected: for (; iit != eit; ++iit) { s += *iit; ++n; - bool true_ok = lyx::support::prefixIs(truename, s); - bool false_ok = lyx::support::prefixIs(falsename, s); + bool true_ok = prefixIs(truename, s); + bool false_ok = prefixIs(falsename, s); if (!true_ok && !false_ok) { ++iit; ok = false; diff --git a/src/tex2lyx/Context.cpp b/src/tex2lyx/Context.cpp index ff3c85d114..e2cc1b5e70 100644 --- a/src/tex2lyx/Context.cpp +++ b/src/tex2lyx/Context.cpp @@ -18,6 +18,7 @@ #include using namespace std; +using namespace lyx::support; namespace lyx { @@ -206,7 +207,7 @@ void Context::new_paragraph(ostream & os) void Context::add_extra_stuff(string const & stuff) { - if (!lyx::support::contains(extra_stuff, stuff)) + if (!contains(extra_stuff, stuff)) extra_stuff += stuff; } diff --git a/src/tex2lyx/preamble.cpp b/src/tex2lyx/preamble.cpp index 86a57087b2..8a884713d5 100644 --- a/src/tex2lyx/preamble.cpp +++ b/src/tex2lyx/preamble.cpp @@ -649,7 +649,7 @@ TextClass const parse_preamble(Parser & p, ostream & os, string const & forcecla // Force textclass if the user wanted it if (!forceclass.empty()) h_textclass = forceclass; - if (noweb_mode && !lyx::support::prefixIs(h_textclass, "literate-")) + if (noweb_mode && !prefixIs(h_textclass, "literate-")) h_textclass.insert(0, "literate-"); FileName layoutfilename = libFileSearch("layouts", h_textclass, "layout"); if (layoutfilename.empty()) { diff --git a/src/tex2lyx/tex2lyx.cpp b/src/tex2lyx/tex2lyx.cpp index 2f26838adf..f873845aa7 100644 --- a/src/tex2lyx/tex2lyx.cpp +++ b/src/tex2lyx/tex2lyx.cpp @@ -486,15 +486,15 @@ int main(int argc, char * argv[]) return 2; } - lyx::support::os::init(argc, argv); + os::init(argc, argv); - try { support::init_package(internal_path(to_utf8(from_local8bit(argv[0]))), + try { init_package(internal_path(to_utf8(from_local8bit(argv[0]))), cl_system_support, cl_user_support, - support::top_build_dir_is_two_levels_up); - } catch (support::ExceptionMessage const & message) { + top_build_dir_is_two_levels_up); + } catch (ExceptionMessage const & message) { cerr << to_utf8(message.title_) << ":\n" << to_utf8(message.details_) << endl; - if (message.type_ == support::ErrorException) + if (message.type_ == ErrorException) exit(1); } @@ -511,7 +511,7 @@ int main(int argc, char * argv[]) } else outfilename = changeExtension(infilename, ".lyx"); - FileName const system_syntaxfile = lyx::support::libFileSearch("", "syntax.default"); + FileName const system_syntaxfile = libFileSearch("", "syntax.default"); if (system_syntaxfile.empty()) { cerr << "Error: Could not find syntax file \"syntax.default\"." << endl; exit(1); diff --git a/src/tex2lyx/text.cpp b/src/tex2lyx/text.cpp index e1559f031d..dd7cd54f7c 100644 --- a/src/tex2lyx/text.cpp +++ b/src/tex2lyx/text.cpp @@ -248,7 +248,7 @@ bool splitLatexLength(string const & len, string & value, string & unit) if (contains(len, '\\')) unit = trim(string(len, i)); else - unit = support::ascii_lowercase(trim(string(len, i))); + unit = ascii_lowercase(trim(string(len, i))); return true; } @@ -1029,7 +1029,7 @@ string const normalize_filename(string const & name) /// convention (relative to .lyx file) if it is relative void fix_relative_filename(string & name) { - if (lyx::support::absolutePath(name)) + if (absolutePath(name)) return; // FIXME UNICODE encoding of name may be wrong (makeAbsPath expects // utf8) -- 2.39.5