10225501448 李度 10225101546 陈胤遒 10215501422 高宇菲
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.

47 lines
1.6 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 <stdio.h>
  10. #include <stdint.h>
  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. extern 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. extern void AppendEscapedStringTo(std::string* str, const Slice& value);
  21. // Return a human-readable printout of "num"
  22. extern std::string NumberToString(uint64_t num);
  23. // Return a human-readable version of "value".
  24. // Escapes any non-printable characters found in "value".
  25. extern std::string EscapeString(const Slice& value);
  26. // If *in starts with "c", advances *in past the first character and
  27. // returns true. Otherwise, returns false.
  28. extern bool ConsumeChar(Slice* in, char c);
  29. // Parse a human-readable number from "*in" into *value. On success,
  30. // advances "*in" past the consumed number and sets "*val" to the
  31. // numeric value. Otherwise, returns false and leaves *in in an
  32. // unspecified state.
  33. extern bool ConsumeDecimalNumber(Slice* in, uint64_t* val);
  34. } // namespace leveldb
  35. #endif // STORAGE_LEVELDB_UTIL_LOGGING_H_