You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by mp...@apache.org on 2016/01/04 11:43:24 UTC
[4/5] mesos git commit: Cleaned up STL I/O includes in public headers
which are not part of v1.
Cleaned up STL I/O includes in public headers which are not part of v1.
Where possible moved `operator<<` definitions and functions using
streams to implementation files and included <iosfwd> in headers.
Also removed unused I/O includes, added necessary includes, and cleaned
up `std::` prefixes.
Review: https://reviews.apache.org/r/41512/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/fcadd2d2
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/fcadd2d2
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/fcadd2d2
Branch: refs/heads/master
Commit: fcadd2d2950d081677aa54fa0c70dab5dd5862bd
Parents: 820640d
Author: Alexander Rukletsov <ru...@gmail.com>
Authored: Mon Jan 4 02:26:18 2016 -0800
Committer: Michael Park <mp...@apache.org>
Committed: Mon Jan 4 02:37:22 2016 -0800
----------------------------------------------------------------------
include/mesos/authorizer/authorizer.hpp | 7 ++-----
include/mesos/http.hpp | 18 ++----------------
include/mesos/uri/uri.hpp | 2 +-
src/authorizer/authorizer.cpp | 9 +++++++++
src/common/http.cpp | 19 ++++++++++++++++++-
5 files changed, 32 insertions(+), 23 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/fcadd2d2/include/mesos/authorizer/authorizer.hpp
----------------------------------------------------------------------
diff --git a/include/mesos/authorizer/authorizer.hpp b/include/mesos/authorizer/authorizer.hpp
index 7a04ca8..f616139 100644
--- a/include/mesos/authorizer/authorizer.hpp
+++ b/include/mesos/authorizer/authorizer.hpp
@@ -17,7 +17,7 @@
#ifndef __MESOS_AUTHORIZER_AUTHORIZER_HPP__
#define __MESOS_AUTHORIZER_AUTHORIZER_HPP__
-#include <ostream>
+#include <iosfwd>
#include <string>
// ONLY USEFUL AFTER RUNNING PROTOC.
@@ -192,10 +192,7 @@ protected:
};
-inline std::ostream& operator<<(std::ostream& stream, const ACLs& acls)
-{
- return stream << acls.DebugString();
-}
+std::ostream& operator<<(std::ostream& stream, const ACLs& acls);
} // namespace mesos {
http://git-wip-us.apache.org/repos/asf/mesos/blob/fcadd2d2/include/mesos/http.hpp
----------------------------------------------------------------------
diff --git a/include/mesos/http.hpp b/include/mesos/http.hpp
index 8529ed0..bd7e81f 100644
--- a/include/mesos/http.hpp
+++ b/include/mesos/http.hpp
@@ -17,9 +17,7 @@
#ifndef __MESOS_HTTP_HPP__
#define __MESOS_HTTP_HPP__
-#include <ostream>
-
-#include <stout/unreachable.hpp>
+#include <iosfwd>
namespace mesos {
@@ -35,19 +33,7 @@ enum class ContentType
};
-inline std::ostream& operator<<(std::ostream& stream, ContentType contentType)
-{
- switch (contentType) {
- case ContentType::PROTOBUF: {
- return stream << APPLICATION_PROTOBUF;
- }
- case ContentType::JSON: {
- return stream << APPLICATION_JSON;
- }
- }
-
- UNREACHABLE();
-}
+std::ostream& operator<<(std::ostream& stream, ContentType contentType);
} // namespace mesos {
http://git-wip-us.apache.org/repos/asf/mesos/blob/fcadd2d2/include/mesos/uri/uri.hpp
----------------------------------------------------------------------
diff --git a/include/mesos/uri/uri.hpp b/include/mesos/uri/uri.hpp
index 75f08c8..180dc13 100644
--- a/include/mesos/uri/uri.hpp
+++ b/include/mesos/uri/uri.hpp
@@ -17,7 +17,7 @@
#ifndef __MESOS_URI_PROTO_HPP__
#define __MESOS_URI_PROTO_HPP__
-#include <ostream>
+#include <iosfwd>
// ONLY USEFUL AFTER RUNNING PROTOC.
#include <mesos/uri/uri.pb.h>
http://git-wip-us.apache.org/repos/asf/mesos/blob/fcadd2d2/src/authorizer/authorizer.cpp
----------------------------------------------------------------------
diff --git a/src/authorizer/authorizer.cpp b/src/authorizer/authorizer.cpp
index 31712e5..54278b0 100644
--- a/src/authorizer/authorizer.cpp
+++ b/src/authorizer/authorizer.cpp
@@ -14,6 +14,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+#include <ostream>
+
#include <mesos/authorizer/authorizer.hpp>
#include <mesos/module/authorizer.hpp>
@@ -24,6 +26,7 @@
#include "module/manager.hpp"
+using std::ostream;
using std::string;
using mesos::internal::LocalAuthorizer;
@@ -43,4 +46,10 @@ Try<Authorizer*> Authorizer::create(const string& name)
return modules::ModuleManager::create<Authorizer>(name);
}
+
+ostream& operator<<(ostream& stream, const ACLs& acls)
+{
+ return stream << acls.DebugString();
+}
+
} // namespace mesos {
http://git-wip-us.apache.org/repos/asf/mesos/blob/fcadd2d2/src/common/http.cpp
----------------------------------------------------------------------
diff --git a/src/common/http.cpp b/src/common/http.cpp
index 2ecb78c..7165551 100644
--- a/src/common/http.cpp
+++ b/src/common/http.cpp
@@ -15,12 +15,14 @@
// limitations under the License.
#include <map>
+#include <ostream>
#include <set>
#include <string>
#include <utility>
#include <vector>
#include <mesos/attributes.hpp>
+#include <mesos/http.hpp>
#include <mesos/resources.hpp>
#include <stout/foreach.hpp>
@@ -33,11 +35,27 @@
#include "messages/messages.hpp"
using std::map;
+using std::ostream;
using std::set;
using std::string;
using std::vector;
namespace mesos {
+
+ostream& operator<<(ostream& stream, ContentType contentType)
+{
+ switch (contentType) {
+ case ContentType::PROTOBUF: {
+ return stream << APPLICATION_PROTOBUF;
+ }
+ case ContentType::JSON: {
+ return stream << APPLICATION_JSON;
+ }
+ }
+
+ UNREACHABLE();
+}
+
namespace internal {
string serialize(
@@ -378,6 +396,5 @@ JSON::Object model(
return object;
}
-
} // namespace internal {
} // namespace mesos {