source: pacpusframework/trunk/3rd/apache-log4cxx/include/log4cxx/helpers/bytearrayinputstream.h@ 184

Last change on this file since 184 was 89, checked in by morasjul, 12 years ago

PACPUS 2.0 Beta deployed in new branch

Major changes:
-Add communication interface between components
-Add examples for communications interface (TestComponents)
-Move to Qt5 support

  • Property svn:executable set to *
File size: 3.0 KB
Line 
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18#ifndef _LOG4CXX_HELPERS_BYTEARRAYINPUTSTREAM_H
19#define _LOG4CXX_HELPERS_BYTEARRAYINPUTSTREAM_H
20
21#if defined(_MSC_VER)
22#pragma warning ( push )
23#pragma warning ( disable: 4231 4251 4275 4786 )
24#endif
25
26
27#include <vector>
28#include <log4cxx/helpers/inputstream.h>
29
30
31namespace log4cxx
32{
33
34 namespace helpers {
35LOG4CXX_LIST_DEF(ByteList, unsigned char);
36
37 /**
38 * InputStream implemented on top of a byte array.
39 */
40 class LOG4CXX_EXPORT ByteArrayInputStream : public InputStream
41 {
42 private:
43 ByteList buf;
44 size_t pos;
45
46 public:
47 DECLARE_ABSTRACT_LOG4CXX_OBJECT(ByteArrayInputStream)
48 BEGIN_LOG4CXX_CAST_MAP()
49 LOG4CXX_CAST_ENTRY(ByteArrayInputStream)
50 LOG4CXX_CAST_ENTRY_CHAIN(InputStream)
51 END_LOG4CXX_CAST_MAP()
52
53 /**
54 * Creates a ByteArrayInputStream.
55 *
56 * @param bytes array of bytes to copy into stream.
57 */
58 ByteArrayInputStream(const ByteList& bytes);
59
60 virtual ~ByteArrayInputStream();
61
62 /**
63 * Closes this file input stream and releases any system
64 * resources associated with the stream.
65 */
66 virtual void close();
67
68 /**
69 * Reads a sequence of bytes into the given buffer.
70 *
71 * @param buf The buffer into which bytes are to be transferred.
72 * @return the total number of bytes read into the buffer, or -1 if there
73 * is no more data because the end of the stream has been reached.
74 */
75 virtual int read(ByteBuffer& buf);
76
77 private:
78
79 ByteArrayInputStream(const ByteArrayInputStream&);
80
81 ByteArrayInputStream& operator=(const ByteArrayInputStream&);
82
83 };
84
85 LOG4CXX_PTR_DEF(ByteArrayInputStream);
86 } // namespace helpers
87
88} //namespace log4cxx
89
90#if defined(_MSC_VER)
91#pragma warning ( pop )
92#endif
93
94#endif //_LOG4CXX_HELPERS_BYTEARRAYINPUTSTREAM_H
Note: See TracBrowser for help on using the repository browser.