Public Member Functions | List of all members
rviz::UniformStringStream Class Reference

std::stringstream subclass which defaults to the "C" locale, so serialization of numbers is uniform across locales. More...

#include <uniform_string_stream.h>

Inheritance diagram for rviz::UniformStringStream:
Inheritance graph
[legend]

Public Member Functions

void parseFloat (float &f)
 Parse a float, supporting both period- and comma- style floats (1,2 and 1.2). More...
 
 UniformStringStream ()
 
 UniformStringStream (const std::string &str)
 

Detailed Description

std::stringstream subclass which defaults to the "C" locale, so serialization of numbers is uniform across locales.

For reading floats in, use parseFloat() instead of operator>>, because operator>> is the one from std::stringstream which only handles "C" style floats. parseFloat() handles "C" and also European-style floats which use the ",", like "1,2" parses to 1.2f

Definition at line 44 of file uniform_string_stream.h.

Constructor & Destructor Documentation

◆ UniformStringStream() [1/2]

rviz::UniformStringStream::UniformStringStream ( )

Definition at line 36 of file uniform_string_stream.cpp.

◆ UniformStringStream() [2/2]

rviz::UniformStringStream::UniformStringStream ( const std::string &  str)

Definition at line 41 of file uniform_string_stream.cpp.

Member Function Documentation

◆ parseFloat()

void rviz::UniformStringStream::parseFloat ( float &  f)

Parse a float, supporting both period- and comma- style floats (1,2 and 1.2).

Uses operator>>(std::string&) internally, so consumes up to next whitespace from the stream.

Definition at line 46 of file uniform_string_stream.cpp.


The documentation for this class was generated from the following files:


rviz
Author(s): Dave Hershberger, David Gossow, Josh Faust, William Woodall
autogenerated on Fri Aug 2 2024 08:43:11