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 /****************************************************************************/
14 // An output device that encapsulates a stringstream
15 /****************************************************************************/
16 #ifndef OutputDevice_String_h
17 #define OutputDevice_String_h
18 
19 
20 // ===========================================================================
21 // included modules
22 // ===========================================================================
23 #include <config.h>
24 
25 #include <fstream>
26 #include "OutputDevice.h"
27 
28 
29 // ===========================================================================
30 // class definitions
31 // ===========================================================================
40 public:
44  OutputDevice_String(const bool binary = false, const int defaultIndentation = 0);
45 
46 
49 
50 
54  std::string getString() const;
55 
56 protected:
59 
63  std::ostream& getOStream();
65 
66 
67 private:
69  std::ostringstream myStream;
70 
71 };
72 
73 
74 #endif
75 
76 /****************************************************************************/
77 
OutputDevice_String
An output device that encapsulates an ofstream.
Definition: OutputDevice_String.h:39
OutputDevice
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:63
OutputDevice_String::getOStream
std::ostream & getOStream()
Returns the associated ostream.
Definition: OutputDevice_String.cpp:49
OutputDevice_String::myStream
std::ostringstream myStream
The wrapped ofstream.
Definition: OutputDevice_String.h:69
OutputDevice_String::~OutputDevice_String
~OutputDevice_String()
Destructor.
Definition: OutputDevice_String.cpp:38
OutputDevice_String::getString
std::string getString() const
Returns the current content as a string.
Definition: OutputDevice_String.cpp:43
OutputDevice.h
OutputDevice_String::OutputDevice_String
OutputDevice_String(const bool binary=false, const int defaultIndentation=0)
Constructor.
Definition: OutputDevice_String.cpp:31
config.h