/* * Copyright (C) 2019 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef INCLUDE_PERFETTO_BASE_STATUS_H_ #define INCLUDE_PERFETTO_BASE_STATUS_H_ #include <optional> #include <string> #include <string_view> #include <vector> #include "perfetto/base/compiler.h" #include "perfetto/base/export.h" #include "perfetto/base/logging.h" namespace perfetto { namespace base { // Represents either the success or the failure message of a function. // This can used as the return type of functions which would usually return an // bool for success or int for errno but also wants to add some string context // (ususally for logging). // // Similar to absl::Status, an optional "payload" can also be included with more // context about the error. This allows passing additional metadata about the // error (e.g. location of errors, potential mitigations etc). class PERFETTO_EXPORT_COMPONENT Status { … }; // Returns a status object which represents the Ok status. inline Status OkStatus() { … } Status ErrStatus(const char* format, ...) PERFETTO_PRINTF_FORMAT(1, 2); } // namespace base } // namespace perfetto #endif // INCLUDE_PERFETTO_BASE_STATUS_H_