dnl we do not need that currently (and probably all our supported
dnl compiler allow that)
dnl LYX_CXX_PARTIAL
-LYX_CXX_EXPLICIT
+dnl LYX_CXX_EXPLICIT
LYX_CXX_GLOBAL_CSTD
-LYX_STD_COUNT
+dnl LYX_STD_COUNT
dnl we disable rtti for now
dnl LYX_CXX_RTTI
-AC_CHECK_HEADERS(ostream istream sstream locale limits ios)
-LYX_CXX_STL_MODERN_STREAMS
+dnl AC_CHECK_HEADERS(ostream istream sstream locale limits ios)
+dnl LYX_CXX_STL_MODERN_STREAMS
### and now some special lyx flags.
AC_ARG_ENABLE(assertions,
fi
### Library Files
-AC_CHECK_LIB(m, sin)
+dnl AC_CHECK_LIB(m, sin)
### Add extra directories to check for libraries.
LYX_WITH_DIR([extra-lib],[extra library directory],extra_lib, NONE)
#include <boost/filesystem/exception.hpp>
#include <boost/filesystem/operations.hpp>
+#include <algorithm>
#include <iomanip>
#include <stack>
#include <sstream>
} else
getLabelList(labels);
- if (lyx::count(labels.begin(), labels.end(), from) > 1)
+ if (std::count(labels.begin(), labels.end(), from) > 1)
return;
for (InsetIterator it = inset_iterator_begin(inset()); it; ++it) {
#include "frontends/alert.h"
#include "insets/InsetListingsParams.h"
-#include "support/lyxalgo.h" // for lyx::count
#include "support/convert.h"
#include "support/Translator.h"
#include <boost/array.hpp>
+#include <algorithm>
#include <sstream>
+using std::count;
using std::endl;
using std::string;
using std::istringstream;
lyxpreamble += "\\makeatother\n\n";
int const nlines =
- int(lyx::count(lyxpreamble.begin(), lyxpreamble.end(), '\n'));
+ int(count(lyxpreamble.begin(), lyxpreamble.end(), '\n'));
for (int j = 0; j != nlines; ++j) {
texrow.newline();
}
#include <boost/filesystem/operations.hpp>
+#include <algorithm>
+
using std::endl;
using std::string;
using std::vector;
str = substituteOptions(params, str, format);
// FIXME UNICODE
os << from_utf8(str);
- return int(lyx::count(str.begin(), str.end(),'\n'));
+ return int(std::count(str.begin(), str.end(),'\n'));
}
namespace {
#include "support/convert.h"
#include "support/filetools.h"
-#include "support/lyxalgo.h" // count
#include "support/lyxlib.h" // sum
#include "support/lstrings.h"
#include "support/os.h"
#include <boost/bind.hpp>
#include <boost/tuple/tuple.hpp>
+#include <algorithm>
#include <sstream>
LYXERR(Debug::GRAPHICS) << "InsetGraphics::latex outputting:\n"
<< latex_str << endl;
// Return how many newlines we issued.
- return int(lyx::count(latex_str.begin(), latex_str.end(),'\n'));
+ return int(std::count(latex_str.begin(), latex_str.end(),'\n'));
}
#include "MetricsInfo.h"
#include "OutputParams.h"
-#include "support/lyxalgo.h"
#include "support/Translator.h"
+#include <algorithm>
#include <sstream>
os << str;
runparams_in.encoding = runparams.encoding;
// Return how many newlines we issued.
- return int(lyx::count(str.begin(), str.end(), '\n'));
+ return int(std::count(str.begin(), str.end(), '\n'));
}
#include "MathExtern.h"
#include "MathStream.h"
-#include "support/lyxalgo.h"
#include "support/textutils.h"
+#include <algorithm>
namespace lyx {
using std::strlen;
-
-
//////////////////////////////////////////////////////////////////////
ws.pendingSpace(false);
}
ws.os() << s;
- ws.addlines(int(count(s, s + strlen(s), '\n')));
+ ws.addlines(int(std::count(s, s + strlen(s), '\n')));
return ws;
}
--- /dev/null
+#include "LaTeXStream.h"
+
+#include <iostream>
+#include <streambuf>
+
+namespace lyx {
+
+////////////////////////////////////////////////////////////////
+//
+// LaTeXStreamBuffer
+//
+////////////////////////////////////////////////////////////////
+
+
+class LaTeXStreamBuffer : public std::streambuf
+{
+public:
+ explicit LaTeXStreamBuffer(std::streambuf * sbuf);
+ int line() const { return line_; }
+
+protected:
+ int overflow(int);
+ int sync();
+
+private:
+ std::streambuf * sbuf_;
+ int line_;
+};
+
+
+LaTeXStreamBuffer::LaTeXStreamBuffer(std::streambuf *sb)
+ : sbuf_(sb), line_(0)
+{
+ setp(0, 0);
+ setg(0, 0, 0);
+}
+
+int LaTeXStreamBuffer::overflow(int c)
+{
+ if (c == '\n')
+ ++line_;
+ return c;
+}
+
+
+int LaTeXStreamBuffer::sync()
+{
+ sbuf_->pubsync();
+ return 0;
+}
+
+
+////////////////////////////////////////////////////////////////
+//
+// LaTeXStream
+//
+////////////////////////////////////////////////////////////////
+
+LaTeXStream::LaTeXStream(std::streambuf * sbuf)
+ : std::ostream(sbuf_ = new LaTeXStreamBuffer(sbuf))
+{}
+
+
+LaTeXStream::~LaTeXStream()
+{
+ delete sbuf_;
+}
+
+
+int LaTeXStream::line() const
+{
+ return sbuf_->line();
+}
+
+
+////////////////////////////////////////////////////////////////
+//
+// Test
+//
+////////////////////////////////////////////////////////////////
+
+#if 0
+
+int main(int argc, char *argv[])
+{
+ LaTeXStream out(std::cout.rdbuf());
+ char c;
+ while (std::cin) {
+ if (std::cin.get(c))
+ out.put(c);
+ }
+ std::cout << "line count: " << out.line() << std::endl;
+
+ return 0;
+}
+
+#endif
+
+}
gzstream.cpp \
gzstream.h \
kill.cpp \
+ LaTeXStream.cpp \
+ LaTeXStream.h \
limited_stack.h \
lstrings.cpp \
lstrings.h \
}
-/// A slot in replacement for std::count for systems where it is broken.
-template <class Iterator, class T>
-typename std::iterator_traits<Iterator>::difference_type
-count (Iterator first, Iterator last, T const & value)
-{
-#ifdef HAVE_STD_COUNT
- return std::count(first, last, value);
-#else
- typename std::iterator_traits<Iterator>::difference_type n = 0;
- while (first != last)
- if (*first++ == value) ++n;
- return n;
-#endif
-}
-
/// Remove all duplicate entries in c.
template<class C>
void eliminate_duplicates(C & c)