/Users/sts/Quellen/mac/dynmacro16/src/support/strfwd.h:42: error: 'namepace' does not name a type /Users/sts/Quellen/mac/dynmacro16/src/support/strfwd.h:49: error: 'char_type' was not declared in this scope /Users/sts/Quellen/mac/dynmacro16/src/support/strfwd.h:49: error: 'char_type' was not declared in this scope /Users/sts/Quellen/mac/dynmacro16/src/support/strfwd.h:49: error: template argument 1 is invalid /Users/sts/Quellen/mac/dynmacro16/src/support/strfwd.h:50: error: 'char_type' was not declared in this scope /Users/sts/Quellen/mac/dynmacro16/src/support/strfwd.h:50: error: template argument 1 is invalid /Users/sts/Quellen/mac/dynmacro16/src/support/strfwd.h:50: error: template argument 1 is invalid /Users/sts/Quellen/mac/dynmacro16/src/support/strfwd.h:50: error: template argument 2 is invalid /Users/sts/Quellen/mac/dynmacro16/src/support/strfwd.h:50: error: template argument 3 is invalid

Did I miss anything important?

Stefan

P.S.: I would be happy to have a compilable lyx tomorrow. Otherwise I am going to spend the time with troubleshooting the build process and not with the integration of my dynmacro patch :-/

Am 31.10.2007 um 23:40 schrieb [EMAIL PROTECTED]:

Author: poenitz
Date: Wed Oct 31 23:40:34 2007
New Revision: 21312

URL: http://www.lyx.org/trac/changeset/21312
Log:
introduce a header to forward declare std::string.
hope there are only conforming implementaions out there ;-}

Added:
    lyx-devel/trunk/src/support/strfwd.h
Modified:
    lyx-devel/trunk/src/BranchList.h
    lyx-devel/trunk/src/BufferView.h
    lyx-devel/trunk/src/Changes.h
    lyx-devel/trunk/src/Color.h
    lyx-devel/trunk/src/CutAndPaste.h
    lyx-devel/trunk/src/Encoding.cpp
    lyx-devel/trunk/src/ErrorList.h
    lyx-devel/trunk/src/LaTeXFeatures.h
    lyx-devel/trunk/src/Length.cpp
    lyx-devel/trunk/src/Length.h
    lyx-devel/trunk/src/Lexer.h
    lyx-devel/trunk/src/MetricsInfo.h
    lyx-devel/trunk/src/Paragraph.h
    lyx-devel/trunk/src/SpellBase.cpp
    lyx-devel/trunk/src/SpellBase.h
    lyx-devel/trunk/src/frontends/qt4/ColorCache.cpp
    lyx-devel/trunk/src/gettext.h
    lyx-devel/trunk/src/lengthcommon.cpp
    lyx-devel/trunk/src/lyxfind.h
    lyx-devel/trunk/src/support/ExceptionMessage.h
    lyx-devel/trunk/src/support/Makefile.am
    lyx-devel/trunk/src/support/docstring.cpp
    lyx-devel/trunk/src/support/docstring.h
    lyx-devel/trunk/src/support/lstrings.cpp
    lyx-devel/trunk/src/support/os.h
    lyx-devel/trunk/src/support/os_unix.cpp
    lyx-devel/trunk/src/support/textutils.h
    lyx-devel/trunk/src/support/types.h
    lyx-devel/trunk/src/support/unicode.cpp
    lyx-devel/trunk/src/support/unicode.h
    lyx-devel/trunk/src/support/userinfo.h

Modified: lyx-devel/trunk/src/BranchList.h
URL: http://www.lyx.org/trac/file/lyx-devel/trunk/src/BranchList.h? rev=21312 ====================================================================== ========
--- lyx-devel/trunk/src/BranchList.h (original)
+++ lyx-devel/trunk/src/BranchList.h Wed Oct 31 23:40:34 2007
@@ -31,6 +31,8 @@
 #define BRANCHES_H

 #include "Color.h"
+
+#include "support/docstring.h"

 #include <list>


