diff --git a/tensorflow/core/lib/strings/BUILD b/tensorflow/core/lib/strings/BUILD index 598a8bc5a47..31425aabc10 100644 --- a/tensorflow/core/lib/strings/BUILD +++ b/tensorflow/core/lib/strings/BUILD @@ -14,11 +14,9 @@ package( cc_library( name = "base64", - srcs = ["base64.cc"], hdrs = ["base64.h"], deps = [ - "//tensorflow/core/lib/core:errors", - "//tensorflow/core/lib/core:status", + "//tensorflow/core/platform:base64", ], ) @@ -113,7 +111,6 @@ filegroup( filegroup( name = "legacy_lib_strings_all_srcs", srcs = [ - "base64.cc", "ordered_code.cc", "proto_serialization.cc", "proto_text_util.cc", diff --git a/tensorflow/core/lib/strings/base64.h b/tensorflow/core/lib/strings/base64.h index 15a273b36a9..bb7cbfb3777 100644 --- a/tensorflow/core/lib/strings/base64.h +++ b/tensorflow/core/lib/strings/base64.h @@ -16,43 +16,6 @@ limitations under the License. #ifndef TENSORFLOW_CORE_LIB_STRINGS_BASE64_H_ #define TENSORFLOW_CORE_LIB_STRINGS_BASE64_H_ -#include -#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 -Status Base64Encode(StringPiece source, bool with_padding, T* encoded); -template -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 -Status Base64Decode(StringPiece data, T* decoded); - -// Explicit instantiations defined in base64.cc. -extern template Status Base64Decode(StringPiece data, string* decoded); -extern template Status Base64Encode(StringPiece source, - string* encoded); -extern template Status Base64Encode(StringPiece source, - bool with_padding, string* encoded); - -#ifdef USE_TSTRING -extern template Status Base64Decode(StringPiece data, - tstring* decoded); -extern template Status Base64Encode(StringPiece source, - tstring* encoded); -extern template Status Base64Encode(StringPiece source, - bool with_padding, - tstring* encoded); -#endif // USE_TSTRING - -} // namespace tensorflow +#include "tensorflow/core/platform/base64.h" #endif // TENSORFLOW_CORE_LIB_STRINGS_BASE64_H_ diff --git a/tensorflow/core/platform/BUILD b/tensorflow/core/platform/BUILD index 2cfe0c31d23..534a3b4e7cc 100644 --- a/tensorflow/core/platform/BUILD +++ b/tensorflow/core/platform/BUILD @@ -83,6 +83,16 @@ cc_library( deps = [":types"], ) +cc_library( + name = "base64", + srcs = ["base64.cc"], + hdrs = ["base64.h"], + deps = [ + ":errors", + ":status", + ], +) + cc_library( name = "blocking_counter", hdrs = ["blocking_counter.h"], diff --git a/tensorflow/core/lib/strings/base64.cc b/tensorflow/core/platform/base64.cc similarity index 98% rename from tensorflow/core/lib/strings/base64.cc rename to tensorflow/core/platform/base64.cc index 80eec3a9403..0ff690f1b32 100644 --- a/tensorflow/core/lib/strings/base64.cc +++ b/tensorflow/core/platform/base64.cc @@ -13,11 +13,11 @@ See the License for the specific language governing permissions and limitations under the License. ==============================================================================*/ -#include "tensorflow/core/lib/strings/base64.h" +#include "tensorflow/core/platform/base64.h" #include #include -#include "tensorflow/core/lib/core/errors.h" +#include "tensorflow/core/platform/errors.h" namespace tensorflow { namespace { diff --git a/tensorflow/core/platform/base64.h b/tensorflow/core/platform/base64.h new file mode 100644 index 00000000000..7b764732dc9 --- /dev/null +++ b/tensorflow/core/platform/base64.h @@ -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 +#include "tensorflow/core/platform/status.h" + +namespace tensorflow { + +/// \brief Converts data into web-safe base64 encoding. +/// +/// See https://en.wikipedia.org/wiki/Base64 +template +Status Base64Encode(StringPiece source, bool with_padding, T* encoded); +template +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 +Status Base64Decode(StringPiece data, T* decoded); + +// Explicit instantiations defined in base64.cc. +extern template Status Base64Decode(StringPiece data, string* decoded); +extern template Status Base64Encode(StringPiece source, + string* encoded); +extern template Status Base64Encode(StringPiece source, + bool with_padding, string* encoded); + +#ifdef USE_TSTRING +extern template Status Base64Decode(StringPiece data, + tstring* decoded); +extern template Status Base64Encode(StringPiece source, + tstring* encoded); +extern template Status Base64Encode(StringPiece source, + bool with_padding, + tstring* encoded); +#endif // USE_TSTRING + +} // namespace tensorflow + +#endif // TENSORFLOW_CORE_PLATFORM_BASE64_H_