Commit Graph

385 Commits

Author SHA1 Message Date
Victor Zverovich
536fedfe0f Fix build. 2014-06-30 18:26:46 -07:00
Victor Zverovich
35866bb2c2 Fix warnings. 2014-06-30 18:12:57 -07:00
Victor Zverovich
cea08c7abc Suppress more warnings. 2014-06-30 17:46:14 -07:00
Victor Zverovich
eb034a0589 Suppress warnings. 2014-06-30 17:40:53 -07:00
Victor Zverovich
c6eb12d1d4 Fix one more Windows issue. 2014-06-30 17:17:48 -07:00
Victor Zverovich
a2205739b1 Fix build. 2014-06-30 16:31:43 -07:00
Victor Zverovich
b939860d6e write -> write_str 2014-06-30 15:44:08 -07:00
Victor Zverovich
53201033f2 Refactor error reporting API. 2014-06-30 14:26:29 -07:00
Victor Zverovich
d29e505568 Move PrintfParser from BasicWriter to the internal namespace. 2014-06-30 07:12:09 -07:00
Victor Zverovich
e63a0ff125 Deprecate c_str() and str(). 2014-06-30 06:43:53 -07:00
Victor Zverovich
90e6faffa0 Document ArgList. 2014-06-30 06:27:26 -07:00
Victor Zverovich
ba70b30d7e Move BasicArg & make_arg from BasicWriter to the internal namespace. 2014-06-30 06:19:20 -07:00
Victor Zverovich
21111cc954 MakeArg -> make_arg. Move printf out of Writer. 2014-06-29 19:52:26 -07:00
Victor Zverovich
afc760263e Update example. 2014-06-29 12:04:28 -07:00
Victor Zverovich
a1264926a0 Writer::format -> Writer::write. Make fmt::format return string. 2014-06-29 11:51:10 -07:00
Victor Zverovich
d5b8196749 Update the API. 2014-06-28 21:56:40 -07:00
Victor Zverovich
0914c91284 Don't use deprecated API. 2014-06-28 19:53:15 -07:00
Victor Zverovich
2e03963e9e Add fmt::print. Undocument and deprecate old API. 2014-06-28 19:44:39 -07:00
Victor Zverovich
ddbd50de4a Fix build. 2014-06-28 17:44:52 -07:00
Victor Zverovich
4d5b1e8a13 Update the API and tests. 2014-06-28 17:35:57 -07:00
Victor Zverovich
e06e9f885c Deprecate Format and update tests. 2014-06-28 15:58:02 -07:00
Victor Zverovich
5edda531f6 Add fmt::format and deprecate fmt::Format. 2014-06-28 14:48:42 -07:00
Victor Zverovich
428d114766 Complete FMT_VARIADIC. 2014-06-28 13:31:44 -07:00
Victor Zverovich
4f4e6c965f Fix MSVC build. FormatError -> FormatMessage to avoid ambiguity. 2014-06-28 12:49:51 -07:00
Victor Zverovich
5aa36285b1 Try another MSVC workaround. 2014-06-28 12:14:43 -07:00
Victor Zverovich
ce09e7e348 Simplify FMT_FOR_EACH. 2014-06-28 11:43:07 -07:00
Victor Zverovich
e4c2475318 MSVC workaround. 2014-06-28 11:36:49 -07:00
Victor Zverovich
3b18ecb24a FMT_FOR_EACH_NARG -> FMT_NARG. 2014-06-28 11:30:15 -07:00
Victor Zverovich
be7473b401 Test FMT_VARIADIC. 2014-06-28 11:20:04 -07:00
Victor Zverovich
2f6dddd6fd Simplify FMT_VARIADIC. 2014-06-28 11:07:43 -07:00
Victor Zverovich
360bfbdd50 Use 0-based indices. Test FMT_FOR_EACH*. 2014-06-28 10:32:37 -07:00
Victor Zverovich
bf25ef6455 FMT_TEMPLATE -> FMT_WRAP 2014-06-28 09:15:51 -07:00
Victor Zverovich
ef34eb6ec2 Emulate variadic functions on older compilers. 2014-06-25 07:50:16 -07:00
Victor Zverovich
2f752abe97 Add FMT_VARIADIC_VOID to emulate variadic functions on old compilers. 2014-06-24 19:27:26 -07:00
Victor Zverovich
8198df84f0 Suppress warnings about variadic macros. 2014-06-24 13:01:44 -07:00
Victor Zverovich
a062f94ab0 Workaround a bug in VC++ variadic macro implementation. 2014-06-24 11:09:07 -07:00
Victor Zverovich
302b8f4406 Fix MSVC build, take 2. 2014-06-24 10:46:01 -07:00
Victor Zverovich
0195f543d9 Initial support for variadic functions without C++11. 2014-06-24 10:14:50 -07:00
Victor Zverovich
ea99bfb902 Move ArgInfo to internal namespace and add ArgList. 2014-06-24 07:54:26 -07:00
Victor Zverovich
8d4535e76c Avoid unnecessary include. 2014-06-23 09:49:59 -07:00
Victor Zverovich
9c995a6b58 Don't use undefined _MSC_VER. 2014-06-21 09:47:37 -07:00
Victor Zverovich
5be9a8de3f Reduce the number of integer types that need to be handled. 2014-06-21 09:40:04 -07:00
Victor Zverovich
b1bbc90919 Use precision from FormatSpec. 2014-06-21 08:32:00 -07:00
Victor Zverovich
6238f2daa1 Make precision and alignment work together. 2014-06-21 08:18:05 -07:00
Victor Zverovich
ca31c2b322 Fix handling of octal prefix. 2014-06-20 08:04:44 -07:00
Victor Zverovich
512ab9336b PrepareFilledBuffer -> PrepareBufferForInt 2014-06-20 08:01:58 -07:00
Victor Zverovich
c556926597 Implement precision + fill. 2014-06-20 07:59:23 -07:00
Victor Zverovich
879838a539 Implement integer precision. 2014-06-20 07:34:02 -07:00
Victor Zverovich
cb743c0249 Parse printf format specs. 2014-06-19 07:40:35 -07:00
Victor Zverovich
1275923a68 Implement dynamic width in printf. 2014-06-17 06:53:48 -07:00
Victor Zverovich
8666ea82f7 Merge branch 'master' of github.com:cppformat/cppformat 2014-06-16 07:49:37 -07:00
Victor Zverovich
1f19b986a0 Implement printf specifications. 2014-06-16 07:49:30 -07:00
Johan 't Hart
f4d47d7140 Fix grow size during Array<>::append
When the resulting array must grow during append, one must make sure
that the new elements _plus_ the current elements fit the new array
size.
2014-06-16 11:44:24 +02:00
Victor Zverovich
1aeac1b25a Unindent 2014-06-11 05:52:02 -07:00
Alexey Morozov
08d4e5040f GCC may have support for __has_feature but doesn't support __has_builtin
So perform these checks separately
2014-06-11 15:47:46 +07:00
Victor Zverovich
1b80148420 Implement '#' flag. 2014-06-07 08:57:55 -07:00
Victor Zverovich
bf790d2819 Ignore '0' flag for non-numeric types as printf does. 2014-06-07 07:31:25 -07:00
Victor Zverovich
b88d261282 Fix an issue with allocation of a zero-size array. 2014-06-06 08:01:10 -07:00
Victor Zverovich
d9f5089a18 Remove unnecessary qualification. 2014-06-06 08:00:20 -07:00
Victor Zverovich
bf8b29fbe7 Add initial support for printf format specifications. 2014-06-06 06:38:37 -07:00
Victor Zverovich
13a5b2511b Document Print. 2014-05-18 10:04:36 -07:00
Victor Zverovich
5415b2a43b Fix example. 2014-05-14 08:20:20 -07:00
Victor Zverovich
d2e7554f74 Write docs. 2014-05-14 07:29:47 -07:00
Victor Zverovich
3303708e94 Document ThrowSystemError and ThrowWinError. 2014-05-14 07:05:09 -07:00
Victor Zverovich
83920084f7 Update docs. 2014-05-13 08:55:13 -07:00
Victor Zverovich
891da2f474 Fix docs. 2014-05-13 07:39:18 -07:00
Victor Zverovich
089e54a09b Fix docs. 2014-05-13 07:35:46 -07:00
Victor Zverovich
734bb02904 More docs. 2014-05-13 06:43:43 -07:00
Victor Zverovich
5cf3b6dc7d Add a Print overload that writes to a file. 2014-05-06 08:05:51 -07:00
Victor Zverovich
1a2d7be3f5 Implement EXPECT_STDOUT and EXPECT_STDERR using pipes. 2014-05-03 09:48:54 -07:00
Victor Zverovich
53b4c31afb Move Format*ErrorMessage to internal namespace. 2014-04-30 15:00:41 -07:00
Victor Zverovich
400812a905 CError -> WinError 2014-04-30 12:38:17 -07:00
Victor Zverovich
99e6112fda Fix StrError, move Format*ErrorMessage to the implementation. 2014-04-30 11:20:41 -07:00
Victor Zverovich
f79398699b Add ThrowCError to throw an exception on C library errors. 2014-04-30 10:18:11 -07:00
Victor Zverovich
2c6372d790 Add a portable thread-safe version of strerror. 2014-04-30 09:42:48 -07:00
Victor Zverovich
c16217bf9b Test UTF8ToUTF16 and UTF16ToUTF8. 2014-04-30 07:38:43 -07:00
Victor Zverovich
da9aeab810 Add UTF8ToUTF16 and UTF16ToUTF8. 2014-04-30 07:23:43 -07:00
Victor Zverovich
859a4975f6 Throw SystemError if fwrite fails. 2014-04-30 06:55:21 -07:00
Victor Zverovich
4e33311597 Get rid of FormatterProxy. 2014-04-29 09:32:25 -07:00
Victor Zverovich
063d0077b3 Test FileSink. Simplify tests. 2014-04-29 08:39:37 -07:00
Victor Zverovich
c1f947f4fb Add comments. 2014-04-29 06:54:46 -07:00
Victor Zverovich
7e6dd376b1 Improve doc. 2014-04-28 19:27:29 -07:00
Victor Zverovich
46e26191f4 Remove unnecessary const refs. 2014-04-28 19:27:19 -07:00
Victor Zverovich
d9db89814f Refactor action classes, Action -> Sink, add comments. 2014-04-28 08:59:29 -07:00
Victor Zverovich
d2bf073334 Format. 2014-04-27 09:47:07 -07:00
Victor Zverovich
83a7b79c2d Add a macro to disallow the copy constructor and operator= functions. 2014-04-27 09:46:56 -07:00
Victor Zverovich
f153f6f4b5 Implement move assignment in BasicWriter. 2014-04-26 07:10:21 -07:00
Victor Zverovich
3bb9941e37 Fix warning. 2014-04-26 06:47:25 -07:00
Victor Zverovich
26277c8ab3 Implement move assignment operator for Array. 2014-04-25 08:18:07 -07:00
Victor Zverovich
08b0741fa7 Add move ctor to BasicWriter. 2014-04-25 07:40:37 -07:00
Victor Zverovich
259a307daf Fix version check, take 2. 2014-04-24 15:39:20 -07:00
Victor Zverovich
daaa314aac Fix version check. 2014-04-24 14:55:18 -07:00
Victor Zverovich
b61bb5d635 Don't use rvalue references when compiling with clang and an old libstdc++ as the latter doesn't provide std::move. 2014-04-24 14:18:37 -07:00
Victor Zverovich
f28645f900 Fix includes. 2014-04-24 12:37:06 -07:00
Victor Zverovich
71a5b7a126 Return Writer instead of std::string in variadic overloads of Format for performance & consistency with non-variadic versions. 2014-04-24 07:32:01 -07:00
Victor Zverovich
bc2cab2efe Format. 2014-04-24 07:30:47 -07:00
Victor Zverovich
b22493ce7e Add a move ctor to Array. 2014-04-24 07:30:39 -07:00
Victor Zverovich
81217a2cc0 Add a comment. 2014-04-24 07:30:06 -07:00
Victor Zverovich
f04cb531db Remove unused code. 2014-04-23 19:41:25 -07:00
Victor Zverovich
f2e0391800 Simplify. 2014-04-23 17:34:32 -07:00
Victor Zverovich
9bde82689f Use prefix FMT_ for all macros. 2014-04-23 17:33:50 -07:00
Victor Zverovich
01ab792f60 Decouple the action perform on argument's destruction from the argument. 2014-04-23 09:13:03 -07:00
Victor Zverovich
e78904b9b9 Move formatting functionality from BasicFormatter to BasicWriter & FormatPaser to simplify the implementation of standalone formatting methods. 2014-04-23 08:27:50 -07:00
Victor Zverovich
1104e73242 Don't use initializer lists. 2014-04-22 19:42:25 -07:00
Victor Zverovich
656a8378d1 Use ArgInfo instead of Arg where possible. 2014-04-22 08:58:54 -07:00
Victor Zverovich
5b8126f84d Factor POD part of Arg into ArgInfo to be able to store it in Array. 2014-04-22 08:19:10 -07:00
Victor Zverovich
03f68857e2 Replace BasicFormatter::Format with BasicWriter::FormatInt. 2014-04-20 08:46:09 -07:00
Victor Zverovich
265b40ec6e Disable GCC warning about "long long". 2014-04-16 09:19:31 -07:00
Victor Zverovich
5f9574c3c1 Add a test case for writing a double to a filled buffer. 2014-04-09 08:05:23 -07:00
jdale88
a9862fdb22 Fixed some level 4 warnings in VS2013 2014-03-11 18:56:24 +00:00
jdale88
17d621f86f Added variadic versions for Format that act as a proxy for providing an initialiser list to a BasicFormatter.
Updated the Variadic test to use these new functions and verified that the tests passed.

