Eclipse SUMO - Simulation of Urban MObility
OutputDevice_String.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2009-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
15 // An output device that encapsulates a stringstream
16 /****************************************************************************/
17 #ifndef OutputDevice_String_h
18 #define OutputDevice_String_h
19 
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 #include <config.h>
25 
26 #include <fstream>
27 #include "OutputDevice.h"
28 
29 
30 // ===========================================================================
31 // class definitions
32 // ===========================================================================
41 public:
45  OutputDevice_String(const bool binary = false, const int defaultIndentation = 0);
46 
47 
50 
51 
55  std::string getString() const;
56 
57 protected:
60 
64  std::ostream& getOStream();
66 
67 
68 private:
70  std::ostringstream myStream;
71 
72 };
73 
74 
75 #endif
76 
77 /****************************************************************************/
78 
OutputDevice_String
An output device that encapsulates an ofstream.
Definition: OutputDevice_String.h:40
OutputDevice
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:64
OutputDevice_String::getOStream
std::ostream & getOStream()
Returns the associated ostream.
Definition: OutputDevice_String.cpp:50
OutputDevice_String::myStream
std::ostringstream myStream
The wrapped ofstream.
Definition: OutputDevice_String.h:70
OutputDevice_String::~OutputDevice_String
~OutputDevice_String()
Destructor.
Definition: OutputDevice_String.cpp:39
OutputDevice_String::getString
std::string getString() const
Returns the current content as a string.
Definition: OutputDevice_String.cpp:44
OutputDevice.h
OutputDevice_String::OutputDevice_String
OutputDevice_String(const bool binary=false, const int defaultIndentation=0)
Constructor.
Definition: OutputDevice_String.cpp:32
config.h