Modified: lyx-devel/trunk/src/BufferView.h
URL: http://www.lyx.org/trac/file/lyx-devel/trunk/src/BufferView.h? rev=21312 ====================================================================== ========
--- lyx-devel/trunk/src/BufferView.h (original)
+++ lyx-devel/trunk/src/BufferView.h Wed Oct 31 23:40:34 2007
@@ -18,7 +18,7 @@
 #include "Dimension.h"
 #include "update_flags.h"

-#include "support/docstring.h"
+#include "support/strfwd.h"
 #include "support/types.h"

 #include <boost/noncopyable.hpp>

Modified: lyx-devel/trunk/src/Changes.h
URL: http://www.lyx.org/trac/file/lyx-devel/trunk/src/Changes.h? rev=21312 ====================================================================== ========
--- lyx-devel/trunk/src/Changes.h (original)
+++ lyx-devel/trunk/src/Changes.h Wed Oct 31 23:40:34 2007
@@ -16,6 +16,7 @@
 #define CHANGES_H

 #include "support/docstream.h"
+#include "support/types.h"
 #include "support/lyxtime.h"

 #include <vector>

Modified: lyx-devel/trunk/src/Color.h
URL: http://www.lyx.org/trac/file/lyx-devel/trunk/src/Color.h? rev=21312 ====================================================================== ========
--- lyx-devel/trunk/src/Color.h (original)
+++ lyx-devel/trunk/src/Color.h Wed Oct 31 23:40:34 2007
@@ -21,7 +21,7 @@

 #include "ColorCode.h"

-#include "support/docstring.h"
+#include "support/strfwd.h"

 #include <boost/scoped_ptr.hpp>


Modified: lyx-devel/trunk/src/CutAndPaste.h
URL: http://www.lyx.org/trac/file/lyx-devel/trunk/src/CutAndPaste.h? rev=21312 ====================================================================== ========
--- lyx-devel/trunk/src/CutAndPaste.h (original)
+++ lyx-devel/trunk/src/CutAndPaste.h Wed Oct 31 23:40:34 2007
@@ -14,8 +14,10 @@
 #ifndef CUTANDPASTE_H
 #define CUTANDPASTE_H

+#include "TextClass.h"
+
+#include "support/types.h"
 #include "support/docstring.h"
-#include "TextClass.h"

 #include <vector>


Modified: lyx-devel/trunk/src/Encoding.cpp
URL: http://www.lyx.org/trac/file/lyx-devel/trunk/src/Encoding.cpp? rev=21312 ====================================================================== ========
--- lyx-devel/trunk/src/Encoding.cpp (original)
+++ lyx-devel/trunk/src/Encoding.cpp Wed Oct 31 23:40:34 2007
@@ -22,6 +22,8 @@
 #include "support/FileName.h"
 #include "support/lstrings.h"
 #include "support/unicode.h"
+
+#include <boost/cstdint.hpp>

 #include <sstream>


Modified: lyx-devel/trunk/src/ErrorList.h
URL: http://www.lyx.org/trac/file/lyx-devel/trunk/src/ErrorList.h? rev=21312 ====================================================================== ========
--- lyx-devel/trunk/src/ErrorList.h (original)
+++ lyx-devel/trunk/src/ErrorList.h Wed Oct 31 23:40:34 2007
@@ -12,6 +12,7 @@
 #ifndef ERRORLIST_H
 #define ERRORLIST_H

+#include "support/types.h"
 #include "support/docstring.h"

 #include <vector>

Modified: lyx-devel/trunk/src/LaTeXFeatures.h
URL: http://www.lyx.org/trac/file/lyx-devel/trunk/src/ LaTeXFeatures.h?rev=21312 ====================================================================== ========
--- lyx-devel/trunk/src/LaTeXFeatures.h (original)
+++ lyx-devel/trunk/src/LaTeXFeatures.h Wed Oct 31 23:40:34 2007
@@ -12,7 +12,6 @@

 #ifndef LATEXFEATURES_H
 #define LATEXFEATURES_H
-

 #include "OutputParams.h"
 #include "support/docstring.h"
@@ -125,7 +124,7 @@
        ///
        UsedFloats usedFloats_;
        ///
