tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

DoubleConversion.h (1017B)


      1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      2 /* This Source Code Form is subject to the terms of the Mozilla Public
      3 * License, v. 2.0. If a copy of the MPL was not distributed with this
      4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      5 
      6 /* A utility function that converts a string to a double independent of OS locale. */
      7 
      8 #ifndef MOZILLA_DOUBLECONVERSION_H
      9 #define MOZILLA_DOUBLECONVERSION_H
     10 
     11 #include "mozilla/Maybe.h"
     12 #include "mozilla/Span.h"
     13 
     14 #include <string>
     15 
     16 namespace mozilla {
     17 
     18 // Parses aStringSpan into a double floating point value. Always treats . as the
     19 // decimal separator, regardless of OS locale. Consumes the entire string;
     20 // trailing garbage is invalid. Returns Nothing() for invalid input.
     21 // The implementation uses double_conversion::StringToDoubleConverter with
     22 // NO_FLAGS, see double-conversion/string-to-double.h for more documentation.
     23 Maybe<double> StringToDouble(Span<const char> aStringSpan);
     24 
     25 }
     26 
     27 #endif // MOZILLA_DOUBLECONVERSION_H