00001 00002 // Copyright (C) 2000--2001 Petter Urkedal (petter.urkedal@matfys.lth.se) 00003 00004 // This file is free software; you can redistribute it and/or modify 00005 // it under the terms of the GNU General Public License as published by 00006 // the Free Software Foundation; either version 2 of the License, or 00007 // (at your option) any later version. 00008 00009 // This file is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 // GNU General Public License for more details. 00013 00014 // You should have received a copy of the GNU General Public License 00015 // along with this program; if not, write to the Free Software 00016 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00017 00018 // As a special exception, you may use this file as part of a free 00019 // software library without restriction. Specifically, if other files 00020 // instantiate templates or use macros or inline functions from this 00021 // file, or you compile this file and link it with other files to 00022 // produce an executable, this file does not by itself cause the 00023 // resulting executable to be covered by the GNU General Public 00024 // License. This exception does not however invalidate any other 00025 // reasons why the executable file might be covered by the GNU General 00026 // Public License. 00027 00028 // $Id: texlocale.h,v 1.1 2002/05/30 18:01:37 petter_urkedal Exp $ 00029 00030 00031 00032 // tex_num_put is a facet which outputs numbers for TeX text mode. 00033 00034 00035 #ifndef MORE_TEXLOCALE_H 00036 #define MORE_TEXLOCALE_H 00037 00038 #include <locale> 00039 #include <sstream> 00040 #include <more/math/math.h> 00041 00042 namespace more { 00043 namespace io { 00044 00045 template<typename Char, typename OutIter = std::ostreambuf_iterator<Char> > 00046 struct tex_num_put 00047 : std::num_put<Char, OutIter> 00048 { 00049 tex_num_put() {} //: std::num_put<Char, OutIter>(1) {} 00050 00051 OutIter do_put(OutIter it, std::ios_base& ios, Char fill, 00052 long double x) const 00053 { return put_num_impl(it, ios, fill, x); } 00054 OutIter do_put(OutIter it, std::ios_base& ios, Char fill, 00055 double x) const 00056 { return put_num_impl(it, ios, fill, x); } 00057 00058 private: 00059 OutIter put_num_impl(OutIter it, std::ios_base& ios, Char fill, 00060 long double x) const; 00061 }; 00062 00063 } 00064 } 00065 00066 #endif