sources/format.cpp

changeset 60
268721e6be20
parent 5
146825d63b9a
child 73
07dda51a7a8e
equal deleted inserted replaced
59:00a084f8ed26 60:268721e6be20
30 30
31 #include <cstdio> 31 #include <cstdio>
32 #include "format.h" 32 #include "format.h"
33 33
34 // ------------------------------------------------------------------------------------------------- 34 // -------------------------------------------------------------------------------------------------
35 //
35 // Throws an error while formatting the string 36 // Throws an error while formatting the string
36 // 37 //
37 static auto format_error (String fmtstr, const String errdescribe, int pos) -> void 38 static auto format_error (String fmtstr, const String errdescribe, int pos) -> void
38 { 39 {
39 fmtstr.replace ("\n", " "); 40 fmtstr.replace ("\n", " ");
46 errmsg += "^\n" + errdescribe; 47 errmsg += "^\n" + errdescribe;
47 throw std::logic_error (errmsg.std_string()); 48 throw std::logic_error (errmsg.std_string());
48 } 49 }
49 50
50 // ------------------------------------------------------------------------------------------------- 51 // -------------------------------------------------------------------------------------------------
52 //
51 // Main formatter algorithm. 53 // Main formatter algorithm.
52 // 54 //
53 auto format_args (const String& fmtstr, const Vector<String>& args) -> String 55 auto format_args (const String& fmtstr, const Vector<String>& args) -> String
54 { 56 {
55 String fmt = fmtstr; 57 String fmt = fmtstr;

mercurial