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

@ -58,7 +58,7 @@ basic_format<Ch, Tr> ::basic_format(const string_t& s, const std::locale & loc)
{
oss_.imbue( loc );
state0_.set_by_stream(oss_);
parse(s);
parse(s);
}
#endif //BOOST_NO_STD_LOCALE
@ -68,18 +68,18 @@ basic_format<Ch, Tr> ::basic_format(const string_t& s)
items_(), oss_(), exceptions_(io::all_error_bits)
{
state0_.set_by_stream(oss_);
parse(s);
parse(s);
}
template< class Ch, class Tr>
basic_format<Ch, Tr> :: basic_format(const basic_format& x)
: style_(x.style_), cur_arg_(x.cur_arg_), num_args_(x.num_args_), dumped_(false),
items_(x.items_), prefix_(x.prefix_), bound_(x.bound_),
: style_(x.style_), cur_arg_(x.cur_arg_), num_args_(x.num_args_), dumped_(false),
items_(x.items_), prefix_(x.prefix_), bound_(x.bound_),
oss_(), // <- we obviously can't copy x.oss_
state0_(x.state0_), exceptions_(x.exceptions_)
{
{
state0_.apply_on(oss_);
}
}
template< class Ch, class Tr>
basic_format<Ch, Tr>& basic_format<Ch, Tr> ::operator= (const basic_format& x)
@ -94,8 +94,8 @@ basic_format<Ch, Tr>& basic_format<Ch, Tr> ::operator= (const basic_format& x)
items_ = x.items_;
prefix_ = x.prefix_;
bound_=x.bound_;
style_=x.style_;
cur_arg_=x.cur_arg_;
style_=x.style_;
cur_arg_=x.cur_arg_;
num_args_=x.num_args_;
dumped_=x.dumped_;
return *this;
@ -103,17 +103,17 @@ basic_format<Ch, Tr>& basic_format<Ch, Tr> ::operator= (const basic_format& x)
template< class Ch, class Tr>
unsigned char basic_format<Ch,Tr> ::exceptions() const
unsigned char basic_format<Ch,Tr> ::exceptions() const
{
return exceptions_;
return exceptions_;
}
template< class Ch, class Tr>
unsigned char basic_format<Ch,Tr> ::exceptions(unsigned char newexcept)
{
unsigned char swp = exceptions_;
exceptions_ = newexcept;
return swp;
unsigned char basic_format<Ch,Tr> ::exceptions(unsigned char newexcept)
{
unsigned char swp = exceptions_;
exceptions_ = newexcept;
return swp;
}
@ -139,7 +139,7 @@ basic_format<Ch,Tr>& basic_format<Ch,Tr> ::clear()
}
template< class Ch, class Tr>
basic_format<Ch,Tr>& basic_format<Ch,Tr> ::clear_binds()
basic_format<Ch,Tr>& basic_format<Ch,Tr> ::clear_binds()
// cancel all bindings, and clear()
{
bound_.resize(0);
@ -148,10 +148,10 @@ basic_format<Ch,Tr>& basic_format<Ch,Tr> ::clear_binds()
}
template< class Ch, class Tr>
basic_format<Ch,Tr>& basic_format<Ch,Tr> ::clear_bind(int argN)
basic_format<Ch,Tr>& basic_format<Ch,Tr> ::clear_bind(int argN)
// cancel the binding of ONE argument, and clear()
{
if(argN<1 || argN > num_args_ || bound_.size()==0 || !bound_[argN-1] )
if(argN<1 || argN > num_args_ || bound_.size()==0 || !bound_[argN-1] )
{
if( exceptions() & io::out_of_range_bit )
boost::throw_exception(io::out_of_range()); // arg not in range.
@ -176,18 +176,18 @@ std::basic_string<Ch,Tr> basic_format<Ch,Tr> ::str() const
unsigned long sz = prefix_.size();
unsigned long i;
for(i=0; i < items_.size(); ++i)
for(i=0; i < items_.size(); ++i)
sz += items_[i].res_.size() + items_[i].appendix_.size();
string_t res;
res.reserve(sz);
res += prefix_;
for(i=0; i < items_.size(); ++i)
for(i=0; i < items_.size(); ++i)
{
const format_item_t& item = items_[i];
res += item.res_;
if( item.argN_ == format_item_t::argN_tabulation)
{
if( item.argN_ == format_item_t::argN_tabulation)
{
BOOST_ASSERT( item.pad_scheme_ & format_item_t::tabulation);
std::streamsize n = item.state_.width_ - res.size();
if( n > 0 )
@ -201,33 +201,33 @@ std::basic_string<Ch,Tr> basic_format<Ch,Tr> ::str() const
namespace io {
namespace detail {
template<class Ch, class Tr, class T>
basic_format<Ch, Tr>& bind_arg_body( basic_format<Ch, Tr>& self,
int argN,
template<class Ch, class Tr, class T>
basic_format<Ch, Tr>& bind_arg_body( basic_format<Ch, Tr>& self,
int argN,
const T& val)
// bind one argument to a fixed value
// this is persistent over clear() calls, thus also over str() and <<
{
if(self.dumped_) self.clear(); // needed, because we will modify cur_arg_..
if(argN<1 || argN > self.num_args_)
if(argN<1 || argN > self.num_args_)
{
if( self.exceptions() & io::out_of_range_bit )
boost::throw_exception(io::out_of_range()); // arg not in range.
else return self;
}
if(self.bound_.size()==0)
if(self.bound_.size()==0)
self.bound_.assign(self.num_args_,false);
else
else
BOOST_ASSERT( self.num_args_ == static_cast<signed int>(self.bound_.size()) );
int o_cur_arg = self.cur_arg_;
self.cur_arg_ = argN-1; // arrays begin at 0
self.bound_[self.cur_arg_]=false; // if already set, we unset and re-sets..
self.operator%(val); // put val at the right place, because cur_arg is set
// Now re-position cur_arg before leaving :
self.cur_arg_ = o_cur_arg;
self.cur_arg_ = o_cur_arg;
self.bound_[argN-1]=true;
if(self.cur_arg_ == argN-1 )
// hum, now this arg is bound, so move to next free arg
@ -239,16 +239,16 @@ basic_format<Ch, Tr>& bind_arg_body( basic_format<Ch, Tr>& self,
return self;
}
template<class Ch, class Tr, class T>
template<class Ch, class Tr, class T>
basic_format<Ch, Tr>& modify_item_body( basic_format<Ch, Tr>& self,
int itemN,
int itemN,
const T& manipulator)
// applies a manipulator to the format_item describing a given directive.
// this is a permanent change, clear or clear_binds won't cancel that.
{
if(itemN<1 || itemN >= static_cast<signed int>(self.items_.size() ))
if(itemN<1 || itemN >= static_cast<signed int>(self.items_.size() ))
{
if( self.exceptions() & io::out_of_range_bit )
if( self.exceptions() & io::out_of_range_bit )
boost::throw_exception(io::out_of_range()); // item not in range.
else return self;
}

View File

@ -32,21 +32,21 @@ namespace io {
namespace detail {
template<class Ch, class Stream> inline
bool wrap_isdigit(Ch c, Stream &os)
bool wrap_isdigit(Ch c, Stream &os)
{
#ifndef BOOST_NO_LOCALE_ISIDIGIT
return std::isdigit(c, os.rdbuf()->getloc() );
# else
using namespace std;
return isdigit(c);
#endif
return isdigit(c);
#endif
} //end- wrap_isdigit(..)
template<class Res, class Ch, class Tr> inline
Res str2int(const std::basic_string<Ch, Tr>& s,
typename std::basic_string<Ch, Tr>::size_type start,
Res str2int(const std::basic_string<Ch, Tr>& s,
typename std::basic_string<Ch, Tr>::size_type start,
BOOST_IO_STD basic_ios<Ch,Tr> &os,
const Res = Res(0) )
const Res = Res(0) )
// Input : char string, with starting index
// a basic_ios& merely to call its widen/narrow member function in the desired locale.
// Effects : reads s[start:] and converts digits into an integral n, of type Res
@ -64,7 +64,7 @@ namespace detail {
}
template<class Ch, class Tr>
void skip_asterisk(const std::basic_string<Ch,Tr> & buf,
void skip_asterisk(const std::basic_string<Ch,Tr> & buf,
typename std::basic_string<Ch,Tr>::size_type * pos_p,
BOOST_IO_STD basic_ios<Ch, Tr> &os)
// skip printf's "asterisk-fields" directives in the format-string buf
@ -92,7 +92,7 @@ namespace detail {
if(exceptions & io::bad_format_string_bit)
boost::throw_exception(io::bad_format_string());
}
template<class Ch, class Tr>
@ -104,15 +104,15 @@ namespace detail {
// Input : a 'printf-directive' in the format-string, starting at buf[ *pos_p ]
// a basic_ios& merely to call its widen/narrow member function in the desired locale.
// a bitset'excpetions' telling whether to throw exceptions on errors.
// Returns : true if parse somehow succeeded (possibly ignoring errors if exceptions disabled)
// Returns : true if parse somehow succeeded (possibly ignoring errors if exceptions disabled)
// false if it failed so bad that the directive should be printed verbatim
// Effects : - *pos_p is incremented so that buf[*pos_p] is the first char after the directive
// - *fpar is set with the parameters read in the directive
{
typedef format_item<Ch, Tr> format_item_t;
BOOST_ASSERT( pos_p != 0);
typename std::basic_string<Ch, Tr>::size_type &i1 = *pos_p,
i0;
typename std::basic_string<Ch, Tr>::size_type &i1 = *pos_p,
i0;
fpar->argN_ = format_item_t::argN_no_posit; // if no positional-directive
bool in_brackets=false;
@ -126,38 +126,38 @@ namespace detail {
}
// the flag '0' would be picked as a digit for argument order, but here it's a flag :
if(buf[i1]==os.widen('0'))
if(buf[i1]==os.widen('0'))
goto parse_flags;
// handle argument order (%2$d) or possibly width specification: %2d
i0 = i1; // save position before digits
while (i1 < buf.size() && wrap_isdigit(buf[i1], os))
++i1;
if (i1!=i0)
if (i1!=i0)
{
if( i1 >= buf.size() ) {
maybe_throw_exception(exceptions);
return false;
}
int n=str2int(buf,i0, os, int(0) );
// %N% case : this is already the end of the directive
if( buf[i1] == os.widen('%') )
if( buf[i1] == os.widen('%') )
{
fpar->argN_ = n-1;
++i1;
if( in_brackets)
maybe_throw_exception(exceptions);
if( in_brackets)
maybe_throw_exception(exceptions);
// but don't return. maybe "%" was used in lieu of '$', so we go on.
else return true;
}
if ( buf[i1]==os.widen('$') )
if ( buf[i1]==os.widen('$') )
{
fpar->argN_ = n-1;
++i1;
}
else
}
else
{
// non-positionnal directive
fpar->ref_state_.width_ = n;
@ -165,13 +165,13 @@ namespace detail {
goto parse_precision;
}
}
parse_flags:
parse_flags:
// handle flags
while ( i1 <buf.size()) // as long as char is one of + - = # 0 l h or ' '
{
{
// misc switches
switch (os.narrow(buf[i1], 0))
switch (os.narrow(buf[i1], 0))
{
case '\'' : break; // no effect yet. (painful to implement)
case 'l':
@ -190,7 +190,7 @@ namespace detail {
fpar->ref_state_.flags_ |= std::ios_base::showpos;
break;
case '0':
fpar->pad_scheme_ |= format_item_t::zeropad;
fpar->pad_scheme_ |= format_item_t::zeropad;
// need to know alignment before really setting flags,
// so just add 'zeropad' flag for now, it will be processed later.
break;
@ -204,7 +204,7 @@ namespace detail {
} // loop on flag.
if( i1>=buf.size()) {
maybe_throw_exception(exceptions);
return true;
return true;
}
parse_width:
@ -213,17 +213,17 @@ namespace detail {
i0 = i1; // save position before digits
while (i1<buf.size() && wrap_isdigit(buf[i1], os))
i1++;
if (i1!=i0)
if (i1!=i0)
{ fpar->ref_state_.width_ = str2int( buf,i0, os, std::streamsize(0) ); }
parse_precision:
if( i1>=buf.size()) {
if( i1>=buf.size()) {
maybe_throw_exception(exceptions);
return true;
}
// handle precision spec
if (buf[i1]==os.widen('.'))
if (buf[i1]==os.widen('.'))
{
++i1;
skip_asterisk(buf, &i1, os);
@ -233,25 +233,25 @@ namespace detail {
if(i1==i0)
fpar->ref_state_.precision_ = 0;
else
else
fpar->ref_state_.precision_ = str2int(buf,i0, os, std::streamsize(0) );
}
// handle formatting-type flags :
while( i1<buf.size() &&
while( i1<buf.size() &&
( buf[i1]==os.widen('l') || buf[i1]==os.widen('L') || buf[i1]==os.widen('h')) )
++i1;
if( i1>=buf.size()) {
maybe_throw_exception(exceptions);
return true;
}
if( in_brackets && buf[i1]==os.widen('|') )
if( in_brackets && buf[i1]==os.widen('|') )
{
++i1;
return true;
}
switch (os.narrow(buf[i1], 0) )
switch (os.narrow(buf[i1], 0) )
{
case 'X':
fpar->ref_state_.flags_ |= std::ios_base::uppercase;
@ -260,7 +260,7 @@ namespace detail {
fpar->ref_state_.flags_ &= ~std::ios_base::basefield;
fpar->ref_state_.flags_ |= std::ios_base::hex;
break;
case 'o':
fpar->ref_state_.flags_ &= ~std::ios_base::basefield;
fpar->ref_state_.flags_ |= std::ios_base::oct;
@ -275,7 +275,7 @@ namespace detail {
fpar->ref_state_.flags_ &= ~std::ios_base::basefield;
fpar->ref_state_.flags_ |= std::ios_base::dec;
break;
case 'f':
fpar->ref_state_.flags_ &= ~std::ios_base::floatfield;
fpar->ref_state_.flags_ |= std::ios_base::fixed;
@ -293,12 +293,12 @@ namespace detail {
else
fpar->ref_state_.fill_ = buf[i1];
fpar->pad_scheme_ |= format_item_t::tabulation;
fpar->argN_ = format_item_t::argN_tabulation;
fpar->argN_ = format_item_t::argN_tabulation;
break;
case 't':
case 't':
fpar->ref_state_.fill_ = os.widen(' ');
fpar->pad_scheme_ |= format_item_t::tabulation;
fpar->argN_ = format_item_t::argN_tabulation;
fpar->argN_ = format_item_t::argN_tabulation;
break;
case 'G':
@ -309,29 +309,29 @@ namespace detail {
fpar->ref_state_.flags_ |= std::ios_base::dec;
// CLEAR all floatield flags, so stream will CHOOSE
fpar->ref_state_.flags_ &= ~std::ios_base::floatfield;
fpar->ref_state_.flags_ &= ~std::ios_base::floatfield;
break;
case 'C':
case 'c':
case 'c':
fpar->truncate_ = 1;
break;
case 'S':
case 's':
case 's':
fpar->truncate_ = fpar->ref_state_.precision_;
fpar->ref_state_.precision_ = -1;
break;
case 'n' :
case 'n' :
fpar->argN_ = format_item_t::argN_ignored;
break;
default:
default:
maybe_throw_exception(exceptions);
}
++i1;
if( in_brackets )
{
if( i1<buf.size() && buf[i1]==os.widen('|') )
if( i1<buf.size() && buf[i1]==os.widen('|') )
{
++i1;
return true;
@ -349,19 +349,19 @@ namespace detail {
// format :: parse(..)
template<class Ch, class Traits>
void basic_format<Ch, Traits> ::parse(const string_t & buf)
void basic_format<Ch, Traits> ::parse(const string_t & buf)
// parse the format-string
{
using namespace std;
const Ch arg_mark = oss_.widen('%');
bool ordered_args=true;
bool ordered_args=true;
int max_argN=-1;
typename string_t::size_type i1=0;
int num_items=0;
// A: find upper_bound on num_items and allocates arrays
i1=0;
while( (i1=buf.find(arg_mark,i1)) != string::npos )
i1=0;
while( (i1=buf.find(arg_mark,i1)) != string_t::npos )
{
if( i1+1 >= buf.size() ) {
if(exceptions() & io::bad_format_string_bit)
@ -370,7 +370,7 @@ void basic_format<Ch, Traits> ::parse(const string_t & buf)
}
if(buf[i1+1] == buf[i1] ) { i1+=2; continue; } // escaped "%%" / "##"
++i1;
// in case of %N% directives, dont count it double (wastes allocations..) :
while(i1 < buf.size() && io::detail::wrap_isdigit(buf[i1],oss_)) ++i1;
if( i1 < buf.size() && buf[i1] == arg_mark ) ++ i1;
@ -378,28 +378,28 @@ void basic_format<Ch, Traits> ::parse(const string_t & buf)
++num_items;
}
items_.assign( num_items, format_item_t() );
// B: Now the real parsing of the format string :
num_items=0;
i1 = 0;
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_;
if( buf[i1+1] == buf[i1] ) // escaped mark, '%%'
{
piece += buf.substr(i0, i1-i0) + buf[i1];
piece += buf.substr(i0, i1-i0) + buf[i1];
i1+=2; i0=i1;
continue;
continue;
}
BOOST_ASSERT( static_cast<unsigned int>(cur_it) < items_.size() || cur_it==0);
if(i1!=i0) piece += buf.substr(i0, i1-i0);
++i1;
bool parse_ok;
parse_ok = io::detail::parse_printf_directive(buf, &i1, &items_[cur_it], oss_, exceptions());
if( ! parse_ok ) continue; // the directive will be printed verbatim
@ -418,12 +418,12 @@ void basic_format<Ch, Traits> ::parse(const string_t & buf)
++cur_it;
} // loop on %'s
BOOST_ASSERT(cur_it == num_items);
// store the final piece of string
string_t & piece = (cur_it==0) ? prefix_ : items_[cur_it-1].appendix_;
piece += buf.substr(i0);
if( !ordered_args)
if( !ordered_args)
{
if(max_argN >= 0 ) // dont mix positional with non-positionnal directives
{
@ -434,14 +434,14 @@ void basic_format<Ch, Traits> ::parse(const string_t & buf)
// set things like it would have been with positional directives :
int non_ordered_items = 0;
for(int i=0; i< num_items; ++i)
if(items_[i].argN_ == format_item_t::argN_no_posit)
if(items_[i].argN_ == format_item_t::argN_no_posit)
{
items_[i].argN_ = non_ordered_items;
++non_ordered_items;
}
max_argN = non_ordered_items-1;
}
// C: set some member data :
items_.resize(num_items);

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;
@ -168,7 +170,7 @@ bool BufferView::Pimpl::loadLyXFile(string const & filename, bool tolastfiles)
Buffer * b = bufferlist.newBuffer(s);
//attach to the error signal in the buffer
b->parseError.connect(boost::bind(&BufferView::Pimpl::addError,
b->parseError.connect(boost::bind(&BufferView::Pimpl::addError,
this, _1));
bool loaded = ::loadLyXFile(b, s);
@ -187,7 +189,7 @@ bool BufferView::Pimpl::loadLyXFile(string const & filename, bool tolastfiles)
else
return false;
}
}
buffer(b);
@ -358,7 +360,7 @@ int BufferView::Pimpl::resizeCurrentBuffer()
mark_set = bv_->text->selection.mark();
the_locking_inset = bv_->theLockingInset();
buffer_->resizeInsets(bv_);
// I don't think the delete and new are necessary here we
// I don't think the delete and new are necessary here we
// just could call only init! (Jug 20020419)
delete bv_->text;
bv_->text = new LyXText(bv_);
@ -720,7 +722,7 @@ void BufferView::Pimpl::restorePosition(unsigned int i)
b = bufferlist.newBuffer(fname);
::loadLyXFile(b, fname); // don't ask, just load it
}
if (b != 0)
if (b != 0)
buffer(b);
}

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;
@ -619,10 +621,10 @@ void expandPasteRecent(Menu & tomenu, LyXView const * view)
{
vector<string> const selL =
CutAndPaste::availableSelections(*view->buffer());
vector<string>::const_iterator cit = selL.begin();
vector<string>::const_iterator end = selL.end();
for (unsigned int index = 0; cit != end; ++cit, ++index) {
int const action = lyxaction.getPseudoAction(LFUN_PASTE,
tostr(index));
@ -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;
@ -236,9 +238,9 @@ string const ToolbarBackend::getIcon(int action)
<< fullname << '\'' << endl;
return fullname;
}
lyxerr[Debug::GUI] << "Cannot find icon for command \""
<< lyxaction.getActionName(f.action)
lyxerr[Debug::GUI] << "Cannot find icon for command \""
<< lyxaction.getActionName(f.action)
<< ' ' << f.argument << '"' << endl;
return LibFileSearch("images", "unknown", "xpm");
}

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);
}
}
}
@ -126,8 +128,8 @@ bool loadLyXFile(Buffer * b, string const & s)
b->lyxvc.file_found_hook(s);
return true;
}
break;
case -1:
break;
case -1:
string const file = MakeDisplayPath(s, 20);
// Here we probably should run
if (LyXVC::file_not_found_hook(s)) {
@ -150,7 +152,7 @@ bool loadLyXFile(Buffer * b, string const & s)
}
Buffer * newFile(string const & filename, string const & templatename,
Buffer * newFile(string const & filename, string const & templatename,
bool isNamed)
{
// get a free buffer
@ -198,7 +200,7 @@ Buffer * newFile(string const & filename, string const & templatename,
}
void parseErrors(Buffer const & buf, TeXErrors const & terr)
void parseErrors(Buffer const & buf, TeXErrors const & terr)
{
TeXErrors::Errors::const_iterator cit = terr.begin();
TeXErrors::Errors::const_iterator end = terr.end();
@ -217,12 +219,12 @@ void parseErrors(Buffer const & buf, TeXErrors const & terr)
}
void parseErrors(Buffer const & buf, ErrorList const & el)
void parseErrors(Buffer const & buf, ErrorList const & el)
{
ErrorList::const_iterator it = el.begin();
ErrorList::const_iterator end = el.end();
for (; it != end; ++it)
for (; it != end; ++it)
buf.parseError(*it);
}

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());
@ -129,7 +130,7 @@ ExternalTemplate const * getTemplatePtr(InsetExternal::Params const & params)
return 0;
return &templ;
}
} // namespace anon

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;
@ -302,7 +304,7 @@ void QPrefs::apply()
// FIXME: dubious, but it's what xforms does
if (qcol != ci->color()) {
ostringstream ostr;
ostr << '#' << std::setbase(16) << setfill('0')
<< setw(2) << ci->color().red()
<< setw(2) << ci->color().green()
@ -352,7 +354,7 @@ void setComboxFont(QComboBox * cb, string const & family, string const & foundry
// Bleh, default fonts, and the names couldn't be found. Hack
// for bug 1063. Qt makes baby Jesus cry.
QFont font;
if (family == lyx_gui::roman_font_name()) {
@ -501,7 +503,7 @@ void QPrefs::update_contents()
} else if (rc.isp_command == "hspell") {
spellmod->spellCommandCO->setCurrentItem(2);
}
if (rc.use_spell_lib) {
#if defined(USE_ASPELL) || defined(USE_PSPELL)
spellmod->spellCommandCO->setCurrentItem(3);

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;
@ -45,7 +47,7 @@ void QVCLog::build_dialog()
void QVCLog::update_contents()
{
setTitle(bformat(_("Version control log for %1$s"),
setTitle(bformat(_("Version control log for %1$s"),
controller().getBufferFileName()));
dialog_->vclogTV->setText("");

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;
@ -266,7 +268,7 @@ unsigned int LyXScreen::topCursorVisible(LyXText * text)
- row->baseline() - vheight;
} else {
// scroll down, the scroll region must be so big!!
newtop = cursor.y() - vheight / 2;
newtop = cursor.y() - vheight / 2;
}
} else if (static_cast<int>((cursor.y()) - row->baseline()) <

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
@ -158,7 +160,7 @@ GC LyXColorHandler::getGCForeground(LColor::color c)
lyxerr << bformat(
_(" Using closest allocated color with (r,g,b)=%1$s instead.\n"
"Pixel [%2$s] is used."),
"Pixel [%2$s] is used."),
tostr(cmap[closest_pixel]), tostr(closest_pixel)) << endl;
val.foreground = cmap[closest_pixel].pixel;

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_);

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