Home | History | Annotate | Download | only in util
      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 
      8 #ifndef STORAGE_LEVELDB_UTIL_LOGGING_H_
      9 #define STORAGE_LEVELDB_UTIL_LOGGING_H_
     10 
     11 #include <stdio.h>
     12 #include <stdint.h>
     13 #include <string>
     14 #include "port/port.h"
     15 
     16 namespace leveldb {
     17 
     18 class Slice;
     19 class WritableFile;
     20 
     21 // Append a human-readable printout of "num" to *str
     22 extern void AppendNumberTo(std::string* str, uint64_t num);
     23 
     24 // Append a human-readable printout of "value" to *str.
     25 // Escapes any non-printable characters found in "value".
     26 extern void AppendEscapedStringTo(std::string* str, const Slice& value);
     27 
     28 // Return a human-readable printout of "num"
     29 extern std::string NumberToString(uint64_t num);
     30 
     31 // Return a human-readable version of "value".
     32 // Escapes any non-printable characters found in "value".
     33 extern std::string EscapeString(const Slice& value);
     34 
     35 // If *in starts with "c", advances *in past the first character and
     36 // returns true.  Otherwise, returns false.
     37 extern bool ConsumeChar(Slice* in, char c);
     38 
     39 // Parse a human-readable number from "*in" into *value.  On success,
     40 // advances "*in" past the consumed number and sets "*val" to the
     41 // numeric value.  Otherwise, returns false and leaves *in in an
     42 // unspecified state.
     43 extern bool ConsumeDecimalNumber(Slice* in, uint64_t* val);
     44 
     45 }  // namespace leveldb
     46 
     47 #endif  // STORAGE_LEVELDB_UTIL_LOGGING_H_
     48