activemq-cpp-3.6.0
CharArrayBuffer.h
Go to the documentation of this file.
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 _DECAF_INTERNAL_NIO_CHARARRAYBUFFER_H_
19 #define _DECAF_INTERNAL_NIO_CHARARRAYBUFFER_H_
20 
21 #include <decaf/nio/CharBuffer.h>
28 
29 #include <decaf/lang/Pointer.h>
30 
31 namespace decaf{
32 namespace internal{
33 namespace nio{
34 
36 
38  protected:
39 
40  // The reference array object that backs this buffer.
42 
43  // Offset into the array that we are to start from
44  int offset;
45 
46  // The length of the sub-array, or limit
47  int length;
48 
49  // Read / Write flag
50  bool readOnly;
51 
52  public:
53 
66  CharArrayBuffer( int size, bool readOnly = false );
67 
86  CharArrayBuffer( char* array, int size, int offset, int length, bool readOnly = false );
87 
106  int offset, int length, bool readOnly = false );
107 
116  CharArrayBuffer( const CharArrayBuffer& other );
117 
118  virtual ~CharArrayBuffer();
119 
120  public: // Overrides
121 
125  virtual char* array();
126 
130  virtual int arrayOffset();
131 
135  virtual CharBuffer* asReadOnlyBuffer() const;
136 
140  virtual CharBuffer& compact();
141 
145  virtual CharBuffer* duplicate();
146 
150  virtual char get();
151 
155  virtual char get( int index ) const;
156 
160  virtual bool hasArray() const { return true; }
161 
165  virtual bool isReadOnly() const {
166  return this->readOnly;
167  }
168 
172  virtual CharBuffer& put( char value );
173 
177  virtual CharBuffer& put( int index, char value );
178 
182  virtual CharBuffer* slice() const;
183 
187  virtual lang::CharSequence* subSequence( int start, int end ) const;
188 
189  protected:
190 
197  virtual void setReadOnly( bool value ) {
198  this->readOnly = value;
199  }
200 
201  };
202 
203 }}}
204 
205 #endif /*_DECAF_INTERNAL_NIO_CHARARRAYBUFFER_H_*/