]> git.lyx.org Git - features.git/commitdiff
build with msvc10. Seems there is a bug in their STL code:
authorPeter Kümmel <syntheticpp@gmx.net>
Thu, 22 Apr 2010 14:28:52 +0000 (14:28 +0000)
committerPeter Kümmel <syntheticpp@gmx.net>
Thu, 22 Apr 2010 14:28:52 +0000 (14:28 +0000)
// std::numpunct has a hardcoded dllimport in definition, but we wanna it with 32 bit
// so we can't import it and must define it but then the compiler complains.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34262 a592a061-630c-0410-9148-cb99ea01b6c8

src/support/docstream.cpp
src/support/docstream.h
src/support/numpunct_lyx_char_type.h [new file with mode: 0644]

index 60787a654a2c887da9ce233f920da5d6db040c66..5ae2ff3224daaab6832ecd658144f5904a4994f3 100644 (file)
@@ -23,6 +23,12 @@ using namespace std;
 
 using lyx::ucs4_codeset;
 
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1600)
+std::locale::id numpunct<lyx::char_type>::id;
+#endif
+
+
 namespace {
 
 // We use C IO throughout this file, because the facets might be used with
index b4a4f80fb148c303f2945891d370246112bf3914..0a2d42b38bb418b0b6a02d3a7a55c507ff962f64 100644 (file)
 
 #include "support/docstring.h"
 
+#if defined(_MSC_VER) && (_MSC_VER >= 1600) 
+// Ugly workaround for MSVC10 STL bug:
+// std::numpunct has a hardcoded dllimport in definition, but we wanna it with 32 bit 
+// so we can't import it and must define it but then the compiler complains.
+#include "support/numpunct_lyx_char_type.h"
+#endif
+
 #include <fstream>
 #include <sstream>
 
@@ -68,9 +75,6 @@ public:
 };
 
 
-#if defined(_MSC_VER) && (_MSC_VER >= 1600)
-extern template class std::numpunct<lyx::char_type>;
-#endif
 
 /// UCS4 input stringstream
 typedef std::basic_istringstream<char_type> idocstringstream;
diff --git a/src/support/numpunct_lyx_char_type.h b/src/support/numpunct_lyx_char_type.h
new file mode 100644 (file)
index 0000000..9dbdeb2
--- /dev/null
@@ -0,0 +1,64 @@
+// -*- C++ -*-\r
+/**\r
+ * \file numpunct_lyx_char_type.h\r
+ * This file is part of LyX, the document processor.\r
+ * Licence details can be found in the file COPYING.\r
+ *\r
+ * \author Peter Kümmel\r
+ *\r
+ * Full author contact details are available in file CREDITS.\r
+ */\r
+\r
+#ifndef LYX_NUMPUNCT_LYX_CHAR_TYPE_H\r
+#define LYX_NUMPUNCT_LYX_CHAR_TYPE_H\r
+\r
+\r
+#include <locale>\r
+\r
+\r
+namespace std\r
+{\r
+\r
+       template<>\r
+       class numpunct<lyx::char_type> : public locale::facet\r
+       {\r
+       public:\r
+\r
+               typedef lyx::char_type char_type;\r
+               typedef basic_string<lyx::char_type> string_type;\r
+\r
+\r
+               static locale::id                       id;\r
+\r
+               explicit numpunct(size_t __refs = 0) : chared(__refs)\r
+               {}\r
+\r
+               char_type decimal_point() const\r
+               { return chared.decimal_point(); }\r
+\r
+               char_type thousands_sep() const\r
+               { return chared.thousands_sep(); }\r
+\r
+               string grouping() const\r
+               { return chared.grouping(); }\r
+\r
+               string_type truename() const\r
+               { return lyx::from_ascii(chared.truename()); }\r
+\r
+               string_type falsename() const\r
+               { return lyx::from_ascii(chared.falsename()); }\r
+\r
+\r
+       protected:\r
+               virtual ~numpunct();\r
+\r
+\r
+       private:\r
+               numpunct<char> chared;\r
+\r
+       };\r
+\r
+\r
+\r
+}\r
+#endif\r