小组成员:姚凯文(kevinyao0901),姜嘉琪
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
1.4 KiB

  1. // Copyright (c) 2011 The LevelDB Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file. See the AUTHORS file for names of contributors.
  4. //
  5. // Must not be included from any .h files to avoid polluting the namespace
  6. // with macros.
  7. #ifndef STORAGE_LEVELDB_UTIL_LOGGING_H_
  8. #define STORAGE_LEVELDB_UTIL_LOGGING_H_
  9. #include <cstdint>
  10. #include <cstdio>
  11. #include <string>
  12. #include "port/port.h"
  13. namespace leveldb {
  14. class Slice;
  15. class WritableFile;
  16. // Append a human-readable printout of "num" to *str
  17. void AppendNumberTo(std::string* str, uint64_t num);
  18. // Append a human-readable printout of "value" to *str.
  19. // Escapes any non-printable characters found in "value".
  20. void AppendEscapedStringTo(std::string* str, const Slice& value);
  21. // Return a human-readable printout of "num"
  22. std::string NumberToString(uint64_t num);
  23. // Return a human-readable version of "value".
  24. // Escapes any non-printable characters found in "value".
  25. std::string EscapeString(const Slice& value);
  26. // Parse a human-readable number from "*in" into *value. On success,
  27. // advances "*in" past the consumed number and sets "*val" to the
  28. // numeric value. Otherwise, returns false and leaves *in in an
  29. // unspecified state.
  30. bool ConsumeDecimalNumber(Slice* in, uint64_t* val);
  31. } // namespace leveldb
  32. #endif // STORAGE_LEVELDB_UTIL_LOGGING_H_