introduce namespace lyx::support

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7224 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2003-06-30 23:56:22 +00:00
parent fa78e1ddb6
commit 92d522b7f1
258 changed files with 1551 additions and 1029 deletions

View File

@ -361,7 +361,7 @@ void basic_format<Ch, Traits> ::parse(const string_t & buf)
// A: find upper_bound on num_items and allocates arrays
i1=0;
while( (i1=buf.find(arg_mark,i1)) != string::npos )
while( (i1=buf.find(arg_mark,i1)) != string_t::npos )
{
if( i1+1 >= buf.size() ) {
if(exceptions() & io::bad_format_string_bit)
@ -385,7 +385,7 @@ void basic_format<Ch, Traits> ::parse(const string_t & buf)
typename string_t::size_type i0 = i1;
bool special_things=false;
int cur_it=0;
while( (i1=buf.find(arg_mark,i1)) != string::npos )
while( (i1=buf.find(arg_mark,i1)) != string_t::npos )
{
string_t & piece = (cur_it==0) ? prefix_ : items_[cur_it-1].appendix_;

View File

@ -3,7 +3,7 @@
* Copyright 1995-2002 the LyX Team
* Read the file COPYING
*
* \author unknown
* \author Lars Gullik Bjønnes
* \author John Levon <moz@compsoc.man.ac.uk>
*/
@ -49,6 +49,7 @@
extern BufferList bufferlist;
using lyx::pos_type;
using namespace lyx::support;
using std::pair;
using std::endl;

View File

@ -3,6 +3,7 @@
* Copyright 2002 the LyX Team
* Read the file COPYING
*
* \author Lars Gullik Bjønnes
* \author various
*/
@ -75,6 +76,7 @@ using std::make_pair;
using std::min;
using lyx::pos_type;
using namespace lyx::support;
using namespace bv_funcs;
extern BufferList bufferlist;

View File

@ -17,6 +17,8 @@
#include "Bullet.h"
#include "support/LAssert.h"
using namespace lyx::support;
/** The four LaTeX itemize environment default bullets
*/
extern
@ -365,17 +367,17 @@ string const Bullet::bulletEntry(int f, int c)
#ifdef ENABLE_ASSERTIONS
void Bullet::testInvariant() const {
lyx::Assert(font >= MIN);
lyx::Assert(font < FONTMAX);
lyx::Assert(character >= MIN);
lyx::Assert(character < CHARMAX);
lyx::Assert(size >= MIN);
lyx::Assert(size < SIZEMAX);
lyx::Assert(user_text >= -1);
lyx::Assert(user_text <= 1);
Assert(font >= MIN);
Assert(font < FONTMAX);
Assert(character >= MIN);
Assert(character < CHARMAX);
Assert(size >= MIN);
Assert(size < SIZEMAX);
Assert(user_text >= -1);
Assert(user_text <= 1);
// now some relational/operational tests
if (user_text == 1) {
lyx::Assert(font == -1 && (character == -1 && size == -1));
Assert(font == -1 && (character == -1 && size == -1));
// Assert(!text.empty()); // this isn't necessarily an error
}
// else if (user_text == -1) {

View File

@ -1,3 +1,6 @@
2003-07-01 Lars Gullik Bjønnes <larsbj@gullik.net>
* introduce namespace lyx::support
2003-06-30 André Pönitz <poenitz@gmx.net>

View File

@ -29,6 +29,8 @@
#include <fstream>
using namespace lyx::support;
using std::ifstream;
using std::getline;
@ -80,7 +82,7 @@ int Chktex::scanLogFile(TeXErrors & terr)
token = split(token, warno, ':');
token = split(token, warning, ':');
int const lineno = lyx::atoi(line);
int const lineno = atoi(line);
#if USE_BOOST_FORMAT
msg % warno;

View File

@ -38,6 +38,7 @@ using std::make_pair;
using std::for_each;
using std::vector;
using namespace lyx::support;
using lyx::pos_type;
using lyx::textclass_type;
@ -180,11 +181,11 @@ bool CutAndPaste::copySelection(ParagraphList::iterator startpit,
ParagraphList::iterator endpit,
int start, int end, textclass_type tc)
{
lyx::Assert(&*startpit);
lyx::Assert(&*endpit);
lyx::Assert(0 <= start && start <= startpit->size());
lyx::Assert(0 <= end && end <= endpit->size());
lyx::Assert(startpit != endpit || start <= end);
Assert(&*startpit);
Assert(&*endpit);
Assert(0 <= start && start <= startpit->size());
Assert(0 <= end && end <= endpit->size());
Assert(startpit != endpit || start <= end);
ParagraphList paragraphs;
@ -229,7 +230,7 @@ CutAndPaste::pasteSelection(Buffer const & buffer,
if (!checkPastePossible())
return make_pair(PitPosPair(pit, pos), pit);
lyx::Assert (pos <= pit->size());
Assert (pos <= pit->size());
// Make a copy of the CaP paragraphs.
ParagraphList simple_cut_clone = cuts[cut_index].first;
@ -384,7 +385,7 @@ int CutAndPaste::SwitchLayoutsBetweenClasses(textclass_type c1,
ParagraphList & pars,
ErrorList & errorlist)
{
lyx::Assert(!pars.empty());
Assert(!pars.empty());
int ret = 0;
if (c1 == c2)

View File

@ -33,6 +33,8 @@
using std::time;
#endif
using namespace lyx::support;
using std::make_pair;
using std::ofstream;
using std::ifstream;
@ -57,7 +59,7 @@ void DepTable::insert(string const & fi, bool upd)
di.crc_prev = 0;
if (upd) {
lyxerr[Debug::DEPEND] << " CRC..." << flush;
di.crc_cur = lyx::sum(f);
di.crc_cur = sum(f);
lyxerr[Debug::DEPEND] << "done." << endl;
struct stat f_info;
stat(fi.c_str(), &f_info);
@ -90,7 +92,7 @@ void DepTable::update()
} else {
di.crc_prev = di.crc_cur;
lyxerr[Debug::DEPEND] << itr->first << " CRC... ";
di.crc_cur = lyx::sum(itr->first);
di.crc_cur = sum(itr->first);
lyxerr[Debug::DEPEND] << "done";
}
} else {

View File

@ -17,6 +17,8 @@
#include <map>
using namespace lyx::support;
using std::endl;
@ -198,7 +200,7 @@ void LColor::setColor(LColor::color col, string const & x11name)
return;
}
lyxerr << "LyX internal error: color and such.\n";
lyx::Assert(false);
Assert(false);
}

View File

@ -31,8 +31,7 @@ using std::string;
#define __STRING__
#endif
#include "support/lyxstring.h"
// using lyx::string;
typedef lyxstring string;
using lyx::string;
#define STRCONV(STR) STR.c_str()
#endif

View File

@ -33,6 +33,8 @@
#include <fstream>
#include <cstdio> // sscanf
using namespace lyx::support;
#ifndef CXX_GLOBAL_CSTD
using std::sscanf;
#endif
@ -129,7 +131,7 @@ void LaTeX::deleteFilesOnError() const
// What files do we have to delete?
// This will at least make latex do all the runs
lyx::unlink(depfile);
unlink(depfile);
// but the reason for the error might be in a generated file...
@ -137,15 +139,15 @@ void LaTeX::deleteFilesOnError() const
// bibtex file
string const bbl = ChangeExtension(ofname, ".bbl");
lyx::unlink(bbl);
unlink(bbl);
// makeindex file
string const ind = ChangeExtension(ofname, ".ind");
lyx::unlink(ind);
unlink(ind);
// Also remove the aux file
string const aux = ChangeExtension(ofname, ".aux");
lyx::unlink(aux);
unlink(aux);
}
@ -164,7 +166,7 @@ int LaTeX::run(TeXErrors & terr, LyXFunc * lfun)
bool rerun = false; // rerun requested
// The class LaTeX does not know the temp path.
bufferlist.updateIncludedTeXfiles(lyx::getcwd(), runparams);
bufferlist.updateIncludedTeXfiles(getcwd(), runparams);
// Never write the depfile if an error was encountered.

View File

@ -24,6 +24,8 @@
#include "support/filetools.h"
#include "support/lstrings.h"
using namespace lyx::support;
using lyx::textclass_type;
using std::endl;

View File

@ -12,6 +12,8 @@
#include "gettext.h"
#include "support/lstrings.h"
using namespace lyx::support;
using std::ostream;
using std::endl;
using std::pair;

View File

@ -40,6 +40,8 @@
extern BufferList bufferlist;
extern boost::scoped_ptr<kb_keymap> toplevel_keymap;
using namespace lyx::support;
using std::endl;
using std::vector;
using std::max;
@ -780,7 +782,7 @@ Menu const & MenuBackend::getMenu(string const & name) const
lyx::compare_memfun(&Menu::name, name));
if (cit == end())
lyxerr << "No submenu named " << name << endl;
lyx::Assert(cit != end());
Assert(cit != end());
return (*cit);
}
@ -790,7 +792,7 @@ Menu & MenuBackend::getMenu(string const & name)
MenuList::iterator it =
find_if(menulist_.begin(), menulist_.end(),
lyx::compare_memfun(&Menu::name, name));
lyx::Assert(it != menulist_.end());
Assert(it != menulist_.end());
return (*it);
}

View File

@ -19,6 +19,8 @@
#include <iostream>
using namespace lyx::support;
using std::ostream;
// Initialize static member var.

View File

@ -87,13 +87,13 @@ struct PrinterParams {
#ifdef ENABLE_ASSERTIONS
switch (target) {
case PRINTER:
//Assert(!printer_name.empty());
//lyx::support::Assert(!printer_name.empty());
break;
case FILE:
lyx::Assert(!file_name.empty());
lyx::support::Assert(!file_name.empty());
break;
default:
lyx::Assert(false);
lyx::support::Assert(false);
break;
}
#endif

View File

@ -24,6 +24,8 @@
#include <vector>
using namespace lyx::support;
using std::endl;
using std::vector;
using std::make_pair;

View File

@ -17,6 +17,8 @@
#include "support/LIstream.h"
#include "support/lstrings.h"
using namespace lyx::support;
bool operator==(Author const & l, Author const & r)
{
return l.name() == r.name() && l.email() == r.email();
@ -62,7 +64,7 @@ int AuthorList::record(Author const & a)
void AuthorList::record(int id, Author const & a)
{
lyx::Assert(unsigned(id) < authors_.size());
Assert(unsigned(id) < authors_.size());
authors_[id] = a;
}
@ -71,7 +73,7 @@ void AuthorList::record(int id, Author const & a)
Author const & AuthorList::get(int id)
{
Authors::const_iterator it(authors_.find(id));
lyx::Assert(it != authors_.end());
Assert(it != authors_.end());
return it->second;
}

View File

@ -5,6 +5,8 @@
#include <exception>
using namespace lyx::support;
using std::endl;
namespace boost {
@ -13,7 +15,7 @@ void throw_exception(std::exception const & e)
{
lyxerr << "Exception caught:\n"
<< e.what() << endl;
lyx::Assert(false);
Assert(false);
}

View File

@ -86,6 +86,8 @@
#include <locale>
#endif
using namespace lyx::support;
#ifndef CXX_GLOBAL_CSTD
using std::pow;
#endif
@ -543,7 +545,7 @@ bool Buffer::readFile(LyXLex & lex, string const & filename,
// This code is reached if lyx2lyx failed (for
// some reason) to change the file format of
// the file.
lyx::Assert(false);
Assert(false);
return false;
}
}
@ -627,7 +629,7 @@ bool Buffer::save() const
} else {
// Saving failed, so backup is not backup
if (lyxrc.make_backup) {
lyx::rename(s, fileName());
rename(s, fileName());
}
return false;
}
@ -1647,7 +1649,7 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
sgmlparam = style->latexparam();
c_params = split(sgmlparam, c_depth,'|');
cmd_depth = lyx::atoi(c_depth);
cmd_depth = atoi(c_depth);
if (command_flag) {
if (cmd_depth < command_base) {

View File

@ -32,6 +32,8 @@
extern BufferList bufferlist;
using namespace lyx::support;
namespace {
@ -98,7 +100,7 @@ bool readFile(Buffer * b, string const & s)
b->markDirty();
} else {
// Here, we should delete the autosave
lyx::unlink(a);
unlink(a);
}
}
}

View File

@ -41,6 +41,8 @@
#include <functional>
using namespace lyx::support;
using std::vector;
using std::find;
using std::endl;
@ -118,7 +120,7 @@ bool BufferList::quitWriteAll()
void BufferList::release(Buffer * buf)
{
lyx::Assert(buf);
Assert(buf);
BufferStorage::iterator it = find(bstore.begin(), bstore.end(), buf);
if (it != bstore.end()) {
// Make sure that we don't store a LyXText in
@ -157,7 +159,7 @@ void BufferList::closeAll()
bool BufferList::close(Buffer * buf, bool ask)
{
lyx::Assert(buf);
Assert(buf);
// FIXME: is the quitting check still necessary ?
if (!ask || buf->isClean() || quitting || buf->paragraphs.empty()) {
@ -316,7 +318,7 @@ bool BufferList::exists(string const & s) const
bool BufferList::isLoaded(Buffer const * b) const
{
lyx::Assert(b);
Assert(b);
BufferStorage::const_iterator cit =
find(bstore.begin(), bstore.end(), b);

View File

@ -34,6 +34,8 @@
#include <cstdlib>
#include <algorithm>
using namespace lyx::support;
using std::ostream;
using std::endl;
using std::pair;

View File

@ -36,6 +36,8 @@
#include "insets/updatableinset.h"
using namespace lyx::support;
namespace {

View File

@ -17,6 +17,8 @@
#include "support/LAssert.h"
#include "support/LOstream.h"
using namespace lyx::support;
using std::vector;
using std::endl;
using lyx::pos_type;
@ -325,7 +327,7 @@ Change const Changes::lookupFull(pos_type pos) const
}
check();
lyx::Assert(0);
Assert(false);
return Change(Change::UNCHANGED);
}
@ -347,7 +349,7 @@ Change::Type Changes::lookup(pos_type pos) const
}
check();
lyx::Assert(0);
Assert(0);
return Change::UNCHANGED;
}
@ -485,7 +487,7 @@ void Changes::check() const
if (lyxerr.debugging(Debug::CHANGES))
lyxerr[Debug::CHANGES] << "End" << endl;
lyx::Assert(dont_assert);
Assert(dont_assert);
}

View File

@ -9,6 +9,8 @@
#include <fstream>
using namespace lyx::support;
using std::ifstream;
using std::getline;
using std::pair;
@ -58,7 +60,7 @@ bool CharacterSet::loadFile(string const & fname)
cmatch sub;
#endif
if (regex_match(STRCONV(line), sub, reg)) {
int const n = lyx::atoi(STRCONV(sub.str(1)));
int const n = atoi(STRCONV(sub.str(1)));
string const str = STRCONV(sub.str(2));
if (lyxerr.debugging(Debug::KBMAP))
lyxerr << "Chardef: " << n

View File

@ -35,6 +35,8 @@
#include <cctype>
using namespace lyx::support;
#ifndef CXX_GLOBAL_CSTD
using std::isdigit;
#endif
@ -344,7 +346,7 @@ bool Converters::convert(Buffer const * buffer,
res = one.startscript(type, command);
if (!real_outfile.empty()) {
if (!lyx::rename(outfile, real_outfile))
if (!rename(outfile, real_outfile))
res = -1;
else
lyxerr[Debug::FILES]
@ -394,7 +396,7 @@ bool Converters::convert(Buffer const * buffer,
token_base, from_base);
string to = subst(conv.result_dir,
token_base, to_base);
if (!lyx::rename(from, to)) {
if (!rename(from, to)) {
Alert::error(_("Cannot convert file"),
bformat(_("Could not move a temporary file from %1$s to %2$s."),
from, to));
@ -430,8 +432,8 @@ bool Converters::move(string const & from, string const & to, bool copy)
lyxerr[Debug::FILES] << "moving " << from2
<< " to " << to2 << endl;
bool const moved = (copy)
? lyx::copy(from2, to2)
: lyx::rename(from2, to2);
? lyx::support::copy(from2, to2)
: rename(from2, to2);
if (!moved && no_errors) {
Alert::error(_("Cannot convert file"),
bformat(_("Could not move a temporary file from %1$s to %2$s."),

View File

@ -18,6 +18,8 @@
#include "support/lstrings.h"
#include "support/LAssert.h"
using namespace lyx::support;
using std::endl;
using std::vector;
@ -169,7 +171,7 @@ void Counters::reset()
void Counters::reset(string const & match)
{
lyx::Assert(!match.empty());
Assert(!match.empty());
CounterList::iterator it = counterList.begin();
CounterList::iterator end = counterList.end();

View File

@ -15,6 +15,8 @@
#include <iomanip>
using namespace lyx::support;
using std::ostream;
using std::setw;
using std::endl;

View File

@ -24,6 +24,8 @@
#include <algorithm>
using namespace lyx::support;
using std::vector;
using std::find;
@ -157,4 +159,3 @@ Exporter::GetExportableFormats(Buffer const * buffer, bool only_viewable)
}
return result;
}

View File

@ -54,6 +54,8 @@
#include <cstdio>
using namespace lyx::support;
using std::endl;
Inset * createInset(FuncRequest const & cmd)

View File

@ -26,6 +26,8 @@
#include "support/systemcall.h"
#include "support/lyxfunctional.h"
using namespace lyx::support;
namespace {

View File

@ -11,7 +11,6 @@
#include <config.h>
#include "LyXView.h"
#include "debug.h"
#include "intl.h"
@ -40,6 +39,7 @@
#include <sys/time.h>
#include <unistd.h>
using namespace lyx::support;
using std::endl;
string current_layout;

View File

@ -14,6 +14,8 @@
#include "Timeout.h"
#include "support/LAssert.h"
using namespace lyx::support;
Timeout::~Timeout()
{
@ -65,7 +67,7 @@ Timeout & Timeout::setType(Type t)
Timeout & Timeout::setTimeout(unsigned int msec)
{
// Can't have a timeout of zero!
lyx::Assert(msec);
Assert(msec);
timeout_ms = msec;
return * this;

View File

@ -15,10 +15,11 @@
#include "support/LAssert.h"
#include "debug.h"
using namespace lyx::support;
BCView & ButtonController::view() const
{
lyx::Assert(view_.get());
Assert(view_.get());
return *view_.get();
}
@ -30,7 +31,7 @@ void ButtonController::view(BCView * view)
ButtonPolicy & ButtonController::bp() const
{
lyx::Assert(bp_.get());
Assert(bp_.get());
return *bp_.get();
}

View File

@ -1,3 +1,7 @@
2003-07-01 Lars Gullik Bjønnes <larsbj@gullik.net>
* introduce namespace lyx::support
2003-06-28 Lars Gullik Bjønnes <larsbj@gullik.net>
* Kernel.h: fix some \class issues

View File

@ -22,6 +22,8 @@
#include <fstream>
using namespace lyx::support;
using std::ostream;
// needed for the browser

View File

@ -23,6 +23,8 @@
#include "support/filetools.h"
using namespace lyx::support;
using std::pair;
using std::vector;

View File

@ -18,6 +18,7 @@
#include "lyxrc.h"
#include "support/LAssert.h"
using namespace lyx::support;
ControlButtons::ControlButtons()
: emergency_exit_(false), is_closing_(false),
@ -68,14 +69,14 @@ bool ControlButtons::IconifyWithMain() const
ButtonController & ControlButtons::bc()
{
lyx::Assert(bc_ptr_.get());
Assert(bc_ptr_.get());
return *bc_ptr_.get();
}
ViewBase & ControlButtons::view()
{
lyx::Assert(view_ptr_);
Assert(view_ptr_);
return *view_ptr_;
}

View File

@ -18,6 +18,7 @@
#include "author.h"
#include "support/lstrings.h"
using namespace lyx::support;
ControlChanges::ControlChanges(Dialog & parent)
: Dialog::Controller(parent)

View File

@ -21,6 +21,8 @@
#include "support/lyxalgo.h"
#include "support/lstrings.h"
using namespace lyx::support;
using std::vector;
using std::back_inserter;
using std::transform;

View File

@ -34,6 +34,8 @@
#include "support/lstrings.h"
#include "support/filetools.h"
using namespace lyx::support;
using std::endl;
@ -48,7 +50,7 @@ ControlDocument::~ControlDocument()
BufferParams & ControlDocument::params()
{
lyx::Assert(bp_.get());
Assert(bp_.get());
return *bp_;
}

View File

@ -24,6 +24,7 @@
#include "support/LAssert.h"
#include <vector>
using namespace lyx::support;
using std::vector;
@ -55,21 +56,21 @@ void ControlExternal::dispatchParams()
void ControlExternal::setParams(InsetExternal::Params const & p)
{
lyx::Assert(params_.get());
Assert(params_.get());
*params_ = p;
}
InsetExternal::Params const & ControlExternal::params() const
{
lyx::Assert(params_.get());
Assert(params_.get());
return *params_;
}
void ControlExternal::editExternal()
{
lyx::Assert(params_.get());
Assert(params_.get());
dialog().view().apply();
string const lfun = InsetExternalMailer::params2string(params());

View File

@ -21,6 +21,8 @@
#include <boost/bind.hpp>
using namespace lyx::support;
using std::vector;

View File

@ -32,6 +32,8 @@
#include "support/filetools.h"
#include "support/FileInfo.h"
using namespace lyx::support;
using std::pair;
using std::make_pair;
using std::vector;

View File

@ -23,6 +23,8 @@
#include <utility>
using namespace lyx::support;
using std::pair;

View File

@ -18,6 +18,7 @@
#include "support/lstrings.h"
#include "support/filetools.h"
using namespace lyx::support;
ControlMath::ControlMath(Dialog & dialog)
: Dialog::Controller(dialog)

View File

@ -20,6 +20,7 @@
#include "support/LAssert.h"
#include "Lsstream.h"
using namespace lyx::support;
ControlParagraph::ControlParagraph(Dialog & parent)
: Dialog::Controller(parent), ininset_(false)
@ -125,14 +126,14 @@ void ControlParagraph::dispatchParams()
ParagraphParameters & ControlParagraph::params()
{
lyx::Assert(params_.get());
Assert(params_.get());
return *params_;
}
ParagraphParameters const & ControlParagraph::params() const
{
lyx::Assert(params_.get());
Assert(params_.get());
return *params_;
}

View File

@ -30,6 +30,8 @@ extern string system_lyxdir;
extern string user_lyxdir;
extern BufferList bufferlist;
using namespace lyx::support;
using std::endl;
using std::pair;

View File

@ -30,7 +30,9 @@
#include "support/path.h"
#include "support/systemcall.h"
#include "debug.h" // for lyxerr
#include "debug.h"
using namespace lyx::support;
using std::endl;
@ -42,7 +44,7 @@ ControlPrint::ControlPrint(LyXView & lv, Dialogs & d)
PrinterParams & ControlPrint::params() const
{
lyx::Assert(params_);
Assert(params_);
return *params_;
}

View File

@ -19,6 +19,8 @@
#include "support/filetools.h" // MakeAbsPath, MakeDisplayPath
using namespace lyx::support;
using std::vector;
extern BufferList bufferlist;

View File

@ -24,6 +24,8 @@
#include "support/lstrings.h"
#include "support/systemcall.h"
using namespace lyx::support;
using std::vector;

View File

@ -13,6 +13,8 @@
#include "ControlShowFile.h"
#include "support/filetools.h"
using namespace lyx::support;
ControlShowFile::ControlShowFile(Dialog & parent)
: Dialog::Controller(parent)

View File

@ -33,6 +33,8 @@
#include "frontends/Alert.h"
using namespace lyx::support;
using std::endl;
@ -271,5 +273,3 @@ void ControlSpellchecker::ignoreAll()
speller_->accept(word_);
check();
}

View File

@ -17,6 +17,8 @@
#include "insets/insettabular.h"
#include "support/LAssert.h"
using namespace lyx::support;
ControlTabular::ControlTabular(Dialog & parent)
: Dialog::Controller(parent), active_cell_(-1)
@ -54,7 +56,7 @@ int ControlTabular::getActiveCell() const
LyXTabular const & ControlTabular::tabular() const
{
lyx::Assert(params_.get());
Assert(params_.get());
return *params_.get();
}

View File

@ -17,6 +17,8 @@
#include "support/lyxlib.h"
#include <fstream>
using namespace lyx::support;
using std::endl;
using std::ostream;
@ -48,5 +50,5 @@ void ControlVCLog::getVCLogFile(ostream & ss) const
if (!found)
ss << _("No version control log file found.") << endl;
lyx::unlink(name);
unlink(name);
}

View File

@ -18,6 +18,7 @@
#include "debug.h"
#include "support/LAssert.h"
using namespace lyx::support;
Dialog::Dialog(LyXView & lv, string const & name)
: is_closing_(false), kernel_(lv), name_(name),
@ -123,7 +124,7 @@ void Dialog::apply()
if (controller().disconnectOnApply() && !is_closing_) {
kernel().disconnect(name());
controller().initialiseParams(string());
controller().initialiseParams(string());
view().update();
}
}
@ -143,21 +144,21 @@ void Dialog::redraw()
ButtonController & Dialog::bc() const
{
lyx::Assert(bc_ptr_.get());
Assert(bc_ptr_.get());
return *bc_ptr_.get();
}
Dialog::Controller & Dialog::controller() const
{
lyx::Assert(controller_ptr_.get());
Assert(controller_ptr_.get());
return *controller_ptr_.get();
}
Dialog::View & Dialog::view() const
{
lyx::Assert(view_ptr_.get());
Assert(view_ptr_.get());
return *view_ptr_.get();
}
@ -176,13 +177,13 @@ string const & Dialog::View::getTitle() const
void Dialog::setController(Controller * i)
{
lyx::Assert(i && !controller_ptr_.get());
Assert(i && !controller_ptr_.get());
controller_ptr_.reset(i);
}
void Dialog::setView(View * v)
{
lyx::Assert(v && !view_ptr_.get());
Assert(v && !view_ptr_.get());
view_ptr_.reset(v);
}

View File

@ -14,6 +14,7 @@
#include "ControlButtons.h"
#include "support/LAssert.h"
using namespace lyx::support;
ViewBase::ViewBase(string const & t)
: controller_ptr_(0), title_(t)
@ -40,14 +41,14 @@ string const & ViewBase::getTitle() const
ControlButtons & ViewBase::getController()
{
lyx::Assert(controller_ptr_);
Assert(controller_ptr_);
return *controller_ptr_;
}
ControlButtons const & ViewBase::getController() const
{
lyx::Assert(controller_ptr_);
Assert(controller_ptr_);
return *controller_ptr_;
}

View File

@ -26,6 +26,8 @@
#include <algorithm>
using namespace lyx::support;
using std::vector;
@ -57,7 +59,7 @@ string const familyName(string const & name)
string const getAbbreviatedAuthor(InfoMap const & map, string const & key)
{
lyx::Assert(!map.empty());
Assert(!map.empty());
InfoMap::const_iterator it = map.find(key);
if (it == map.end())
@ -109,7 +111,7 @@ string const getAbbreviatedAuthor(InfoMap const & map, string const & key)
string const getYear(InfoMap const & map, string const & key)
{
lyx::Assert(!map.empty());
Assert(!map.empty());
InfoMap::const_iterator it = map.find(key);
if (it == map.end())
@ -173,7 +175,7 @@ vector<string> const getKeys(InfoMap const & map)
string const getInfo(InfoMap const & map, string const & key)
{
lyx::Assert(!map.empty());
Assert(!map.empty());
InfoMap::const_iterator it = map.find(key);
if (it == map.end())

View File

@ -21,6 +21,8 @@
#include "gettext.h" // _()
#include "frontends/Alert.h"
using namespace lyx::support;
using std::pair;
using std::vector;
using std::make_pair;

View File

@ -26,6 +26,8 @@
#include <fstream>
#include <algorithm>
using namespace lyx::support;
using std::vector;
using std::endl;
using std::sort;
@ -71,7 +73,7 @@ void getTexFileList(string const & filename, std::vector<string> & list)
std::vector<string>::iterator it = list.begin();
std::vector<string>::iterator end = list.end();
for (; it != end; ++it) {
*it = STRCONV(regex.Merge(it->c_str(), "/"));
*it = STRCONV(regex.Merge(STRCONV((*it)), "/"));
}
lyx::eliminate_duplicates(list);

View File

@ -27,6 +27,8 @@
#include <qpushbutton.h>
#include <qcombobox.h>
using namespace lyx::support;
BulletsModule::BulletsModule(QWidget * parent, const char * name, WFlags fl)
: BulletsModuleBase(parent, name, fl), tmpbulletset(0)
{
@ -238,7 +240,7 @@ void BulletsModule::setBullet(int level, const Bullet & bullet)
case 1: pb = bullet2PB; co = bulletsize2CO; break;
case 2: pb = bullet3PB; co = bulletsize3CO; break;
case 3: pb = bullet4PB; co = bulletsize4CO; break;
default: lyx::Assert(false); break;
default: Assert(false); break;
}
setBullet(pb, co, bullet);

View File

@ -1,3 +1,7 @@
2003-07-01 Lars Gullik Bjønnes <larsbj@gullik.net>
* introduce namespace lyx::support
2003-06-28 Lars Gullik Bjønnes <larsbj@gullik.net>
* QLPopupMenu.C: fix \file

View File

@ -24,6 +24,7 @@
#include <qfiledialog.h>
#include <qtoolbutton.h>
using namespace lyx::support;
namespace {

View File

@ -27,6 +27,8 @@
#include "Qt2BC.h"
#include "QAbout.h"
using namespace lyx::support;
using std::getline;
typedef QController<ControlAboutlyx, QView<QAboutDialog> > base_class;

View File

@ -32,6 +32,8 @@
#include "QBibtex.h"
#include "Qt2BC.h"
using namespace lyx::support;
using std::vector;
typedef QController<ControlBibtex, QView<QBibtexDialog> > base_class;

View File

@ -32,6 +32,7 @@
#include <vector>
using namespace lyx::support;
QBibtexDialog::QBibtexDialog(QBibtex * form)
: QBibtexDialogBase(0, 0, false, 0),

View File

@ -31,6 +31,7 @@
#include "support/lstrings.h"
#include "helper_funcs.h"
using namespace lyx::support;
using std::find;
using std::max;

View File

@ -29,6 +29,8 @@
#include "LString.h"
using namespace lyx::support;
using std::vector;
using std::endl;

View File

@ -52,6 +52,7 @@
#include <qslider.h>
#include "lengthcombo.h"
using namespace lyx::support;
QDocumentDialog::QDocumentDialog(QDocument * form)
: QDocumentDialogBase(0, 0, false, 0), form_(form)
@ -309,7 +310,7 @@ void QDocumentDialog::updateFontsize(string const & items, string const & sel)
textLayoutModule->fontsizeCO->clear();
textLayoutModule->fontsizeCO->insertItem("default");
for (int n=0; !token(items,'|',n).empty(); ++n)
for (int n = 0; !token(items,'|',n).empty(); ++n)
textLayoutModule->fontsizeCO->
insertItem(toqstr(token(items,'|',n)));

View File

@ -31,6 +31,8 @@
#include <vector>
using namespace lyx::support;
typedef QController<ControlExternal, QView<QExternalDialog> > base_class;

View File

@ -19,6 +19,7 @@
#include "support/tostr.h"
#include "support/FileInfo.h"
#include "support/filetools.h"
#include "support/lyxlib.h"
#include "insets/insetgraphicsParams.h"
#include "lyxrc.h"
#include "lengthcombo.h"
@ -40,6 +41,8 @@
#include "QGraphics.h"
#include "Qt2BC.h"
using namespace lyx::support;
using std::vector;
using std::endl;
@ -242,7 +245,7 @@ void QGraphics::update_contents()
for (int i = 0; i < num_units; i++)
dialog_->widthUnit->insertItem(unit_name_gui[i], -1);
if (!lyx::float_equal(igp.scale, 0.0, 0.05)) {
if (!float_equal(igp.scale, 0.0, 0.05)) {
// there is a scale value > 0.05
dialog_->width->setText(toqstr(tostr(igp.scale)));
dialog_->widthUnit->setCurrentItem(0);

View File

@ -27,6 +27,8 @@
#include <boost/tuple/tuple.hpp>
using namespace lyx::support;
using std::find_if;
using std::endl;

View File

@ -23,6 +23,8 @@
#include <boost/scoped_ptr.hpp>
using namespace lyx::support;
using std::endl;
using std::pair;
using std::make_pair;

View File

@ -26,6 +26,8 @@
#include <qcombobox.h>
#include <qlineedit.h>
using namespace lyx::support;
typedef QController<ControlMinipage, QView<QMinipageDialog> > base_class;

View File

@ -35,6 +35,8 @@
#include <functional>
using namespace lyx::support;
using std::vector;
using std::bind2nd;
using std::remove_if;

View File

@ -54,6 +54,8 @@
#include <qfontinfo.h>
#include "qcoloritem.h"
using namespace lyx::support;
using std::vector;
using std::pair;
using std::ostringstream;

View File

@ -25,6 +25,8 @@
#include <qpushbutton.h>
#include <qcheckbox.h>
using namespace lyx::support;
using std::vector;
typedef QController<ControlTexinfo, QView<QTexinfoDialog> > base_class;

View File

@ -26,6 +26,8 @@
#include "support/BoostFormat.h"
using namespace lyx::support;
typedef QController<ControlVCLog, QView<QVCLogDialog> > base_class;

View File

@ -28,6 +28,7 @@
#include <qcombobox.h>
#include <qlineedit.h>
using namespace lyx::support;
typedef QController<ControlWrap, QView<QWrapDialog> > base_class;

View File

@ -39,6 +39,8 @@
#include <qmenubar.h>
#include <qstatusbar.h>
using namespace lyx::support;
using std::endl;
namespace {

View File

@ -21,6 +21,8 @@
#include <qlayout.h>
#include <qgroupbox.h>
using namespace lyx::support;
// FIXME: set disabled doesn't work properly
FloatPlacement::FloatPlacement(QWidget * parent, char * name)

View File

@ -55,6 +55,8 @@
#include <fcntl.h>
#include <cstdlib>
using namespace lyx::support;
#ifndef CXX_GLOBAL_CSTD
using std::exit;
#endif

View File

@ -18,6 +18,8 @@
#include <qlayout.h>
#include <qlistview.h>
using namespace lyx::support;
using std::map;
@ -59,7 +61,7 @@ void PanelStack::addCategory(string const & n, string const & parent)
if (!parent.empty()) {
PanelMap::iterator it = panel_map_.find(parent);
lyx::Assert(it != panel_map_.end());
Assert(it != panel_map_.end());
QListViewItem * before = it->second->firstChild();
if (before) {
@ -108,7 +110,7 @@ void PanelStack::addPanel(QWidget * panel, string const & name, string const & p
void PanelStack::setCurrentPanel(string const & name)
{
PanelMap::const_iterator cit = panel_map_.find(name);
lyx::Assert(cit != panel_map_.end());
Assert(cit != panel_map_.end());
// force on first set
if (list_->currentItem() == cit->second)

View File

@ -35,6 +35,8 @@
#include "support/filetools.h"
#endif
using namespace lyx::support;
using std::endl;
using std::vector;
using std::pair;

View File

@ -42,6 +42,8 @@
#include <boost/bind.hpp>
#include <boost/signals/trackable.hpp>
using namespace lyx::support;
using std::min;
using std::max;
using std::endl;

View File

@ -1,3 +1,6 @@
2003-07-01 Lars Gullik Bjønnes <larsbj@gullik.net>
* introcude namespace lyx::support
2003-06-30 André Pönitz <poenitz@gmx.net>

View File

@ -22,6 +22,8 @@
#include <cmath>
using namespace lyx::support;
#ifndef CXX_GLOBAL_CSTD
using std::pow;
#endif

View File

@ -21,6 +21,7 @@
#include "support/lstrings.h"
#include <utility>
using namespace lyx::support;
using std::make_pair;
using std::pair;

View File

@ -23,6 +23,8 @@
#include <cmath> // abs()
using namespace lyx::support;
using std::endl;
using std::abs;
@ -134,14 +136,14 @@ void FontInfo::query()
string name(list[i]);
lyxerr[Debug::FONT] << "match #" << i << ' '
<< name << endl;
sizes[i] = lyx::atoi(token(name, '-', 7));
sizes[i] = atoi(token(name, '-', 7));
strings[i] = name;
if (sizes[i] == 0) {
if (scaleindex == -1) {
scaleindex = i;
}
scalable = true;
} else if (lyx::atoi(token(name, '-', 12)) == 0)
} else if (atoi(token(name, '-', 12)) == 0)
// Ignore bogus matches of scalable fonts.
sizes[i] = 0;
};

View File

@ -27,6 +27,8 @@
#include "lyx_forms.h"
using namespace lyx::support;
extern "C" {
#if FL_VERSION == 0 || (FL_REVISION == 0 && FL_FIXLEVEL == 0)
@ -123,7 +125,7 @@ void FormBase::show()
{
// build() is/should be called from the controller, so form() should
// always exist.
lyx::Assert(form());
Assert(form());
// we use minw_ to flag whether the dialog has ever been shown.
// In turn, prepare_to_show() initialises various bits 'n' pieces
@ -182,14 +184,14 @@ void FormBase::hide()
void FormBase::setPrehandler(FL_OBJECT * ob)
{
lyx::Assert(ob);
Assert(ob);
fl_set_object_prehandler(ob, C_PrehandlerCB);
}
void FormBase::setMessageWidget(FL_OBJECT * ob)
{
lyx::Assert(ob && ob->objclass == FL_TEXT);
Assert(ob && ob->objclass == FL_TEXT);
message_widget_ = ob;
fl_set_object_lsize(message_widget_, FL_NORMAL_SIZE);
}
@ -216,7 +218,7 @@ ButtonPolicy::SMInput FormBase::input(FL_OBJECT *, long)
// preemptive handler for feedback messages
void FormBase::MessageCB(FL_OBJECT * ob, int event)
{
lyx::Assert(ob);
Assert(ob);
switch (event) {
case FL_ENTER:
@ -243,7 +245,7 @@ void FormBase::MessageCB(FL_OBJECT * ob, int event)
void FormBase::PrehandlerCB(FL_OBJECT * ob, int event, int key)
{
lyx::Assert(ob);
Assert(ob);
if (ob->objclass == FL_INPUT && event == FL_PUSH && key == 2) {
// Trigger an input event when pasting in an xforms input object
@ -295,7 +297,7 @@ void FormBase::postWarning(string const & warning)
void FormBase::clearMessage()
{
lyx::Assert(message_widget_);
Assert(message_widget_);
warning_posted_ = false;
@ -312,10 +314,9 @@ void FormBase::clearMessage()
void FormBase::postMessage(string const & message)
{
lyx::Assert(message_widget_);
Assert(message_widget_);
int const width = message_widget_->w - 10;
string const tmp = warning_posted_ ?
bformat(_("WARNING! %1$s"), message) :
message;
@ -335,7 +336,7 @@ namespace {
FormBase * GetForm(FL_OBJECT * ob)
{
lyx::Assert(ob && ob->form && ob->form->u_vdata);
Assert(ob && ob->form && ob->form->u_vdata);
FormBase * ptr = static_cast<FormBase *>(ob->form->u_vdata);
return ptr;
}
@ -379,7 +380,7 @@ void C_FormBaseInputCB(FL_OBJECT * ob, long d)
static int C_WMHideCB(FL_FORM * form, void *)
{
// Close the dialog cleanly, even if the WM is used to do so.
lyx::Assert(form && form->u_vdata);
Assert(form && form->u_vdata);
FormBase * ptr = static_cast<FormBase *>(form->u_vdata);
ptr->getController().CancelButton();
return FL_CANCEL;
@ -390,7 +391,7 @@ static int C_PrehandlerCB(FL_OBJECT * ob, int event,
{
// Note that the return value is important in the pre-emptive handler.
// Don't return anything other than 0.
lyx::Assert(ob);
Assert(ob);
// Don't Assert this one, as it can happen quite naturally when things
// are being deleted in the d-tor.

View File

@ -20,6 +20,8 @@
#include "gettext.h"
#include "support/lstrings.h" // compare
using namespace lyx::support;
typedef FormController<ControlCommand, FormView<FD_bibitem> > base_class;
FormBibitem::FormBibitem(Dialog & parent)

View File

@ -27,6 +27,7 @@
#include "support/filetools.h"
#include "support/lyxalgo.h"
using namespace lyx::support;
using std::vector;
using std::sort;

View File

@ -9,9 +9,6 @@
* Full author contact details are available in file CREDITS
*/
#include <vector>
#include <config.h>
#include "xformsBC.h"
@ -29,6 +26,10 @@
#include "support/lstrings.h"
#include <vector>
using namespace lyx::support;
using std::vector;
using std::find;

View File

@ -10,8 +10,6 @@
*/
#include <config.h>
#include <algorithm>
#include "xformsBC.h"
#include "ControlCitation.h"
@ -27,6 +25,10 @@
#include "support/LAssert.h"
#include "support/lstrings.h"
#include <algorithm>
using namespace lyx::support;
using std::find;
using std::max;
using std::min;

View File

@ -28,6 +28,8 @@
#include "lyx_forms.h"
using namespace lyx::support;
extern "C" {
#if FL_VERSION == 0 || (FL_REVISION == 0 && FL_FIXLEVEL == 0)
@ -184,14 +186,14 @@ void FormDialogView::hide()
void FormDialogView::setPrehandler(FL_OBJECT * ob)
{
lyx::Assert(ob);
Assert(ob);
fl_set_object_prehandler(ob, C_PrehandlerCB);
}
void FormDialogView::setMessageWidget(FL_OBJECT * ob)
{
lyx::Assert(ob && ob->objclass == FL_TEXT);
Assert(ob && ob->objclass == FL_TEXT);
message_widget_ = ob;
fl_set_object_lsize(message_widget_, FL_NORMAL_SIZE);
}
@ -218,7 +220,7 @@ ButtonPolicy::SMInput FormDialogView::input(FL_OBJECT *, long)
// preemptive handler for feedback messages
void FormDialogView::MessageCB(FL_OBJECT * ob, int event)
{
lyx::Assert(ob);
Assert(ob);
switch (event) {
case FL_ENTER:
@ -245,7 +247,7 @@ void FormDialogView::MessageCB(FL_OBJECT * ob, int event)
void FormDialogView::PrehandlerCB(FL_OBJECT * ob, int event, int key)
{
lyx::Assert(ob);
Assert(ob);
if (ob->objclass == FL_INPUT && event == FL_PUSH && key == 2) {
// Trigger an input event when pasting in an xforms input
@ -297,7 +299,7 @@ void FormDialogView::postWarning(string const & warning)
void FormDialogView::clearMessage()
{
lyx::Assert(message_widget_);
Assert(message_widget_);
warning_posted_ = false;
@ -315,11 +317,9 @@ void FormDialogView::clearMessage()
#warning isnt this the same as in FormBase?
void FormDialogView::postMessage(string const & message)
{
lyx::Assert(message_widget_);
Assert(message_widget_);
int const width = message_widget_->w - 10;
string const tmp = warning_posted_ ?
bformat(_("WARNING! %1$s"), message) :
message;
@ -339,7 +339,7 @@ namespace {
FormDialogView * GetForm(FL_OBJECT * ob)
{
lyx::Assert(ob && ob->form && ob->form->u_vdata);
Assert(ob && ob->form && ob->form->u_vdata);
FormDialogView * ptr =
static_cast<FormDialogView *>(ob->form->u_vdata);
return ptr;
@ -384,7 +384,7 @@ void C_FormDialogView_InputCB(FL_OBJECT * ob, long d)
static int C_WMHideCB(FL_FORM * form, void *)
{
// Close the dialog cleanly, even if the WM is used to do so.
lyx::Assert(form && form->u_vdata);
Assert(form && form->u_vdata);
FormDialogView * ptr = static_cast<FormDialogView *>(form->u_vdata);
ptr->dialog().CancelButton();
return FL_CANCEL;
@ -395,7 +395,7 @@ static int C_PrehandlerCB(FL_OBJECT * ob, int event,
{
// Note that the return value is important in the pre-emptive handler.
// Don't return anything other than 0.
lyx::Assert(ob);
Assert(ob);
// Don't Assert this one, as it can happen quite naturally when things
// are being deleted in the d-tor.

View File

@ -44,6 +44,8 @@
#include <functional>
using namespace lyx::support;
using std::bind2nd;
using std::vector;

View File

@ -30,6 +30,8 @@
#include "support/lstrings.h"
#include "lyx_forms.h"
using namespace lyx::support;
typedef FormController<ControlExternal, FormView<FD_external> > base_class;
FormExternal::FormExternal(Dialog & parent)

View File

@ -61,6 +61,8 @@ using std::sort;
#include "forms/form_filedialog.h"
#include "lyx_forms.h"
using namespace lyx::support;
namespace {
// six months, in seconds
@ -196,7 +198,7 @@ void FileDialog::Private::Reread()
Alert::err_alert(_("Warning! Couldn't open directory."),
directory_);
#endif
directory_ = lyx::getcwd();
directory_ = getcwd();
dir = ::opendir(directory_.c_str());
}
@ -356,7 +358,7 @@ void FileDialog::Private::SetDirectory(string const & path)
{
string tmp;
if (path.empty())
tmp = lyx::getcwd();
tmp = getcwd();
else
tmp = MakeAbsPath(ExpandPath(path), directory_);

View File

@ -23,6 +23,8 @@
#include "support/lstrings.h"
#include "lyx_forms.h"
using namespace lyx::support;
namespace {
enum {

Some files were not shown because too many files have changed in this diff Show More