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.

43 rivejä
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 <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. // 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. extern bool ConsumeDecimalNumber(Slice* in, uint64_t* val);
  31. } // namespace leveldb
  32. #endif // STORAGE_LEVELDB_UTIL_LOGGING_H_