Move base64 from core/lib/strings to core/platform
PiperOrigin-RevId: 283249015 Change-Id: I7600a1743d9c9680b8d1960cde96a1c75cc2cdcc
This commit is contained in:
parent
0a0c4d76e9
commit
b82ab06d4b
@ -14,11 +14,9 @@ package(
|
|||||||
|
|
||||||
cc_library(
|
cc_library(
|
||||||
name = "base64",
|
name = "base64",
|
||||||
srcs = ["base64.cc"],
|
|
||||||
hdrs = ["base64.h"],
|
hdrs = ["base64.h"],
|
||||||
deps = [
|
deps = [
|
||||||
"//tensorflow/core/lib/core:errors",
|
"//tensorflow/core/platform:base64",
|
||||||
"//tensorflow/core/lib/core:status",
|
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -113,7 +111,6 @@ filegroup(
|
|||||||
filegroup(
|
filegroup(
|
||||||
name = "legacy_lib_strings_all_srcs",
|
name = "legacy_lib_strings_all_srcs",
|
||||||
srcs = [
|
srcs = [
|
||||||
"base64.cc",
|
|
||||||
"ordered_code.cc",
|
"ordered_code.cc",
|
||||||
"proto_serialization.cc",
|
"proto_serialization.cc",
|
||||||
"proto_text_util.cc",
|
"proto_text_util.cc",
|
||||||
|
@ -16,43 +16,6 @@ limitations under the License.
|
|||||||
#ifndef TENSORFLOW_CORE_LIB_STRINGS_BASE64_H_
|
#ifndef TENSORFLOW_CORE_LIB_STRINGS_BASE64_H_
|
||||||
#define TENSORFLOW_CORE_LIB_STRINGS_BASE64_H_
|
#define TENSORFLOW_CORE_LIB_STRINGS_BASE64_H_
|
||||||
|
|
||||||
#include <string>
|
#include "tensorflow/core/platform/base64.h"
|
||||||
#include "tensorflow/core/lib/core/status.h"
|
|
||||||
|
|
||||||
namespace tensorflow {
|
|
||||||
|
|
||||||
/// \brief Converts data into web-safe base64 encoding.
|
|
||||||
///
|
|
||||||
/// See https://en.wikipedia.org/wiki/Base64
|
|
||||||
template <typename T>
|
|
||||||
Status Base64Encode(StringPiece source, bool with_padding, T* encoded);
|
|
||||||
template <typename T>
|
|
||||||
Status Base64Encode(StringPiece source,
|
|
||||||
T* encoded); // with_padding=false.
|
|
||||||
|
|
||||||
/// \brief Converts data from web-safe base64 encoding.
|
|
||||||
///
|
|
||||||
/// See https://en.wikipedia.org/wiki/Base64
|
|
||||||
template <typename T>
|
|
||||||
Status Base64Decode(StringPiece data, T* decoded);
|
|
||||||
|
|
||||||
// Explicit instantiations defined in base64.cc.
|
|
||||||
extern template Status Base64Decode<string>(StringPiece data, string* decoded);
|
|
||||||
extern template Status Base64Encode<string>(StringPiece source,
|
|
||||||
string* encoded);
|
|
||||||
extern template Status Base64Encode<string>(StringPiece source,
|
|
||||||
bool with_padding, string* encoded);
|
|
||||||
|
|
||||||
#ifdef USE_TSTRING
|
|
||||||
extern template Status Base64Decode<tstring>(StringPiece data,
|
|
||||||
tstring* decoded);
|
|
||||||
extern template Status Base64Encode<tstring>(StringPiece source,
|
|
||||||
tstring* encoded);
|
|
||||||
extern template Status Base64Encode<tstring>(StringPiece source,
|
|
||||||
bool with_padding,
|
|
||||||
tstring* encoded);
|
|
||||||
#endif // USE_TSTRING
|
|
||||||
|
|
||||||
} // namespace tensorflow
|
|
||||||
|
|
||||||
#endif // TENSORFLOW_CORE_LIB_STRINGS_BASE64_H_
|
#endif // TENSORFLOW_CORE_LIB_STRINGS_BASE64_H_
|
||||||
|
@ -83,6 +83,16 @@ cc_library(
|
|||||||
deps = [":types"],
|
deps = [":types"],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
cc_library(
|
||||||
|
name = "base64",
|
||||||
|
srcs = ["base64.cc"],
|
||||||
|
hdrs = ["base64.h"],
|
||||||
|
deps = [
|
||||||
|
":errors",
|
||||||
|
":status",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
cc_library(
|
cc_library(
|
||||||
name = "blocking_counter",
|
name = "blocking_counter",
|
||||||
hdrs = ["blocking_counter.h"],
|
hdrs = ["blocking_counter.h"],
|
||||||
|
@ -13,11 +13,11 @@ See the License for the specific language governing permissions and
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
==============================================================================*/
|
==============================================================================*/
|
||||||
|
|
||||||
#include "tensorflow/core/lib/strings/base64.h"
|
#include "tensorflow/core/platform/base64.h"
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include "tensorflow/core/lib/core/errors.h"
|
#include "tensorflow/core/platform/errors.h"
|
||||||
|
|
||||||
namespace tensorflow {
|
namespace tensorflow {
|
||||||
namespace {
|
namespace {
|
58
tensorflow/core/platform/base64.h
Normal file
58
tensorflow/core/platform/base64.h
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
/* Copyright 2016 The TensorFlow Authors. All Rights Reserved.
|
||||||
|
|
||||||
|
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 TENSORFLOW_CORE_PLATFORM_BASE64_H_
|
||||||
|
#define TENSORFLOW_CORE_PLATFORM_BASE64_H_
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include "tensorflow/core/platform/status.h"
|
||||||
|
|
||||||
|
namespace tensorflow {
|
||||||
|
|
||||||
|
/// \brief Converts data into web-safe base64 encoding.
|
||||||
|
///
|
||||||
|
/// See https://en.wikipedia.org/wiki/Base64
|
||||||
|
template <typename T>
|
||||||
|
Status Base64Encode(StringPiece source, bool with_padding, T* encoded);
|
||||||
|
template <typename T>
|
||||||
|
Status Base64Encode(StringPiece source,
|
||||||
|
T* encoded); // with_padding=false.
|
||||||
|
|
||||||
|
/// \brief Converts data from web-safe base64 encoding.
|
||||||
|
///
|
||||||
|
/// See https://en.wikipedia.org/wiki/Base64
|
||||||
|
template <typename T>
|
||||||
|
Status Base64Decode(StringPiece data, T* decoded);
|
||||||
|
|
||||||
|
// Explicit instantiations defined in base64.cc.
|
||||||
|
extern template Status Base64Decode<string>(StringPiece data, string* decoded);
|
||||||
|
extern template Status Base64Encode<string>(StringPiece source,
|
||||||
|
string* encoded);
|
||||||
|
extern template Status Base64Encode<string>(StringPiece source,
|
||||||
|
bool with_padding, string* encoded);
|
||||||
|
|
||||||
|
#ifdef USE_TSTRING
|
||||||
|
extern template Status Base64Decode<tstring>(StringPiece data,
|
||||||
|
tstring* decoded);
|
||||||
|
extern template Status Base64Encode<tstring>(StringPiece source,
|
||||||
|
tstring* encoded);
|
||||||
|
extern template Status Base64Encode<tstring>(StringPiece source,
|
||||||
|
bool with_padding,
|
||||||
|
tstring* encoded);
|
||||||
|
#endif // USE_TSTRING
|
||||||
|
|
||||||
|
} // namespace tensorflow
|
||||||
|
|
||||||
|
#endif // TENSORFLOW_CORE_PLATFORM_BASE64_H_
|
Loading…
x
Reference in New Issue
Block a user