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