Commit Graph

500 Commits

Author SHA1 Message Date
Victor Zverovich
bd133382f0 Fix BasicWriter::write without formatting arguments on C++11 (#109) 2015-02-16 14:32:38 -08:00
root
9fd566412d Refine 2015-02-15 15:25:56 +08:00
carterl
9331533309 Use __GXX_EXPERIMENTAL_CXX0X__ for better C++11 detection 2015-02-15 04:16:23 +01:00
Carter Li
2eef573656 Use explicitly deleted functions to make types non-copyable 2015-02-14 23:22:14 +08:00
Carter Li
e2583ab5f3 Use throw() when noexcept is not supported 2015-02-14 09:58:29 +08:00
Victor Zverovich
dd2e8b98de Fix RST markup 2015-02-12 12:46:28 -08:00
Victor Zverovich
618dd9d6af Remove the fallthrough attribute detection 2015-02-09 07:54:03 -08:00
Victor Zverovich
a92c179a6d Fix warnings on clang 2015-02-09 07:37:26 -08:00
viz
26c151c5e4 Detect [[clang::fallthrough]] even __has_cpp_attribute is not supported 2015-02-08 07:57:05 -08:00
Victor Zverovich
326ade7698 Document what happens if you pass an invalid error code
to SystemError or WindowsError
2015-02-07 09:46:42 -08:00
Victor Zverovich
fe2b5351be Merge pull request #101 from cppformat/fallthrough
Try detecting clang::fallthrough using __has_cpp_attribute
2015-02-07 06:57:20 -08:00
Victor Zverovich
d7fea1ba0c Try detecting clang::fallthrough using __has_cpp_attribute
and use it to silence one of the warnings in #96.
2015-02-07 06:51:47 -08:00
Victor Zverovich
45d70b71ec Fix by @dixlorenz for clang warning about unknown Doxygen tags 2015-02-06 21:25:30 -08:00
Victor Zverovich
554abb12f1 Fix formatting 2015-02-06 08:45:43 -08:00
Victor Zverovich
f2c16957f7 Provide examples of using SystemError and WindowsError (#54) 2015-02-06 08:43:02 -08:00
aruhan
e8febf7f4b Fix format using wostream produces wrong results 2015-01-05 22:33:18 +09:00
Victor Zverovich
8d89e56d2c Set primary domain to cpp 2014-12-18 08:36:53 -08:00
Victor Zverovich
2523f3b939 Fix more -Wshadow warnings 2014-12-10 07:24:05 -08:00
Victor Zverovich
f9fc8fd09d Fix -Wshadow warnings 2014-12-09 07:45:54 -08:00
Victor Zverovich
f9c3ff244d Merge branch 'header-only' of github.com:cppformat/cppformat 2014-12-09 06:14:04 -08:00
Victor Zverovich
54f19ff7b2 Simplify append_float_length 2014-12-03 06:33:31 -08:00
Victor Zverovich
f3bd9d4241 Remove extra space 2014-12-03 06:20:12 -08:00
Victor Zverovich
6f3c095ed6 Use FMT_DISALLOW_COPY_AND_ASSIGN instead of undefined assignment operators 2014-12-03 06:16:52 -08:00
Daniel.Perry
838dc1e189 move append_float_length specialization to the header 2014-12-02 10:20:27 -05:00
Victor Zverovich
311251eb91 Complete header-only configuration support 2014-11-29 06:58:00 -08:00
Victor Zverovich
d9c605c61f Initial support for header-only configuration 2014-11-28 06:40:57 -08:00
Daniel.Perry
334fc54b5d removed unused code 2014-11-25 18:03:54 -05:00
Daniel.Perry
bd0067ee76 made code compile under windows with level 4 warnings 2014-11-25 18:01:09 -05:00
Victor Zverovich
5a5870d3ca n -> size 2014-10-30 07:10:43 -07:00
Victor Zverovich
5c4b6678e4 Compute StringRef size in ctor 2014-10-30 07:05:42 -07:00
Victor Zverovich
709465197a Switch to bootstrap theme 2014-10-10 08:40:35 -07:00
Victor Zverovich
1e63fc7ca0 Comment 2014-10-05 09:34:46 -07:00
Victor Zverovich
04d38a8b14 Update docs 2014-10-01 08:32:01 -07:00
Victor Zverovich
8b9a6e03f6 Test buffer 2014-10-01 08:12:10 -07:00
Victor Zverovich
74dc571ba0 Support signed char and unsigned char strings 2014-09-30 08:15:56 -07:00
Victor Zverovich
d1ded569ff Separate memory management and formatting
Array is split into an abstract Buffer class and a concrete MemoryBuffer class. BasicWriter now does all memory allocation through a Buffer object. Subclasses of BasicWriter may use different buffer types. The new BasicMemoryBuffer class uses the default MemoryBuffer.
2014-09-29 08:48:16 -07:00
Victor Zverovich
5ca3d00e26 Mind the lifetime 2014-09-25 12:15:16 -07:00
Victor Zverovich
a9da3d3852 Fix ArgList::operator[] 2014-09-25 09:31:36 -07:00
Victor Zverovich
65cb43a484 Store type info in uint64_t instead of ULongLong 2014-09-25 07:42:29 -07:00
Victor Zverovich
098a8fdef8 Simplify make_type 2014-09-25 07:14:08 -07:00
Victor Zverovich
75a2ea03a7 Reduce code bloat
Special case C strings because there is no need to handle size for them. Add support for pre-C++11 compilers to make_type.
2014-09-25 07:10:44 -07:00
Victor Zverovich
163178eee1 Make print non-inline 2014-09-25 07:08:25 -07:00
Victor Zverovich
ae8bc36e57 MakeArg -> MakeValue 2014-09-24 08:07:50 -07:00
Victor Zverovich
93b314d3ab Comments 2014-09-24 07:59:23 -07:00
Victor Zverovich
ec1aea34e6 Refactor type processing 2014-09-24 07:48:45 -07:00
Victor Zverovich
ab6e759291 pointer_value -> pointer 2014-09-23 08:21:58 -07:00
Victor Zverovich
d2973766ea ArgBase -> Value 2014-09-23 08:11:03 -07:00
Victor Zverovich
beb00edf73 Store types in ArgList instead of Arg 2014-09-23 07:59:43 -07:00
Victor Zverovich
1d4640415d Pass ArgList by value
This improve bloat test results:
Old stripped size: 67680 (optimized)
New stripped size: 59488 (optimized)
2014-09-21 08:08:52 -07:00
Victor Zverovich
b9a568b1dd Add support for custom memory allocator to BasicWriter 2014-09-19 07:51:42 -07:00
Victor Zverovich
6a98f42336 Add support for custom allocators 2014-09-18 09:07:40 -07:00
Victor Zverovich
886ad20a9d Remove unused size argument from Array's ctor. 2014-09-12 17:20:36 -07:00
Victor Zverovich
1e9ca17b9d Workaround Windows crap. 2014-09-12 13:42:22 -07:00
Victor Zverovich
d59fbdcd4a Increase the maximum number of formatting arguments on compilers without variadic templates to 15. 2014-09-11 21:18:36 -07:00
Victor Zverovich
f2c9df8e9f Move safe_strerror to anonymous namespace. 2014-09-05 08:44:41 -07:00
Victor Zverovich
88e0db8486 Test format_error_code. 2014-09-05 08:04:26 -07:00
Victor Zverovich
22f75d8b6d Don't throw exceptions from error formatting functions. Gracefully fallback to a less descriptive message instead. 2014-09-03 08:03:05 -07:00
Victor Zverovich
5debb2aa86 Refactor error reporting to reduce duplication. 2014-08-29 08:16:10 -07:00
Victor Zverovich
605d2600f8 Improve error reporting. 2014-08-29 07:45:55 -07:00
Victor Zverovich
271fa8c908 Improve handling of format strings in custom arguments. 2014-08-29 07:23:54 -07:00
Victor Zverovich
3947a7a98c Move check_sign to anonymous namespace. 2014-08-29 06:57:53 -07:00
Victor Zverovich
c57d7a506f Factor out argument processing logic common between format and printf to FormatterBase::{next_arg,get_arg}. 2014-08-28 08:05:47 -07:00
Victor Zverovich
56fc525e98 Get rid of FormatterBase::error_. 2014-08-28 07:48:55 -07:00
Victor Zverovich
526b7fc91d Throw exception in parse_nonnegative_int if the number is too big. 2014-08-28 06:42:59 -07:00
Victor Zverovich
9646e38c3b Don't use error_ in parse_arg_index. 2014-08-27 09:13:42 -07:00
Victor Zverovich
42de4f1f7d Get rid of FormatErrorReporter. 2014-08-27 08:24:31 -07:00
Victor Zverovich
dd4323f31c Add fprintf and write docs. 2014-08-21 08:49:13 -07:00
Victor Zverovich
f9561671cf Write docs. 2014-08-21 07:30:00 -07:00
Victor Zverovich
406c6123fb Cleanup 2014-08-19 08:47:38 -07:00
Victor Zverovich
fb32161fa4 Move implementation specific stuff from format.h to format.cc. 2014-08-15 08:40:03 -07:00
Victor Zverovich
431b556951 Add FMT_ prefix to SPECIALIZE_MAKE_UNSIGNED. 2014-08-07 07:42:55 -07:00
Victor Zverovich
6cd1563eac Add a size argument to Array ctor. 2014-08-06 07:17:03 -07:00
Victor Zverovich
58dfe5c9f7 Make format_decimal inline. 2014-08-01 08:49:16 -07:00
Victor Zverovich
be9356b651 Specialize MakeUnsigned for all signed integer types. 2014-07-31 21:23:49 -07:00
Victor Zverovich
d81fafc295 Fix tests on MSVC, take 2. 2014-07-31 07:43:14 -07:00
Victor Zverovich
f4156b57f0 Implement 'hh' length specifier in printf. 2014-07-30 08:39:07 -07:00
Victor Zverovich
d346a4120d FormatDec -> format_decimal 2014-07-29 08:45:29 -07:00
Victor Zverovich
ad9c830282 format -> format_str to avoid confusion with function name. 2014-07-29 06:26:44 -07:00
Victor Zverovich
4d049cf598 More fixes for https://github.com/cppformat/cppformat/issues/50. 2014-07-28 08:41:50 -07:00
Victor Zverovich
75b5eb4b9d More fixes for https://github.com/cppformat/cppformat/issues/50. 2014-07-27 15:09:05 -07:00
Victor Zverovich
5d4803a567 More fixes for https://github.com/cppformat/cppformat/issues/50. 2014-07-27 12:53:42 -07:00
Victor Zverovich
a8cef1d987 FormatDecimal -> format_decimal (https://github.com/cppformat/cppformat/issues/50) 2014-07-26 21:31:40 -07:00
Victor Zverovich
2a1c0c9969 Obey line length limit. 2014-07-26 09:45:03 -07:00
Victor Zverovich
f634ccb344 ReportUnknownType -> report_unknown_type (https://github.com/cppformat/cppformat/issues/50) 2014-07-26 08:42:19 -07:00
Victor Zverovich
b498ba0bc5 FormatFloat -> format_float (https://github.com/cppformat/cppformat/issues/50) 2014-07-26 08:03:03 -07:00
Victor Zverovich
37356c3f5e Comment. 2014-07-26 07:26:04 -07:00
Victor Zverovich
2a747b19e0 CheckPtr -> make_ptr (https://github.com/cppformat/cppformat/issues/50) 2014-07-25 08:41:22 -07:00
Victor Zverovich
d142e3b55f Simplify handling of flags. 2014-07-25 08:29:06 -07:00
Victor Zverovich
d699c2a0d9 Don't duplicate integer format specifiers when formatting char as integer. 2014-07-25 08:24:27 -07:00
Victor Zverovich
ca0dcce2a6 CountDigits -> count_digits 2014-07-24 08:59:52 -07:00
Victor Zverovich
c1db293518 Don't use Writer's buffer directly in formatters. Unfriend BasicFormatter. 2014-07-24 08:53:27 -07:00
Victor Zverovich
a7d94f0c61 Fix https://github.com/cppformat/cppformat/issues/55. 2014-07-22 12:37:10 -07:00
Victor Zverovich
f1dfd59a41 HandleArgIndex -> handle_arg_index. Use error_ instead of a local. 2014-07-16 08:49:23 -07:00
Victor Zverovich
f86c812e1a Remove unused SimpleErrorReporter. 2014-07-16 08:48:27 -07:00
Victor Zverovich
4edc88f609 Add FormatterBase. 2014-07-16 08:38:15 -07:00
Victor Zverovich
9144a8fbbe PrintfParser -> PrintfFormatter. 2014-07-16 07:59:45 -07:00
Victor Zverovich
e2a66c58e5 Simplify and test ArgVisitor. 2014-07-16 07:55:31 -07:00
Victor Zverovich
9d74f9542b IsNegative -> is_negative. Simplify WidthHandler and ArgFormatter. 2014-07-16 07:27:54 -07:00
Victor Zverovich
512e2ced93 Rewrite argument formatting using ArgVisitor. 2014-07-14 08:47:03 -07:00
Victor Zverovich
e3a2ac8725 Move StringValue to Arg & simplify StringTraits. 2014-07-14 08:04:17 -07:00
Victor Zverovich
591ad0a64a Add ArgVisitor. 2014-07-14 06:55:29 -07:00
Victor Zverovich
e3a44c11f6 Add an overload of print that accepts std::ostream. 2014-07-09 06:56:36 -07:00
Victor Zverovich
1d7bd5d073 Add c_str functions. 2014-07-08 16:44:24 -07:00
Victor Zverovich
b9a06bafd8 internal::FormatParser -> BasicFormatter. 2014-07-08 16:38:50 -07:00
Victor Zverovich
e825156add Move FormatParser to the internal namespace. 2014-07-08 16:20:33 -07:00
Victor Zverovich
f711266244 Test MakeArg. Clean the API. 2014-07-04 07:18:44 -07:00
Victor Zverovich
144e1fbb7c Disallow formatting of wide strings when using a narrow string formatter. 2014-07-04 06:56:19 -07:00
Victor Zverovich
4e260e8599 Test MakeArg and fix formatting. 2014-07-03 08:50:57 -07:00
Victor Zverovich
9fbdc32adc Test MakeArg and handle bool, signed char and unsigned char. 2014-07-02 08:38:31 -07:00
Victor Zverovich
6e5551e77a ArgInfo -> Arg 2014-07-02 06:33:25 -07:00
Victor Zverovich
c494c980b6 Clean. 2014-07-01 21:01:15 -07:00
Victor Zverovich
5d15bdd5a5 Clean. 2014-07-01 16:23:50 -07:00
Victor Zverovich
39166f9aa9 Remove more deprecated code. 2014-07-01 09:15:20 -07:00
Victor Zverovich
2dc108b31f Remove deprecated code 🎆 🎆 🎆 2014-07-01 09:10:43 -07:00
Victor Zverovich
537c6c4e18 Fix a warning. 2014-07-01 06:21:51 -07:00
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