00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067 #ifndef ABSL_STRINGS_SUBSTITUTE_H_
00068 #define ABSL_STRINGS_SUBSTITUTE_H_
00069
00070 #include <cstring>
00071 #include <string>
00072 #include <type_traits>
00073 #include <vector>
00074
00075 #include "absl/base/macros.h"
00076 #include "absl/base/port.h"
00077 #include "absl/strings/ascii.h"
00078 #include "absl/strings/escaping.h"
00079 #include "absl/strings/numbers.h"
00080 #include "absl/strings/str_cat.h"
00081 #include "absl/strings/str_split.h"
00082 #include "absl/strings/string_view.h"
00083 #include "absl/strings/strip.h"
00084
00085 namespace absl {
00086 namespace substitute_internal {
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096 class Arg {
00097 public:
00098
00099
00100
00101 Arg(const char* value)
00102 : piece_(absl::NullSafeStringView(value)) {}
00103 template <typename Allocator>
00104 Arg(
00105 const std::basic_string<char, std::char_traits<char>, Allocator>&
00106 value) noexcept
00107 : piece_(value) {}
00108 Arg(absl::string_view value)
00109 : piece_(value) {}
00110
00111
00112
00113
00114
00115
00116
00117
00118 Arg(char value)
00119 : piece_(scratch_, 1) { scratch_[0] = value; }
00120 Arg(short value)
00121 : piece_(scratch_,
00122 numbers_internal::FastIntToBuffer(value, scratch_) - scratch_) {}
00123 Arg(unsigned short value)
00124 : piece_(scratch_,
00125 numbers_internal::FastIntToBuffer(value, scratch_) - scratch_) {}
00126 Arg(int value)
00127 : piece_(scratch_,
00128 numbers_internal::FastIntToBuffer(value, scratch_) - scratch_) {}
00129 Arg(unsigned int value)
00130 : piece_(scratch_,
00131 numbers_internal::FastIntToBuffer(value, scratch_) - scratch_) {}
00132 Arg(long value)
00133 : piece_(scratch_,
00134 numbers_internal::FastIntToBuffer(value, scratch_) - scratch_) {}
00135 Arg(unsigned long value)
00136 : piece_(scratch_,
00137 numbers_internal::FastIntToBuffer(value, scratch_) - scratch_) {}
00138 Arg(long long value)
00139 : piece_(scratch_,
00140 numbers_internal::FastIntToBuffer(value, scratch_) - scratch_) {}
00141 Arg(unsigned long long value)
00142 : piece_(scratch_,
00143 numbers_internal::FastIntToBuffer(value, scratch_) - scratch_) {}
00144 Arg(float value)
00145 : piece_(scratch_, numbers_internal::SixDigitsToBuffer(value, scratch_)) {
00146 }
00147 Arg(double value)
00148 : piece_(scratch_, numbers_internal::SixDigitsToBuffer(value, scratch_)) {
00149 }
00150 Arg(bool value)
00151 : piece_(value ? "true" : "false") {}
00152
00153 Arg(Hex hex);
00154 Arg(Dec dec);
00155
00156
00157
00158 template <typename T,
00159 absl::enable_if_t<
00160 std::is_class<T>::value &&
00161 (std::is_same<T, std::vector<bool>::reference>::value ||
00162 std::is_same<T, std::vector<bool>::const_reference>::value)>* =
00163 nullptr>
00164 Arg(T value)
00165 : Arg(static_cast<bool>(value)) {}
00166
00167
00168
00169 Arg(const void* value);
00170
00171 Arg(const Arg&) = delete;
00172 Arg& operator=(const Arg&) = delete;
00173
00174 absl::string_view piece() const { return piece_; }
00175
00176 private:
00177 absl::string_view piece_;
00178 char scratch_[numbers_internal::kFastToBufferSize];
00179 };
00180
00181
00182
00183 void SubstituteAndAppendArray(std::string* output, absl::string_view format,
00184 const absl::string_view* args_array,
00185 size_t num_args);
00186
00187 #if defined(ABSL_BAD_CALL_IF)
00188 constexpr int CalculateOneBit(const char* format) {
00189 return (*format < '0' || *format > '9') ? 0 : (1 << (*format - '0'));
00190 }
00191
00192 constexpr const char* SkipNumber(const char* format) {
00193 return !*format ? format : (format + 1);
00194 }
00195
00196 constexpr int PlaceholderBitmask(const char* format) {
00197 return !*format ? 0 : *format != '$'
00198 ? PlaceholderBitmask(format + 1)
00199 : (CalculateOneBit(format + 1) |
00200 PlaceholderBitmask(SkipNumber(format + 1)));
00201 }
00202 #endif // ABSL_BAD_CALL_IF
00203
00204 }
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228 inline void SubstituteAndAppend(std::string* output, absl::string_view format) {
00229 substitute_internal::SubstituteAndAppendArray(output, format, nullptr, 0);
00230 }
00231
00232 inline void SubstituteAndAppend(std::string* output, absl::string_view format,
00233 const substitute_internal::Arg& a0) {
00234 const absl::string_view args[] = {a0.piece()};
00235 substitute_internal::SubstituteAndAppendArray(output, format, args,
00236 ABSL_ARRAYSIZE(args));
00237 }
00238
00239 inline void SubstituteAndAppend(std::string* output, absl::string_view format,
00240 const substitute_internal::Arg& a0,
00241 const substitute_internal::Arg& a1) {
00242 const absl::string_view args[] = {a0.piece(), a1.piece()};
00243 substitute_internal::SubstituteAndAppendArray(output, format, args,
00244 ABSL_ARRAYSIZE(args));
00245 }
00246
00247 inline void SubstituteAndAppend(std::string* output, absl::string_view format,
00248 const substitute_internal::Arg& a0,
00249 const substitute_internal::Arg& a1,
00250 const substitute_internal::Arg& a2) {
00251 const absl::string_view args[] = {a0.piece(), a1.piece(), a2.piece()};
00252 substitute_internal::SubstituteAndAppendArray(output, format, args,
00253 ABSL_ARRAYSIZE(args));
00254 }
00255
00256 inline void SubstituteAndAppend(std::string* output, absl::string_view format,
00257 const substitute_internal::Arg& a0,
00258 const substitute_internal::Arg& a1,
00259 const substitute_internal::Arg& a2,
00260 const substitute_internal::Arg& a3) {
00261 const absl::string_view args[] = {a0.piece(), a1.piece(), a2.piece(),
00262 a3.piece()};
00263 substitute_internal::SubstituteAndAppendArray(output, format, args,
00264 ABSL_ARRAYSIZE(args));
00265 }
00266
00267 inline void SubstituteAndAppend(std::string* output, absl::string_view format,
00268 const substitute_internal::Arg& a0,
00269 const substitute_internal::Arg& a1,
00270 const substitute_internal::Arg& a2,
00271 const substitute_internal::Arg& a3,
00272 const substitute_internal::Arg& a4) {
00273 const absl::string_view args[] = {a0.piece(), a1.piece(), a2.piece(),
00274 a3.piece(), a4.piece()};
00275 substitute_internal::SubstituteAndAppendArray(output, format, args,
00276 ABSL_ARRAYSIZE(args));
00277 }
00278
00279 inline void SubstituteAndAppend(std::string* output, absl::string_view format,
00280 const substitute_internal::Arg& a0,
00281 const substitute_internal::Arg& a1,
00282 const substitute_internal::Arg& a2,
00283 const substitute_internal::Arg& a3,
00284 const substitute_internal::Arg& a4,
00285 const substitute_internal::Arg& a5) {
00286 const absl::string_view args[] = {a0.piece(), a1.piece(), a2.piece(),
00287 a3.piece(), a4.piece(), a5.piece()};
00288 substitute_internal::SubstituteAndAppendArray(output, format, args,
00289 ABSL_ARRAYSIZE(args));
00290 }
00291
00292 inline void SubstituteAndAppend(std::string* output, absl::string_view format,
00293 const substitute_internal::Arg& a0,
00294 const substitute_internal::Arg& a1,
00295 const substitute_internal::Arg& a2,
00296 const substitute_internal::Arg& a3,
00297 const substitute_internal::Arg& a4,
00298 const substitute_internal::Arg& a5,
00299 const substitute_internal::Arg& a6) {
00300 const absl::string_view args[] = {a0.piece(), a1.piece(), a2.piece(),
00301 a3.piece(), a4.piece(), a5.piece(),
00302 a6.piece()};
00303 substitute_internal::SubstituteAndAppendArray(output, format, args,
00304 ABSL_ARRAYSIZE(args));
00305 }
00306
00307 inline void SubstituteAndAppend(
00308 std::string* output, absl::string_view format,
00309 const substitute_internal::Arg& a0, const substitute_internal::Arg& a1,
00310 const substitute_internal::Arg& a2, const substitute_internal::Arg& a3,
00311 const substitute_internal::Arg& a4, const substitute_internal::Arg& a5,
00312 const substitute_internal::Arg& a6, const substitute_internal::Arg& a7) {
00313 const absl::string_view args[] = {a0.piece(), a1.piece(), a2.piece(),
00314 a3.piece(), a4.piece(), a5.piece(),
00315 a6.piece(), a7.piece()};
00316 substitute_internal::SubstituteAndAppendArray(output, format, args,
00317 ABSL_ARRAYSIZE(args));
00318 }
00319
00320 inline void SubstituteAndAppend(
00321 std::string* output, absl::string_view format,
00322 const substitute_internal::Arg& a0, const substitute_internal::Arg& a1,
00323 const substitute_internal::Arg& a2, const substitute_internal::Arg& a3,
00324 const substitute_internal::Arg& a4, const substitute_internal::Arg& a5,
00325 const substitute_internal::Arg& a6, const substitute_internal::Arg& a7,
00326 const substitute_internal::Arg& a8) {
00327 const absl::string_view args[] = {a0.piece(), a1.piece(), a2.piece(),
00328 a3.piece(), a4.piece(), a5.piece(),
00329 a6.piece(), a7.piece(), a8.piece()};
00330 substitute_internal::SubstituteAndAppendArray(output, format, args,
00331 ABSL_ARRAYSIZE(args));
00332 }
00333
00334 inline void SubstituteAndAppend(
00335 std::string* output, absl::string_view format,
00336 const substitute_internal::Arg& a0, const substitute_internal::Arg& a1,
00337 const substitute_internal::Arg& a2, const substitute_internal::Arg& a3,
00338 const substitute_internal::Arg& a4, const substitute_internal::Arg& a5,
00339 const substitute_internal::Arg& a6, const substitute_internal::Arg& a7,
00340 const substitute_internal::Arg& a8, const substitute_internal::Arg& a9) {
00341 const absl::string_view args[] = {
00342 a0.piece(), a1.piece(), a2.piece(), a3.piece(), a4.piece(),
00343 a5.piece(), a6.piece(), a7.piece(), a8.piece(), a9.piece()};
00344 substitute_internal::SubstituteAndAppendArray(output, format, args,
00345 ABSL_ARRAYSIZE(args));
00346 }
00347
00348 #if defined(ABSL_BAD_CALL_IF)
00349
00350
00351 void SubstituteAndAppend(std::string* output, const char* format)
00352 ABSL_BAD_CALL_IF(substitute_internal::PlaceholderBitmask(format) != 0,
00353 "There were no substitution arguments "
00354 "but this format std::string has a $[0-9] in it");
00355
00356 void SubstituteAndAppend(std::string* output, const char* format,
00357 const substitute_internal::Arg& a0)
00358 ABSL_BAD_CALL_IF(substitute_internal::PlaceholderBitmask(format) != 1,
00359 "There was 1 substitution argument given, but "
00360 "this format std::string is either missing its $0, or "
00361 "contains one of $1-$9");
00362
00363 void SubstituteAndAppend(std::string* output, const char* format,
00364 const substitute_internal::Arg& a0,
00365 const substitute_internal::Arg& a1)
00366 ABSL_BAD_CALL_IF(substitute_internal::PlaceholderBitmask(format) != 3,
00367 "There were 2 substitution arguments given, but "
00368 "this format std::string is either missing its $0/$1, or "
00369 "contains one of $2-$9");
00370
00371 void SubstituteAndAppend(std::string* output, const char* format,
00372 const substitute_internal::Arg& a0,
00373 const substitute_internal::Arg& a1,
00374 const substitute_internal::Arg& a2)
00375 ABSL_BAD_CALL_IF(substitute_internal::PlaceholderBitmask(format) != 7,
00376 "There were 3 substitution arguments given, but "
00377 "this format std::string is either missing its $0/$1/$2, or "
00378 "contains one of $3-$9");
00379
00380 void SubstituteAndAppend(std::string* output, const char* format,
00381 const substitute_internal::Arg& a0,
00382 const substitute_internal::Arg& a1,
00383 const substitute_internal::Arg& a2,
00384 const substitute_internal::Arg& a3)
00385 ABSL_BAD_CALL_IF(substitute_internal::PlaceholderBitmask(format) != 15,
00386 "There were 4 substitution arguments given, but "
00387 "this format std::string is either missing its $0-$3, or "
00388 "contains one of $4-$9");
00389
00390 void SubstituteAndAppend(std::string* output, const char* format,
00391 const substitute_internal::Arg& a0,
00392 const substitute_internal::Arg& a1,
00393 const substitute_internal::Arg& a2,
00394 const substitute_internal::Arg& a3,
00395 const substitute_internal::Arg& a4)
00396 ABSL_BAD_CALL_IF(substitute_internal::PlaceholderBitmask(format) != 31,
00397 "There were 5 substitution arguments given, but "
00398 "this format std::string is either missing its $0-$4, or "
00399 "contains one of $5-$9");
00400
00401 void SubstituteAndAppend(std::string* output, const char* format,
00402 const substitute_internal::Arg& a0,
00403 const substitute_internal::Arg& a1,
00404 const substitute_internal::Arg& a2,
00405 const substitute_internal::Arg& a3,
00406 const substitute_internal::Arg& a4,
00407 const substitute_internal::Arg& a5)
00408 ABSL_BAD_CALL_IF(substitute_internal::PlaceholderBitmask(format) != 63,
00409 "There were 6 substitution arguments given, but "
00410 "this format std::string is either missing its $0-$5, or "
00411 "contains one of $6-$9");
00412
00413 void SubstituteAndAppend(
00414 std::string* output, const char* format, const substitute_internal::Arg& a0,
00415 const substitute_internal::Arg& a1, const substitute_internal::Arg& a2,
00416 const substitute_internal::Arg& a3, const substitute_internal::Arg& a4,
00417 const substitute_internal::Arg& a5, const substitute_internal::Arg& a6)
00418 ABSL_BAD_CALL_IF(substitute_internal::PlaceholderBitmask(format) != 127,
00419 "There were 7 substitution arguments given, but "
00420 "this format std::string is either missing its $0-$6, or "
00421 "contains one of $7-$9");
00422
00423 void SubstituteAndAppend(
00424 std::string* output, const char* format, const substitute_internal::Arg& a0,
00425 const substitute_internal::Arg& a1, const substitute_internal::Arg& a2,
00426 const substitute_internal::Arg& a3, const substitute_internal::Arg& a4,
00427 const substitute_internal::Arg& a5, const substitute_internal::Arg& a6,
00428 const substitute_internal::Arg& a7)
00429 ABSL_BAD_CALL_IF(substitute_internal::PlaceholderBitmask(format) != 255,
00430 "There were 8 substitution arguments given, but "
00431 "this format std::string is either missing its $0-$7, or "
00432 "contains one of $8-$9");
00433
00434 void SubstituteAndAppend(
00435 std::string* output, const char* format, const substitute_internal::Arg& a0,
00436 const substitute_internal::Arg& a1, const substitute_internal::Arg& a2,
00437 const substitute_internal::Arg& a3, const substitute_internal::Arg& a4,
00438 const substitute_internal::Arg& a5, const substitute_internal::Arg& a6,
00439 const substitute_internal::Arg& a7, const substitute_internal::Arg& a8)
00440 ABSL_BAD_CALL_IF(
00441 substitute_internal::PlaceholderBitmask(format) != 511,
00442 "There were 9 substitution arguments given, but "
00443 "this format std::string is either missing its $0-$8, or contains a $9");
00444
00445 void SubstituteAndAppend(
00446 std::string* output, const char* format, const substitute_internal::Arg& a0,
00447 const substitute_internal::Arg& a1, const substitute_internal::Arg& a2,
00448 const substitute_internal::Arg& a3, const substitute_internal::Arg& a4,
00449 const substitute_internal::Arg& a5, const substitute_internal::Arg& a6,
00450 const substitute_internal::Arg& a7, const substitute_internal::Arg& a8,
00451 const substitute_internal::Arg& a9)
00452 ABSL_BAD_CALL_IF(substitute_internal::PlaceholderBitmask(format) != 1023,
00453 "There were 10 substitution arguments given, but this "
00454 "format std::string doesn't contain all of $0 through $9");
00455 #endif // ABSL_BAD_CALL_IF
00456
00457
00458
00459
00460
00461
00462
00463
00464
00465
00466
00467
00468
00469
00470
00471
00472
00473 ABSL_MUST_USE_RESULT inline std::string Substitute(absl::string_view format) {
00474 std::string result;
00475 SubstituteAndAppend(&result, format);
00476 return result;
00477 }
00478
00479 ABSL_MUST_USE_RESULT inline std::string Substitute(
00480 absl::string_view format, const substitute_internal::Arg& a0) {
00481 std::string result;
00482 SubstituteAndAppend(&result, format, a0);
00483 return result;
00484 }
00485
00486 ABSL_MUST_USE_RESULT inline std::string Substitute(
00487 absl::string_view format, const substitute_internal::Arg& a0,
00488 const substitute_internal::Arg& a1) {
00489 std::string result;
00490 SubstituteAndAppend(&result, format, a0, a1);
00491 return result;
00492 }
00493
00494 ABSL_MUST_USE_RESULT inline std::string Substitute(
00495 absl::string_view format, const substitute_internal::Arg& a0,
00496 const substitute_internal::Arg& a1, const substitute_internal::Arg& a2) {
00497 std::string result;
00498 SubstituteAndAppend(&result, format, a0, a1, a2);
00499 return result;
00500 }
00501
00502 ABSL_MUST_USE_RESULT inline std::string Substitute(
00503 absl::string_view format, const substitute_internal::Arg& a0,
00504 const substitute_internal::Arg& a1, const substitute_internal::Arg& a2,
00505 const substitute_internal::Arg& a3) {
00506 std::string result;
00507 SubstituteAndAppend(&result, format, a0, a1, a2, a3);
00508 return result;
00509 }
00510
00511 ABSL_MUST_USE_RESULT inline std::string Substitute(
00512 absl::string_view format, const substitute_internal::Arg& a0,
00513 const substitute_internal::Arg& a1, const substitute_internal::Arg& a2,
00514 const substitute_internal::Arg& a3, const substitute_internal::Arg& a4) {
00515 std::string result;
00516 SubstituteAndAppend(&result, format, a0, a1, a2, a3, a4);
00517 return result;
00518 }
00519
00520 ABSL_MUST_USE_RESULT inline std::string Substitute(
00521 absl::string_view format, const substitute_internal::Arg& a0,
00522 const substitute_internal::Arg& a1, const substitute_internal::Arg& a2,
00523 const substitute_internal::Arg& a3, const substitute_internal::Arg& a4,
00524 const substitute_internal::Arg& a5) {
00525 std::string result;
00526 SubstituteAndAppend(&result, format, a0, a1, a2, a3, a4, a5);
00527 return result;
00528 }
00529
00530 ABSL_MUST_USE_RESULT inline std::string Substitute(
00531 absl::string_view format, const substitute_internal::Arg& a0,
00532 const substitute_internal::Arg& a1, const substitute_internal::Arg& a2,
00533 const substitute_internal::Arg& a3, const substitute_internal::Arg& a4,
00534 const substitute_internal::Arg& a5, const substitute_internal::Arg& a6) {
00535 std::string result;
00536 SubstituteAndAppend(&result, format, a0, a1, a2, a3, a4, a5, a6);
00537 return result;
00538 }
00539
00540 ABSL_MUST_USE_RESULT inline std::string Substitute(
00541 absl::string_view format, const substitute_internal::Arg& a0,
00542 const substitute_internal::Arg& a1, const substitute_internal::Arg& a2,
00543 const substitute_internal::Arg& a3, const substitute_internal::Arg& a4,
00544 const substitute_internal::Arg& a5, const substitute_internal::Arg& a6,
00545 const substitute_internal::Arg& a7) {
00546 std::string result;
00547 SubstituteAndAppend(&result, format, a0, a1, a2, a3, a4, a5, a6, a7);
00548 return result;
00549 }
00550
00551 ABSL_MUST_USE_RESULT inline std::string Substitute(
00552 absl::string_view format, const substitute_internal::Arg& a0,
00553 const substitute_internal::Arg& a1, const substitute_internal::Arg& a2,
00554 const substitute_internal::Arg& a3, const substitute_internal::Arg& a4,
00555 const substitute_internal::Arg& a5, const substitute_internal::Arg& a6,
00556 const substitute_internal::Arg& a7, const substitute_internal::Arg& a8) {
00557 std::string result;
00558 SubstituteAndAppend(&result, format, a0, a1, a2, a3, a4, a5, a6, a7, a8);
00559 return result;
00560 }
00561
00562 ABSL_MUST_USE_RESULT inline std::string Substitute(
00563 absl::string_view format, const substitute_internal::Arg& a0,
00564 const substitute_internal::Arg& a1, const substitute_internal::Arg& a2,
00565 const substitute_internal::Arg& a3, const substitute_internal::Arg& a4,
00566 const substitute_internal::Arg& a5, const substitute_internal::Arg& a6,
00567 const substitute_internal::Arg& a7, const substitute_internal::Arg& a8,
00568 const substitute_internal::Arg& a9) {
00569 std::string result;
00570 SubstituteAndAppend(&result, format, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
00571 return result;
00572 }
00573
00574 #if defined(ABSL_BAD_CALL_IF)
00575
00576
00577 std::string Substitute(const char* format)
00578 ABSL_BAD_CALL_IF(substitute_internal::PlaceholderBitmask(format) != 0,
00579 "There were no substitution arguments "
00580 "but this format std::string has a $[0-9] in it");
00581
00582 std::string Substitute(const char* format, const substitute_internal::Arg& a0)
00583 ABSL_BAD_CALL_IF(substitute_internal::PlaceholderBitmask(format) != 1,
00584 "There was 1 substitution argument given, but "
00585 "this format std::string is either missing its $0, or "
00586 "contains one of $1-$9");
00587
00588 std::string Substitute(const char* format, const substitute_internal::Arg& a0,
00589 const substitute_internal::Arg& a1)
00590 ABSL_BAD_CALL_IF(substitute_internal::PlaceholderBitmask(format) != 3,
00591 "There were 2 substitution arguments given, but "
00592 "this format std::string is either missing its $0/$1, or "
00593 "contains one of $2-$9");
00594
00595 std::string Substitute(const char* format, const substitute_internal::Arg& a0,
00596 const substitute_internal::Arg& a1,
00597 const substitute_internal::Arg& a2)
00598 ABSL_BAD_CALL_IF(substitute_internal::PlaceholderBitmask(format) != 7,
00599 "There were 3 substitution arguments given, but "
00600 "this format std::string is either missing its $0/$1/$2, or "
00601 "contains one of $3-$9");
00602
00603 std::string Substitute(const char* format, const substitute_internal::Arg& a0,
00604 const substitute_internal::Arg& a1,
00605 const substitute_internal::Arg& a2,
00606 const substitute_internal::Arg& a3)
00607 ABSL_BAD_CALL_IF(substitute_internal::PlaceholderBitmask(format) != 15,
00608 "There were 4 substitution arguments given, but "
00609 "this format std::string is either missing its $0-$3, or "
00610 "contains one of $4-$9");
00611
00612 std::string Substitute(const char* format, const substitute_internal::Arg& a0,
00613 const substitute_internal::Arg& a1,
00614 const substitute_internal::Arg& a2,
00615 const substitute_internal::Arg& a3,
00616 const substitute_internal::Arg& a4)
00617 ABSL_BAD_CALL_IF(substitute_internal::PlaceholderBitmask(format) != 31,
00618 "There were 5 substitution arguments given, but "
00619 "this format std::string is either missing its $0-$4, or "
00620 "contains one of $5-$9");
00621
00622 std::string Substitute(const char* format, const substitute_internal::Arg& a0,
00623 const substitute_internal::Arg& a1,
00624 const substitute_internal::Arg& a2,
00625 const substitute_internal::Arg& a3,
00626 const substitute_internal::Arg& a4,
00627 const substitute_internal::Arg& a5)
00628 ABSL_BAD_CALL_IF(substitute_internal::PlaceholderBitmask(format) != 63,
00629 "There were 6 substitution arguments given, but "
00630 "this format std::string is either missing its $0-$5, or "
00631 "contains one of $6-$9");
00632
00633 std::string Substitute(const char* format, const substitute_internal::Arg& a0,
00634 const substitute_internal::Arg& a1,
00635 const substitute_internal::Arg& a2,
00636 const substitute_internal::Arg& a3,
00637 const substitute_internal::Arg& a4,
00638 const substitute_internal::Arg& a5,
00639 const substitute_internal::Arg& a6)
00640 ABSL_BAD_CALL_IF(substitute_internal::PlaceholderBitmask(format) != 127,
00641 "There were 7 substitution arguments given, but "
00642 "this format std::string is either missing its $0-$6, or "
00643 "contains one of $7-$9");
00644
00645 std::string Substitute(const char* format, const substitute_internal::Arg& a0,
00646 const substitute_internal::Arg& a1,
00647 const substitute_internal::Arg& a2,
00648 const substitute_internal::Arg& a3,
00649 const substitute_internal::Arg& a4,
00650 const substitute_internal::Arg& a5,
00651 const substitute_internal::Arg& a6,
00652 const substitute_internal::Arg& a7)
00653 ABSL_BAD_CALL_IF(substitute_internal::PlaceholderBitmask(format) != 255,
00654 "There were 8 substitution arguments given, but "
00655 "this format std::string is either missing its $0-$7, or "
00656 "contains one of $8-$9");
00657
00658 std::string Substitute(
00659 const char* format, const substitute_internal::Arg& a0,
00660 const substitute_internal::Arg& a1, const substitute_internal::Arg& a2,
00661 const substitute_internal::Arg& a3, const substitute_internal::Arg& a4,
00662 const substitute_internal::Arg& a5, const substitute_internal::Arg& a6,
00663 const substitute_internal::Arg& a7, const substitute_internal::Arg& a8)
00664 ABSL_BAD_CALL_IF(
00665 substitute_internal::PlaceholderBitmask(format) != 511,
00666 "There were 9 substitution arguments given, but "
00667 "this format std::string is either missing its $0-$8, or contains a $9");
00668
00669 std::string Substitute(
00670 const char* format, const substitute_internal::Arg& a0,
00671 const substitute_internal::Arg& a1, const substitute_internal::Arg& a2,
00672 const substitute_internal::Arg& a3, const substitute_internal::Arg& a4,
00673 const substitute_internal::Arg& a5, const substitute_internal::Arg& a6,
00674 const substitute_internal::Arg& a7, const substitute_internal::Arg& a8,
00675 const substitute_internal::Arg& a9)
00676 ABSL_BAD_CALL_IF(substitute_internal::PlaceholderBitmask(format) != 1023,
00677 "There were 10 substitution arguments given, but this "
00678 "format std::string doesn't contain all of $0 through $9");
00679 #endif // ABSL_BAD_CALL_IF
00680
00681 }
00682
00683 #endif // ABSL_STRINGS_SUBSTITUTE_H_