-       typedef std::map<docstring , std::string> FileMap;
+       typedef std::map<docstring, std::string> FileMap;
        ///
        FileMap IncludedFiles_;
        /** Buffer of the file being processed.

Modified: lyx-devel/trunk/src/Length.cpp
URL: http://www.lyx.org/trac/file/lyx-devel/trunk/src/Length.cpp? rev=21312 ====================================================================== ========
--- lyx-devel/trunk/src/Length.cpp (original)
+++ lyx-devel/trunk/src/Length.cpp Wed Oct 31 23:40:34 2007
@@ -59,6 +59,13 @@
 }


+void Length::swap(Length & rhs)
+{
+       std::swap(val_, rhs.val_);
+       std::swap(unit_, rhs.unit_);
+}
+
+
 string const Length::asString() const
 {
        ostringstream os;

Modified: lyx-devel/trunk/src/Length.h
URL: http://www.lyx.org/trac/file/lyx-devel/trunk/src/Length.h? rev=21312 ====================================================================== ========
--- lyx-devel/trunk/src/Length.h (original)
+++ lyx-devel/trunk/src/Length.h Wed Oct 31 23:40:34 2007
@@ -15,7 +15,7 @@
 #ifndef LENGTH_H
 #define LENGTH_H

-#include "support/docstring.h"
+#include "support/strfwd.h"


 namespace lyx {
@@ -67,12 +67,8 @@
        /// "data" must be a decimal number, followed by a unit
        explicit Length(std::string const & data);

-       void swap(Length & rhs)
-       {
-               std::swap(val_, rhs.val_);
-               std::swap(unit_, rhs.unit_);
-       }
-
+       ///
+       void swap(Length & rhs);
        ///
        double value() const;
        ///
@@ -100,7 +96,7 @@

 private:
        ///
-       double          val_;
+       double val_;
        ///
        Length::UNIT unit_;
 };

Modified: lyx-devel/trunk/src/Lexer.h
URL: http://www.lyx.org/trac/file/lyx-devel/trunk/src/Lexer.h? rev=21312 ====================================================================== ========
--- lyx-devel/trunk/src/Lexer.h (original)
+++ lyx-devel/trunk/src/Lexer.h Wed Oct 31 23:40:34 2007
@@ -17,9 +17,7 @@
 #ifndef LEXER_H
 #define LEXER_H

-#include "support/docstring.h"
-
-#include <boost/noncopyable.hpp>
+#include "support/strfwd.h"

 #include <iosfwd>

@@ -55,7 +53,7 @@

     @see LyXRC.cpp for an example of usage.
   */