See https://github.com/vitaut/format/issues/25
2014-03-06 20:06:44 +00:00
jdale88
45b56c1c62 Fixed some places in BasicFormatter where non-templated string types were being used.
See https://github.com/vitaut/format/issues/24
2014-02-27 01:28:17 +00:00
Victor Zverovich
86574285cc Don't use CountDigits for 1-2 digit numbers. 2014-02-20 21:05:46 -08:00
Victor Zverovich
7abd6443ac Fix more warnings. 2014-02-20 08:02:32 -08:00
Victor Zverovich
8c4425a00f Fix warnings. 2014-02-20 07:53:50 -08:00
Victor Zverovich
04b3432238 Simplify IntTraits. 2014-02-20 07:43:37 -08:00
Victor Zverovich
90d0c50eb3 Fix formatting of integer types smaller than int in FormatDec. 2014-02-20 07:04:54 -08:00
Victor Zverovich
43fe100875 Move the implementation of ColorWriter::operator() to format.cc 2014-02-19 14:20:26 -08:00
Victor Zverovich
6968ef3bb3 Implement PrintColored.
Thanks https://github.com/jose55 for the idea.
2014-02-19 13:51:23 -08:00
Victor Zverovich
e9b2191689 Add a 32-bit version of CountDigits. 2014-02-19 12:43:55 -08:00
Victor Zverovich
3017fc6fb7 Improve 32-bit integer formatting performance by parameterizing FormatDecimal on integer type. 2014-02-17 09:12:24 -08:00
Victor Zverovich
fb2be485d7 Fix non-gcc builds. 2014-02-15 10:41:00 -08:00
Victor Zverovich
ff0d5d1771 Fix more warnings on older GCC. 2014-02-15 10:17:10 -08:00
Victor Zverovich
7561ff27e5 Fix warnings about unsigned long long as well. 2014-02-15 10:02:02 -08:00
Victor Zverovich
7325ebc965 Fix the warning about long long on older gcc. 2014-02-15 09:58:33 -08:00
Victor Zverovich
245faa745b ConvertWChar -> ConvertChar. 2014-02-15 09:39:49 -08:00
Victor Zverovich
eadd2ee421 Add FormatInt::data() and document members. 2014-02-15 09:39:06 -08:00
Victor Zverovich
f43de4a469 Only append terminating '\0' when necessary. 2014-02-15 09:24:31 -08:00
Victor Zverovich
430c45d618 Too much Python 🐍 2014-02-14 14:06:39 -08:00
Victor Zverovich
6f0387fc22 Expose in-place decimal integer formatting via FormatDec. Improve performance of CountDigits based on the results from https://github.com/localvoid/cxx-benchmark-count-digits. 2014-02-14 10:36:17 -08:00
Victor Zverovich
d473a79581 Add FormatInt::size, and support for long and long long. 2014-02-13 09:59:49 -08:00
Victor Zverovich
bfedba5a0a Add support for int64_t in FormatInt. 2014-01-30 08:02:06 -08:00
Victor Zverovich
c3f5dce8d5 Fixed bug https://github.com/vitaut/format/issues/16 . Thanks to https://github.com/fil222 ! 2014-01-28 12:49:36 -08:00
Victor Zverovich
ea5dce3957 Simplify format specs. 2014-01-28 12:47:37 -08:00
Victor Zverovich
a1bd3358bb Produce a compile error when using wide fill character on a narrow stream. 2014-01-08 08:17:38 -08:00
Victor Zverovich
1f17447fac Simplify pad. 2014-01-07 08:44:15 -08:00
Victor Zverovich
8efc8ac075 Fixed https://github.com/vitaut/format/issues/15 . Thanks! 2014-01-06 17:49:27 -08:00
Victor Zverovich
24fcd6e97f Fix compilation with clang. 2014-01-02 12:29:53 -08:00
Victor Zverovich
6038c85231 format_test -> format-test. Add support for wide char to BasicWriter. 2014-01-02 11:30:28 -08:00
Victor Zverovich
342b76d278 Implement pad for wide strings. 2014-01-01 10:00:55 -08:00
Victor Zverovich
09f98854bf StrFormatter -> StrFormatSpec. 2014-01-01 09:22:55 -08:00
Victor Zverovich
ba6c5fe522 IntFormatter -> IntFormatSpec. 2014-01-01 09:20:16 -08:00
Victor Zverovich
fec6bc04f5 Spec -> EmptySpec. Improve comments. 2014-01-01 09:06:25 -08:00
Victor Zverovich
59c5612e87 Add comments. 2013-12-31 10:15:16 -08:00
Victor Zverovich
641df95491 Implement string padding. 2013-12-31 09:43:32 -08:00
Victor Zverovich
fbed12ac58 Fix warnings. 2013-12-13 15:13:14 -08:00
Victor Zverovich
2d485d1916 Improve support for C++98 compilers that require a copy ctor when binding a reference to a temporary. 2013-12-10 08:08:41 -08:00
Victor Zverovich
21f3a700c5 Fix a typo. 2013-12-09 17:51:11 -08:00
Victor Zverovich
8ca31c8473 Fix compilation on GCC when -std=c++11 is not specified. 2013-12-09 17:45:27 -08:00
Victor Zverovich
3d7faaf0bd Detect the availability of initialize lists. 2013-12-09 08:31:08 -08:00