PageRenderTime 67ms CodeModel.GetById 20ms RepoModel.GetById 1ms 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. // General includes.
  3. #include "base/cl_sysdep.h"
  4. // Specification.
  5. #include "cln/number_io.h"
  6. // Implementation.
  7. #include <sstream>
  8. #include "cln/io.h"
  9. namespace cln {
  10. static inline const std::string
  11. read_number_junk_msg (const char * string_rest, const char * string, const char * string_limit)
  12. {
  13. std::ostringstream buf;
  14. fprint(buf, "Junk after number: ");
  15. { for (const char * ptr = string; ptr != string_rest; ptr++)
  16. fprintchar(buf, *ptr);
  17. }
  18. fprint(buf, "\"");
  19. { for (const char * ptr = string_rest; ptr != string_limit; ptr++)
  20. fprintchar(buf, *ptr);
  21. }
  22. fprint(buf, "\"");
  23. return buf.str();
  24. }
  25. read_number_junk_exception::read_number_junk_exception (const char * string_rest, const char * string, const char * string_limit)
  26. : read_number_exception(read_number_junk_msg(string_rest, string, string_limit))
  27. {}
  28. } // namespace cln