Sync from g3 to gh

This commit is contained in:
Corentin Le Molgat
2020-07-24 12:40:38 +02:00
committed by Mizux Seiha
parent 6b8305a492
commit 3522b5d82a
4 changed files with 66 additions and 9 deletions

View File

@@ -60,7 +60,7 @@ cc_library(
deps = [
":base",
":statusor",
"@com_google_absl//absl/status",
"@com_google_absl//absl/status",
],
)
@@ -91,7 +91,7 @@ cc_library(
],
deps = [
":base",
"@com_google_absl//absl/strings:strings",
"@com_google_absl//absl/strings",
],
)
@@ -105,8 +105,8 @@ cc_library(
],
deps = [
":base",
"@com_google_absl//absl/strings",
"@com_google_absl//absl/status",
"@com_google_absl//absl/strings",
"@com_google_protobuf//:protobuf",
],
)
@@ -118,7 +118,7 @@ cc_library(
":base",
":file",
"@com_google_absl//absl/status",
"@com_google_absl//absl/strings:strings",
"@com_google_absl//absl/strings",
],
)
@@ -136,7 +136,7 @@ cc_library(
":file",
":statusor",
"@com_google_absl//absl/strings:strings",
"@com_google_absl//absl/strings",
"@com_google_protobuf//:protobuf",
],
)
@@ -162,7 +162,7 @@ cc_library(
],
deps = [
":base",
"@com_google_absl//absl/strings:strings",
"@com_google_absl//absl/strings",
#"@com_google_protobuf//:protobuf",
],
)
@@ -207,7 +207,7 @@ cc_library(
deps = [
":base",
":hash",
"@com_google_absl//absl/strings:strings",
"@com_google_absl//absl/strings",
],
)
@@ -241,6 +241,17 @@ cc_library(
],
)
cc_library(
name = "status_builder",
hdrs = [
"status_builder.h",
],
deps = [
":base",
"@com_google_absl//absl/status",
],
)
cc_library(
name = "protobuf_util",
hdrs = [

View File

@@ -80,7 +80,7 @@ struct AccessStorage {
}
};
} // namespace cleanup_internal
} // namespace cleanup_internal
template <typename Callback>
class ABSL_MUST_USE_RESULT Cleanup {

View File

@@ -26,6 +26,6 @@ std::once_flag init_done;
void FixFlagsAndEnvironmentForSwig() {
std::call_once(init_done, [] { google::InitGoogleLogging("swig_helper"); });
FLAGS_logtostderr = true;
absl::SetFlag(&FLAGS_logtostderr, true);
FLAGS_log_prefix = false;
}

View File

@@ -0,0 +1,46 @@
// Copyright 2010-2018 Google LLC
// 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 OR_TOOLS_BASE_STATUS_BUILDER_H_
#define OR_TOOLS_BASE_STATUS_BUILDER_H_
#include <sstream>
#include "absl/status/status.h"
namespace util {
class StatusBuilder {
public:
explicit StatusBuilder(const absl::Status& status) : code_(status.code()) {
ss_ << std::string(status.message());
}
operator absl::Status() const { // NOLINT
return absl::Status(code_, ss_.str());
}
template <class T>
StatusBuilder& operator<<(const T& t) {
ss_ << t;
return *this;
}
private:
const absl::StatusCode code_;
std::ostringstream ss_;
};
} // namespace util
#endif // OR_TOOLS_BASE_STATUS_BUILDER_H_