-class Lexer : boost::noncopyable {
+class Lexer {
 public:
        ///
        Lexer(keyword_item *, int);
@@ -175,6 +173,11 @@
        static std::string const quoteString(std::string const &);

 private:
+       /// noncopiable
+       Lexer(Lexer const &);
+       void operator=(Lexer const &);
+
+       ///
        class Pimpl;
        ///
        Pimpl * pimpl_;

Modified: lyx-devel/trunk/src/MetricsInfo.h
URL: http://www.lyx.org/trac/file/lyx-devel/trunk/src/MetricsInfo.h? rev=21312 ====================================================================== ========
--- lyx-devel/trunk/src/MetricsInfo.h (original)
+++ lyx-devel/trunk/src/MetricsInfo.h Wed Oct 31 23:40:34 2007
@@ -14,7 +14,10 @@

 #include "ColorCode.h"
 #include "FontInfo.h"
-#include "support/docstring.h"
+
+#include "support/strfwd.h"
+#include "support/types.h"
+
 #include <string>

 class BufferView;

Modified: lyx-devel/trunk/src/Paragraph.h
URL: http://www.lyx.org/trac/file/lyx-devel/trunk/src/Paragraph.h? rev=21312 ====================================================================== ========
--- lyx-devel/trunk/src/Paragraph.h (original)
+++ lyx-devel/trunk/src/Paragraph.h Wed Oct 31 23:40:34 2007
@@ -21,7 +21,8 @@

 #include "insets/InsetCode.h"

-#include "support/docstring.h"
+#include "support/strfwd.h"
+#include "support/types.h"
 // FIXME: would be nice to forward declare odocstream instead of
 // including this:
 #include "support/docstream.h"

Modified: lyx-devel/trunk/src/SpellBase.cpp
URL: http://www.lyx.org/trac/file/lyx-devel/trunk/src/SpellBase.cpp? rev=21312 ====================================================================== ========
--- lyx-devel/trunk/src/SpellBase.cpp (original)
+++ lyx-devel/trunk/src/SpellBase.cpp Wed Oct 31 23:40:34 2007
@@ -13,6 +13,7 @@

 #include "SpellBase.h"
 #include "gettext.h"
+#include "support/docstring.h"


 namespace lyx {

Modified: lyx-devel/trunk/src/SpellBase.h
URL: http://www.lyx.org/trac/file/lyx-devel/trunk/src/SpellBase.h? rev=21312 ====================================================================== ========
--- lyx-devel/trunk/src/SpellBase.h (original)
+++ lyx-devel/trunk/src/SpellBase.h Wed Oct 31 23:40:34 2007
@@ -13,7 +13,7 @@
 #ifndef SPELL_BASE_H
 #define SPELL_BASE_H

-#include "support/docstring.h"
+#include "support/strfwd.h"


 namespace lyx {

Modified: lyx-devel/trunk/src/frontends/qt4/ColorCache.cpp
URL: http://www.lyx.org/trac/file/lyx-devel/trunk/src/frontends/qt4/ ColorCache.cpp?rev=21312 ====================================================================== ========
--- lyx-devel/trunk/src/frontends/qt4/ColorCache.cpp (original)
+++ lyx-devel/trunk/src/frontends/qt4/ColorCache.cpp Wed Oct 31 23:40:34 2007
@@ -13,6 +13,8 @@
 #include "ColorCache.h"

 #include "Color.h"
+
+#include <string>

 namespace lyx {


Modified: lyx-devel/trunk/src/gettext.h
URL: http://www.lyx.org/trac/file/lyx-devel/trunk/src/gettext.h? rev=21312 ====================================================================== ========
--- lyx-devel/trunk/src/gettext.h (original)
+++ lyx-devel/trunk/src/gettext.h Wed Oct 31 23:40:34 2007
@@ -13,7 +13,7 @@
 #ifndef GETTEXT_H
 #define GETTEXT_H

-#include "support/docstring.h"
+#include "support/strfwd.h"


 namespace lyx {

Modified: lyx-devel/trunk/src/lengthcommon.cpp
URL: http://www.lyx.org/trac/file/lyx-devel/trunk/src/ lengthcommon.cpp?rev=21312 ====================================================================== ========
--- lyx-devel/trunk/src/lengthcommon.cpp (original)
+++ lyx-devel/trunk/src/lengthcommon.cpp Wed Oct 31 23:40:34 2007
@@ -13,8 +13,9 @@
 #include <config.h>

 #include "Length.h"
+#include "gettext.h"

-#include "gettext.h"
+#include <string>


 namespace lyx {

Modified: lyx-devel/trunk/src/lyxfind.h
URL: http://www.lyx.org/trac/file/lyx-devel/trunk/src/lyxfind.h? rev=21312 ====================================================================== ========
--- lyx-devel/trunk/src/lyxfind.h (original)
+++ lyx-devel/trunk/src/lyxfind.h Wed Oct 31 23:40:34 2007
@@ -15,7 +15,7 @@
 #ifndef LYXFIND_H
 #define LYXFIND_H

-#include "support/docstring.h"
+#include "support/strfwd.h"

 namespace lyx {


Modified: lyx-devel/trunk/src/support/ExceptionMessage.h
URL: http://www.lyx.org/trac/file/lyx-devel/trunk/src/support/ ExceptionMessage.h?rev=21312 ====================================================================== ========
--- lyx-devel/trunk/src/support/ExceptionMessage.h (original)
+++ lyx-devel/trunk/src/support/ExceptionMessage.h Wed Oct 31 23:40:34 2007
@@ -34,7 +34,7 @@
        ExceptionMessage(ExceptionType type, docstring const & title,
                docstring const & details)
        : type_(type), title_(title), details_(details),
-         message_(to_utf8(title_ + '\n' + details_)) {}
+ message_(to_utf8(title_ + docstring::value_type('\n') + details_)) {}

virtual const char * what() const throw() { return message_.c_str (); }
        virtual ~ExceptionMessage() throw() {}

Modified: lyx-devel/trunk/src/support/Makefile.am
URL: http://www.lyx.org/trac/file/lyx-devel/trunk/src/support/ Makefile.am?rev=21312 ====================================================================== ========
--- lyx-devel/trunk/src/support/Makefile.am (original)
+++ lyx-devel/trunk/src/support/Makefile.am Wed Oct 31 23:40:34 2007
@@ -77,6 +77,7 @@
        rename.cpp \
        socktools.cpp \
        socktools.h \
+       strfwd.h \
        std_istream.h \
        std_ostream.h \
        Systemcall.cpp \

Modified: lyx-devel/trunk/src/support/docstring.cpp
URL: http://www.lyx.org/trac/file/lyx-devel/trunk/src/support/ docstring.cpp?rev=21312 ====================================================================== ========
--- lyx-devel/trunk/src/support/docstring.cpp (original)
+++ lyx-devel/trunk/src/support/docstring.cpp Wed Oct 31 23:40:34 2007
@@ -194,7 +194,9 @@
 lyx::docstring operator+(lyx::docstring const & l, char r)
 {
        BOOST_ASSERT(static_cast<unsigned char>(r) < 0x80);
-       return l + lyx::docstring::value_type(r);
+       docstring s = l;
+       s += docstring::value_type(r);
+       return s;
 }



Modified: lyx-devel/trunk/src/support/docstring.h
URL: http://www.lyx.org/trac/file/lyx-devel/trunk/src/support/ docstring.h?rev=21312 ====================================================================== ========
--- lyx-devel/trunk/src/support/docstring.h (original)
+++ lyx-devel/trunk/src/support/docstring.h Wed Oct 31 23:40:34 2007
@@ -13,7 +13,7 @@
 #ifndef LYX_DOCSTRING_H
 #define LYX_DOCSTRING_H

-#include "support/types.h"
+#include "support/strfwd.h"

 #include <string>

@@ -21,70 +21,6 @@

 /// String type for storing the main text in UCS4 encoding
 typedef std::basic_string<char_type> docstring;
-
-/// Creates a docstring from a C string of ASCII characters
-docstring const from_ascii(char const *);
-
-/// Creates a docstring from a std::string of ASCII characters
-docstring const from_ascii(std::string const &);
-
-/// Creates a std::string of ASCII characters from a docstring
-std::string const to_ascii(docstring const &);
-
-/// Creates a docstring from a UTF8 string. This should go eventually.
-docstring const from_utf8(std::string const &);
-
-/// Creates a UTF8 string from a docstring. This should go eventually.
-std::string const to_utf8(docstring const &);
-
-/// convert \p s from the encoding of the locale to ucs4.
-docstring const from_local8bit(std::string const & s);
-
-/**
- * Convert \p s from ucs4 to the encoding of the locale.
- * This may fail and throw an exception, the caller is expected to act
- * appropriately.
- */
-std::string const to_local8bit(docstring const & s);
-
-/// convert \p s from the encoding of the file system to ucs4.
-docstring const from_filesystem8bit(std::string const & s);
-
-/// convert \p s from ucs4 to the encoding of the file system.
-std::string const to_filesystem8bit(docstring const & s);
-
-/// normalize \p s to precomposed form c
-docstring const normalize_c(docstring const & s);
-
-/// Compare a docstring with a C string of ASCII characters
-bool operator==(lyx::docstring const &, char const *);
-
-/// Compare a C string of ASCII characters with a docstring
-inline bool operator==(char const * l, lyx::docstring const & r) { return r == l; }
-
-/// Compare a docstring with a C string of ASCII characters
-inline bool operator!=(lyx::docstring const & l, char const * r) { return !(l == r); }
-
-/// Compare a C string of ASCII characters with a docstring
-inline bool operator!=(char const * l, lyx::docstring const & r) { return !(r == l); }
-
-/// Concatenate a docstring and a C string of ASCII characters
-lyx::docstring operator+(lyx::docstring const &, char const *);
-
-/// Concatenate a C string of ASCII characters and a docstring
-lyx::docstring operator+(char const *, lyx::docstring const &);
-
-/// Concatenate a docstring and a single ASCII character
-lyx::docstring operator+(lyx::docstring const & l, char r);
-
-/// Concatenate a single ASCII character and a docstring
-lyx::docstring operator+(char l, lyx::docstring const & r);
-
-/// Append a C string of ASCII characters to a docstring
-lyx::docstring & operator+=(lyx::docstring &, char const *);
-
-/// Append a single ASCII character to a docstring
-lyx::docstring & operator+=(lyx::docstring & l, char r);

 } // namespace lyx


Modified: lyx-devel/trunk/src/support/lstrings.cpp
URL: http://www.lyx.org/trac/file/lyx-devel/trunk/src/support/ lstrings.cpp?rev=21312 ====================================================================== ========
--- lyx-devel/trunk/src/support/lstrings.cpp (original)
+++ lyx-devel/trunk/src/support/lstrings.cpp Wed Oct 31 23:40:34 2007
@@ -518,6 +518,19 @@
        return tmp;
 }

+/// Substitute all \a oldchar with \a newchar
+docstring const subst_char(docstring const & a,
+       docstring::value_type oldchar, docstring::value_type newchar)
+{
+       docstring tmp(a);
+       docstring::iterator lit = tmp.begin();
+       docstring::iterator end = tmp.end();
+       for (; lit != end; ++lit)
+               if ((*lit) == oldchar)
+                       (*lit) = newchar;
+       return tmp;
+}
+

 /// substitutes all instances of \a oldstr with \a newstr
 template<typename String> inline
@@ -536,6 +549,21 @@
        return lstr;
 }

+docstring const subst_string(docstring const & a,
+               docstring const & oldstr, docstring const & newstr)
+{
+       BOOST_ASSERT(!oldstr.empty());
+       docstring lstr = a;
+       docstring::size_type i = 0;
+       docstring::size_type const olen = oldstr.length();
+       while ((i = lstr.find(oldstr, i)) != string::npos) {
+               lstr.replace(i, olen, newstr);
+               i += newstr.length(); // We need to be sure that we dont
+               // use the same i over and over again.
+       }
+       return lstr;
+}
+
 }


@@ -670,6 +698,25 @@
        if (i == a.length() - 1) {
                piece = a.substr(0, i);
        } else if (i != String::npos) {
+               piece = a.substr(0, i);
+               tmp = a.substr(i + 1);
+       } else if (i == 0) {
+               piece.erase();
+               tmp = a.substr(i + 1);
+       } else {
+               piece = a;
+       }
+       return tmp;
+}
+
+template<typename Char> inline
+docstring const doSplit(docstring const & a, docstring & piece, Char delim)
+{
+       docstring tmp;
+       typename docstring::size_type i = a.find(delim);
+       if (i == a.length() - 1) {
+               piece = a.substr(0, i);
+       } else if (i != docstring::npos) {
                piece = a.substr(0, i);
                tmp = a.substr(i + 1);
        } else if (i == 0) {

Modified: lyx-devel/trunk/src/support/os.h
URL: http://www.lyx.org/trac/file/lyx-devel/trunk/src/support/os.h? rev=21312 ====================================================================== ========
--- lyx-devel/trunk/src/support/os.h (original)
+++ lyx-devel/trunk/src/support/os.h Wed Oct 31 23:40:34 2007
@@ -14,7 +14,8 @@
 #ifndef OS_H
 #define OS_H

-#include "support/docstring.h"
+#include "support/strfwd.h"
+#include <cstddef>


 namespace lyx {
@@ -43,7 +44,7 @@

 /// Extract the path common to both @c p1 and @c p2. DBCS aware!
 /// \p p1, \p p2 and the return value are encoded in utf8.
-docstring::size_type common_path(docstring const & p1, docstring const & p2);
+std::size_t common_path(docstring const & p1, docstring const & p2);

 /// Converts a unix style path to host OS style.
 /// \p p and the return value are encoded in utf8.

Modified: lyx-devel/trunk/src/support/os_unix.cpp
URL: http://www.lyx.org/trac/file/lyx-devel/trunk/src/support/ os_unix.cpp?rev=21312 ====================================================================== ========
--- lyx-devel/trunk/src/support/os_unix.cpp (original)
+++ lyx-devel/trunk/src/support/os_unix.cpp Wed Oct 31 23:40:34 2007
@@ -13,6 +13,7 @@
 #include <config.h>

 #include "support/os.h"
+#include "support/docstring.h"

 #ifdef __APPLE__
 #include <Carbon/Carbon.h>

Added: lyx-devel/trunk/src/support/strfwd.h
URL: http://www.lyx.org/trac/file/lyx-devel/trunk/src/support/ strfwd.h?rev=21312 ====================================================================== ========
--- lyx-devel/trunk/src/support/strfwd.h (added)
+++ lyx-devel/trunk/src/support/strfwd.h Wed Oct 31 23:40:34 2007
@@ -1,0 +1,118 @@
+// -*- C++ -*-
+
+// Heavily inspired by /usr/include/c++/4.1/bits
+//
+// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+#ifndef STRFWD_H
+#define STRFWD_H
+
+namespace std {
+
+template<typename Char> struct char_traits;
+template<> struct char_traits<char>;
+template<> struct char_traits<wchar_t>;
+
+template<typename Alloc> class allocator;
+
+template<typename Char, typename Traits, typename Alloc> class basic_string;
+
+typedef basic_string<char, char_traits<char>, allocator<char> > string;
+
+}
+
+
+#ifdef USE_WCHAR_T
+
+// Prefer this if possible because GNU libstdc++ has usable
+// std::ctype<wchar_t> locale facets but not
+// std::ctype<boost::uint32_t>. gcc older than 3.4 is also missing
+// usable std::char_traits<boost::uint32_t>.
+namespace lyx { typedef wchar_t char_type; }
+
+#else
+
+#include <boost/cstdint.hpp>
+namepace lyx { typedef boost::uint32_t char_type; }
+
+#endif
+
+
+namespace lyx {
+
+typedef std::basic_string<char_type, std::char_traits<char_type>,
+       std::allocator<char_type> > docstring;
+
+/// Creates a docstring from a C string of ASCII characters
+docstring const from_ascii(char const *);
+
+/// Creates a docstring from a std::string of ASCII characters
+docstring const from_ascii(std::string const &);
+
+/// Creates a std::string of ASCII characters from a docstring
+std::string const to_ascii(docstring const &);
+
+/// Creates a docstring from a UTF8 string. This should go eventually.
+docstring const from_utf8(std::string const &);
+
+/// Creates a UTF8 string from a docstring. This should go eventually.
+std::string const to_utf8(docstring const &);
+
+/// convert \p s from the encoding of the locale to ucs4.
+docstring const from_local8bit(std::string const & s);
+
+/**
+ * Convert \p s from ucs4 to the encoding of the locale.
+ * This may fail and throw an exception, the caller is expected to act
+ * appropriately.
+ */
+std::string const to_local8bit(docstring const & s);
+
+/// convert \p s from the encoding of the file system to ucs4.
+docstring const from_filesystem8bit(std::string const & s);
+
+/// convert \p s from ucs4 to the encoding of the file system.
+std::string const to_filesystem8bit(docstring const & s);
+
+/// normalize \p s to precomposed form c
+docstring const normalize_c(docstring const & s);
+
+/// Compare a docstring with a C string of ASCII characters
+bool operator==(docstring const &, char const *);
+
+/// Compare a C string of ASCII characters with a docstring
+inline bool operator==(char const * l, docstring const & r) { return r == l; }
+
+/// Compare a docstring with a C string of ASCII characters
+inline bool operator!=(docstring const & l, char const * r) { return !(l == r); }
+
+/// Compare a C string of ASCII characters with a docstring
+inline bool operator!=(char const * l, docstring const & r) { return !(r == l); }
+
+/// Concatenate a docstring and a C string of ASCII characters
+docstring operator+(docstring const &, char const *);
+
+/// Concatenate a C string of ASCII characters and a docstring
+docstring operator+(char const *, docstring const &);
+
+/// Concatenate a docstring and a single ASCII character
+docstring operator+(docstring const & l, char r);
+
+/// Concatenate a single ASCII character and a docstring
+docstring operator+(char l, docstring const & r);
+
+/// Append a C string of ASCII characters to a docstring
+docstring & operator+=(docstring &, char const *);
+
+/// Append a single ASCII character to a docstring
+docstring & operator+=(docstring & l, char r);
+
+} // namespace lyx
+
+#endif

Modified: lyx-devel/trunk/src/support/textutils.h
URL: http://www.lyx.org/trac/file/lyx-devel/trunk/src/support/ textutils.h?rev=21312 ====================================================================== ========
--- lyx-devel/trunk/src/support/textutils.h (original)
+++ lyx-devel/trunk/src/support/textutils.h Wed Oct 31 23:40:34 2007
@@ -15,17 +15,13 @@
 #ifndef TEXTUTILS_H
 #define TEXTUTILS_H

-#include "support/types.h"
+#include "support/strfwd.h"


 namespace lyx {

 /// return true if the char is a line separator
-inline
-bool isLineSeparatorChar(char_type c)
-{
-       return c == ' ';
-}
+inline bool isLineSeparatorChar(char_type c) { return c == ' '; }

 /// return true if a char is alphabetical (including accented chars)
 bool isLetterChar(char_type c);

Modified: lyx-devel/trunk/src/support/types.h
URL: http://www.lyx.org/trac/file/lyx-devel/trunk/src/support/ types.h?rev=21312 ====================================================================== ========
--- lyx-devel/trunk/src/support/types.h (original)
+++ lyx-devel/trunk/src/support/types.h Wed Oct 31 23:40:34 2007
@@ -16,22 +16,9 @@
 #ifndef LYX_TYPES_H
 #define LYX_TYPES_H

-#include <boost/cstdint.hpp>
-
 #include <cstddef>

 namespace lyx {
-
-       /// The type used to hold characters in paragraphs
-#ifdef USE_WCHAR_T
-       // Prefer this if possible because GNU libstdc++ has usable
-       // std::ctype<wchar_t> locale facets but not
-       // std::ctype<boost::uint32_t>. gcc older than 3.4 is also missing
-       // usable std::char_traits<boost::uint32_t>.
-       typedef wchar_t char_type;
-#else
-       typedef boost::uint32_t char_type;
-#endif

        /// a type for positions used in paragraphs
// needs to be signed for a while to hold the special value -1 that is

Modified: lyx-devel/trunk/src/support/unicode.cpp
URL: http://www.lyx.org/trac/file/lyx-devel/trunk/src/support/ unicode.cpp?rev=21312 ====================================================================== ========
--- lyx-devel/trunk/src/support/unicode.cpp (original)
+++ lyx-devel/trunk/src/support/unicode.cpp Wed Oct 31 23:40:34 2007
@@ -17,6 +17,8 @@
 #include "debug.h"

 #include <iconv.h>
+
+#include <boost/cstdint.hpp>

 #include <cerrno>
 #include <iomanip>

Modified: lyx-devel/trunk/src/support/unicode.h
URL: http://www.lyx.org/trac/file/lyx-devel/trunk/src/support/ unicode.h?rev=21312 ====================================================================== ========
--- lyx-devel/trunk/src/support/unicode.h (original)
+++ lyx-devel/trunk/src/support/unicode.h Wed Oct 31 23:40:34 2007
@@ -13,7 +13,7 @@
 #ifndef LYX_SUPPORT_UNICODE_H
 #define LYX_SUPPORT_UNICODE_H

-#include "support/types.h"
+#include "support/strfwd.h"

 #include <boost/scoped_ptr.hpp>


Modified: lyx-devel/trunk/src/support/userinfo.h
URL: http://www.lyx.org/trac/file/lyx-devel/trunk/src/support/ userinfo.h?rev=21312 ====================================================================== ========
--- lyx-devel/trunk/src/support/userinfo.h (original)
+++ lyx-devel/trunk/src/support/userinfo.h Wed Oct 31 23:40:34 2007
@@ -12,7 +12,7 @@
 #ifndef USERINFO_H
 #define USERINFO_H

-#include "support/docstring.h"
+#include "support/strfwd.h"


 namespace lyx {


_______________________________________________
Cvslog mailing list
[EMAIL PROTECTED]
http://www.lyx.org/mailman/listinfo/cvslog

Attachment: PGP.sig
Description: Signierter Teil der Nachricht

Reply via email to