mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Add very rudimentary output support for wide-characters.
This commit is contained in:
@ -10,7 +10,9 @@ $(bools)/bool/boolIO.C
|
|||||||
$(bools)/Switch/Switch.C
|
$(bools)/Switch/Switch.C
|
||||||
$(bools)/Switch/SwitchIO.C
|
$(bools)/Switch/SwitchIO.C
|
||||||
|
|
||||||
primitives/char/charIO.C
|
chars = primitives/chars
|
||||||
|
$(chars)/char/charIO.C
|
||||||
|
$(chars)/wchar/wcharIO.C
|
||||||
|
|
||||||
ints = primitives/ints
|
ints = primitives/ints
|
||||||
$(ints)/int/intIO.C
|
$(ints)/int/intIO.C
|
||||||
|
|||||||
66
src/OpenFOAM/primitives/chars/wchar/wchar.H
Normal file
66
src/OpenFOAM/primitives/chars/wchar/wchar.H
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd.
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM 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 of the License, or (at your
|
||||||
|
option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
Primitive
|
||||||
|
wchar_t
|
||||||
|
|
||||||
|
Description
|
||||||
|
A wide-character and a pointer to a wide-character string.
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
wcharIO.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef wchar_H
|
||||||
|
#define wchar_H
|
||||||
|
|
||||||
|
#include <cwchar>
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
class Istream;
|
||||||
|
class Ostream;
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
//- Output via a normal char
|
||||||
|
Ostream& operator<<(Ostream&, const wchar_t);
|
||||||
|
|
||||||
|
//- Output string via normal char
|
||||||
|
Ostream& operator<<(Ostream&, const wchar_t*);
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
62
src/OpenFOAM/primitives/chars/wchar/wcharIO.C
Normal file
62
src/OpenFOAM/primitives/chars/wchar/wcharIO.C
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd.
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM 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 of the License, or (at your
|
||||||
|
option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
Description
|
||||||
|
Reads a char from an input stream, for a given version
|
||||||
|
number and File format. If an ascii File is being read, then the line
|
||||||
|
numbers are counted and an erroneous read is reported.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "error.H"
|
||||||
|
|
||||||
|
#include "wchar.H"
|
||||||
|
#include "IOstreams.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::Ostream& Foam::operator<<(Ostream& os, const wchar_t wc)
|
||||||
|
{
|
||||||
|
os.write(char(wc));
|
||||||
|
|
||||||
|
os.check("Ostream& operator<<(Ostream&, const wchar_t)");
|
||||||
|
return os;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::Ostream& Foam::operator<<(Ostream& os, const wchar_t* ws)
|
||||||
|
{
|
||||||
|
if (ws)
|
||||||
|
{
|
||||||
|
for (const wchar_t* p = ws; *p; ++p)
|
||||||
|
{
|
||||||
|
os.write(char(*p));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
os.check("Ostream& operator<<(Ostream&, const wchar_t*)");
|
||||||
|
return os;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
Reference in New Issue
Block a user