source: pacpusframework/branches/2.0-beta1/3rd/apache-log4cxx/include/log4cxx/helpers/inputstreamreader.h@ 89

Last change on this file since 89 was 89, checked in by morasjul, 11 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.3 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_INPUTSTREAMREADER_H
19#define _LOG4CXX_HELPERS_INPUTSTREAMREADER_H
20
21#include <log4cxx/helpers/reader.h>
22#include <log4cxx/helpers/inputstream.h>
23#include <log4cxx/helpers/charsetdecoder.h>
24
25namespace log4cxx
26{
27
28 namespace helpers {
29
30 /**
31 * Class for reading from character streams.
32 * Decorates a byte based InputStream and provides appropriate
33 * conversion to characters.
34 */
35 class LOG4CXX_EXPORT InputStreamReader : public Reader
36 {
37 private:
38 InputStreamPtr in;
39 CharsetDecoderPtr dec;
40
41 public:
42 DECLARE_ABSTRACT_LOG4CXX_OBJECT(InputStreamReader)
43 BEGIN_LOG4CXX_CAST_MAP()
44 LOG4CXX_CAST_ENTRY(InputStreamReader)
45 LOG4CXX_CAST_ENTRY_CHAIN(Reader)
46 END_LOG4CXX_CAST_MAP()
47
48 /**
49 * Creates an InputStreamReader that uses the default charset.
50 *
51 * @param in The input stream to decorate.
52 */
53 InputStreamReader(const InputStreamPtr& in);
54
55 /**
56 * Creates an InputStreamReader that uses the given charset decoder.
57 *
58 * @param in The input stream to decorate.
59 * @param enc The charset decoder to use for the conversion.
60 */
61 InputStreamReader(const InputStreamPtr& in, const CharsetDecoderPtr &enc);
62
63 ~InputStreamReader();
64
65 /**
66 * Closes the stream.
67 *
68 * @param p The memory pool associated with the reader.
69 */
70 virtual void close(Pool& p);
71
72 /**
73 * @return The complete stream contents as a LogString.
74 * @param p The memory pool associated with the reader.
75 */
76 virtual LogString read(Pool& p);
77
78 /**
79 * @return The name of the character encoding being used by this stream.
80 */
81 LogString getEncoding() const;
82
83 private:
84 InputStreamReader(const InputStreamReader&);
85
86 InputStreamReader& operator=(const InputStreamReader&);
87 };
88
89 LOG4CXX_PTR_DEF(InputStreamReader);
90 } // namespace helpers
91
92} //namespace log4cxx
93
94#endif //_LOG4CXX_HELPERS_INPUTSTREAMREADER_H
Note: See TracBrowser for help on using the repository browser.