MCPcopy Create free account
hub / github.com/Tripwire/tripwire-open-source / Format

Method Format

src/core/twlocale.cpp:143–160  ·  view source on GitHub ↗

TODO:BAM -- these functions should really maybe take a stringstream that has been already set up for formatting (basefield, locale, etc.) that way we can merge . the FormatNumberAsHex function as well ============================================================================= template< class numT, class CharT > numT cFormatNumberUtil::FormatNumber( const std::basic_string< CharT >& s, bool fC

Source from the content-addressed store, hash-verified

141 //-----------------------------------------------------------------------------
142 // EFFECTS: Does all actual formatting for FormatNumber methods
143 static numT Format(const std::basic_string<CharT>& s, bool fCStyleFormatting)
144 {
145 static const std::num_get<CharT>* png;
146 std::basic_istringstream<CharT> ss(s);
147 std::ios_base::iostate state;
148 numT n;
149
150 if (fCStyleFormatting)
151 ss.imbue(std::locale::classic());
152
153 tss::GetFacet(ss.getloc(), png).get(ss, std::istreambuf_iterator<CharT>(), ss, state, n);
154
155
156 if ((state & std::ios_base::failbit) != 0)
157 throw eTWLocaleBadNumFormat();
158
159 return (n);
160 }
161
162 //=============================================================================
163 // std::basic_string< CharT >&

Callers

nothing calls this directly

Calls 1

getMethod · 0.45

Tested by

no test coverage detected