Test-IStringStream.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Description
25 
26 \*---------------------------------------------------------------------------*/
27 
28 #include "IStringStream.H"
29 #include "wordList.H"
30 #include "IOstreams.H"
31 
32 using namespace Foam;
33 
34 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
35 // Main program:
36 
37 int main(int argc, char *argv[])
38 {
39  IStringStream testStream(Foam::string("1002 sfsd sdfsd"));
40 
41  label i(readLabel(testStream));
42 
43  Info<< i << endl;
44 
45  word bla(testStream);
46  word bla2(testStream);
47 
48  Info<< bla << tab << bla2 << endl;
49 
50  wordList wl(IStringStream("(hello1")());
51 
52  Info<< wl << endl;
53 
54  Info<< "\nEnd\n" << endl;
55 
56  return 0;
57 }
58 
59 
60 // ************************************************************************* //
IOstreams.H
Useful combination of include files which define Sin, Sout and Serr and the use of IO streams general...
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
Foam::string
A class for handling character strings derived from std::string.
Definition: string.H:74
wordList.H
IStringStream.H
Foam::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
Foam::Info
messageStream Info
Foam::IStringStream
Input from memory buffer stream.
Definition: IStringStream.H:49
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::tab
static const char tab
Definition: Ostream.H:259
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
Foam::readLabel
label readLabel(Istream &is)
Definition: label.H:64
main
int main(int argc, char *argv[])
Definition: Test-IStringStream.C:37