PageRenderTime 33ms CodeModel.GetById 24ms app.highlight 9ms RepoModel.GetById 0ms app.codeStats 0ms

/cln-1.3.2/src/base/input/cl_read_junk_exception.cc

#
C++ | 37 lines | 24 code | 9 blank | 4 comment | 4 complexity | 3849fc29b0ccdcb0c11766869b40ef50 MD5 | raw file
Possible License(s): GPL-2.0
 1// read_number_junk_exception().
 2
 3// General includes.
 4#include "base/cl_sysdep.h"
 5
 6// Specification.
 7#include "cln/number_io.h"
 8
 9
10// Implementation.
11
12#include <sstream>
13#include "cln/io.h"
14
15namespace cln {
16
17static inline const std::string
18read_number_junk_msg (const char * string_rest, const char * string, const char * string_limit)
19{
20	std::ostringstream buf;
21	fprint(buf, "Junk after number: ");
22	{ for (const char * ptr = string; ptr != string_rest; ptr++)
23		fprintchar(buf, *ptr);
24	}
25	fprint(buf, "\"");
26	{ for (const char * ptr = string_rest; ptr != string_limit; ptr++)
27		fprintchar(buf, *ptr);
28	}
29	fprint(buf, "\"");
30	return buf.str();
31}
32
33read_number_junk_exception::read_number_junk_exception (const char * string_rest, const char * string, const char * string_limit)
34	: read_number_exception(read_number_junk_msg(string_rest, string, string_limit))
35{}
36
37}  // namespace cln