staticlib_io  1.2.11
 All Classes Namespaces Files Functions Variables
null_sink.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2015, alex at staticlibs.net
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 /*
18  * File: null_sink.hpp
19  * Author: alex
20  *
21  * Created on October 10, 2015, 1:14 PM
22  */
23 
24 #ifndef STATICLIB_IO_NULL_SINK_HPP
25 #define STATICLIB_IO_NULL_SINK_HPP
26 
27 #include <ios>
28 
29 #include "staticlib/config.hpp"
30 
31 #include "staticlib/io/span.hpp"
32 
33 namespace staticlib {
34 namespace io {
35 
39 class null_sink {
40 public:
44  null_sink() { }
45 
51  null_sink(const null_sink&) { }
52 
60  return *this;
61  }
62 
68  null_sink(null_sink&&) STATICLIB_NOEXCEPT { }
69 
76  null_sink& operator=(null_sink&&) STATICLIB_NOEXCEPT {
77  return *this;
78  }
79 
86  std::streamsize write(span<const char> span) {
87  // no-op
88  return span.size_signed();
89  }
90 
96  std::streamsize flush() {
97  // no-op
98  return 0;
99  }
100 
101 };
102 
103 } // namespace
104 }
105 
106 #endif /* STATICLIB_IO_NULL_SINK_HPP */
107