Go to the documentation of this file.00001 #ifndef guard_unbounded_basic_string_sequence_hpp
00002 #define guard_unbounded_basic_string_sequence_hpp
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include "tao/Unbounded_Reference_Allocation_Traits_T.h"
00013 #include "tao/String_Traits_T.h"
00014 #include "tao/Generic_Sequence_T.h"
00015 #include "tao/String_Sequence_Element_T.h"
00016 #include "tao/String_Const_Sequence_Element_T.h"
00017 #include "tao/MM_Sequence_Iterator_T.h"
00018
00019 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00020
00021 namespace TAO
00022 {
00023 template<typename charT>
00024 class unbounded_basic_string_sequence
00025 {
00026 public:
00027 typedef charT character_type;
00028 typedef character_type * value_type;
00029 typedef character_type const * const_value_type;
00030 typedef ::CORBA::ULong size_type;
00031
00032 typedef details::string_traits<character_type,true> element_traits;
00033 typedef details::unbounded_reference_allocation_traits<value_type,element_traits,true> allocation_traits;
00034
00035 typedef details::string_sequence_element<element_traits> element_type;
00036 typedef details::string_const_sequence_element<element_traits> const_element_type;
00037
00038 typedef details::generic_sequence<value_type, allocation_traits, element_traits> implementation_type;
00039
00040 typedef element_type subscript_type;
00041 typedef const_value_type const_subscript_type;
00042
00043
00044
00045 inline unbounded_basic_string_sequence()
00046 : impl_()
00047 {}
00048
00049
00050 inline explicit unbounded_basic_string_sequence(CORBA::ULong maximum)
00051 : impl_(maximum)
00052 {}
00053 inline unbounded_basic_string_sequence(
00054 CORBA::ULong maximum,
00055 CORBA::ULong length,
00056 value_type * data,
00057 CORBA::Boolean release)
00058 : impl_(maximum, length, data, release)
00059 {}
00060
00061
00062
00063
00064 inline CORBA::ULong maximum() const {
00065 return impl_.maximum();
00066 }
00067
00068 inline CORBA::Boolean release() const {
00069 return impl_.release();
00070 }
00071
00072 inline CORBA::ULong length() const {
00073 return impl_.length();
00074 }
00075
00076 inline void length(CORBA::ULong length) {
00077 impl_.length(length);
00078 }
00079
00080 inline const_element_type operator[](CORBA::ULong i) const {
00081 return const_element_type (impl_[i], release());
00082 }
00083
00084 inline element_type operator[](CORBA::ULong i) {
00085 return element_type(impl_[i], release());
00086 }
00087
00088 inline const_value_type const * get_buffer() const {
00089 return impl_.get_buffer();
00090 }
00091
00092 inline void replace(
00093 CORBA::ULong maximum,
00094 CORBA::ULong length,
00095 value_type * data,
00096 CORBA::Boolean release = false) {
00097 impl_.replace(maximum, length, data, release);
00098 }
00099
00100 inline value_type * get_buffer(CORBA::Boolean orphan = false) {
00101 return impl_.get_buffer(orphan);
00102 }
00103
00104 inline void swap(unbounded_basic_string_sequence & rhs) throw() {
00105 impl_.swap(rhs.impl_);
00106 }
00107
00108 static value_type * allocbuf(CORBA::ULong maximum)
00109 {
00110 return implementation_type::allocbuf(maximum);
00111 }
00112 static void freebuf(value_type * buffer)
00113 {
00114 implementation_type::freebuf(buffer);
00115 }
00116
00117
00118 #if defined TAO_HAS_SEQUENCE_ITERATORS && TAO_HAS_SEQUENCE_ITERATORS == 1
00119
00120
00121
00122
00123
00124
00125
00126 typedef MM_Sequence_Iterator<unbounded_basic_string_sequence<charT> > iterator;
00127 typedef Const_MM_Sequence_Iterator<unbounded_basic_string_sequence<charT> > const_iterator;
00128 typedef MM_Sequence_Reverse_Iterator<unbounded_basic_string_sequence<charT> > reverse_iterator;
00129 typedef Const_MM_Sequence_Reverse_Iterator<unbounded_basic_string_sequence<charT> > const_reverse_iterator;
00130
00131
00132 inline iterator begin (void)
00133 {
00134 return iterator (&this->impl_);
00135 }
00136
00137
00138 inline const_iterator begin (void) const
00139 {
00140 return const_iterator (&this->impl_);
00141 }
00142
00143
00144 inline iterator end (void)
00145 {
00146 return iterator (&this->impl_,
00147 this->impl_.length ());
00148 }
00149
00150
00151 inline const_iterator end (void) const
00152 {
00153 return const_iterator (&this->impl_,
00154 this->impl_.length ());
00155 }
00156
00157
00158 inline reverse_iterator rbegin (void)
00159 {
00160 return reverse_iterator (&this->impl_,
00161 this->impl_.length () - 1);
00162 }
00163
00164
00165 inline const_reverse_iterator rbegin (void) const
00166 {
00167 return const_reverse_iterator (&this->impl_,
00168 this->impl_.length () - 1);
00169 }
00170
00171
00172
00173 inline reverse_iterator rend (void)
00174 {
00175 return reverse_iterator (&this->impl_,
00176 -1);
00177 }
00178
00179
00180
00181 inline const_reverse_iterator rend (void) const
00182 {
00183 return const_reverse_iterator (&this->impl_,
00184 -1);
00185 }
00186
00187 #endif
00188
00189 private:
00190 implementation_type impl_;
00191 };
00192
00193 #if defined TAO_HAS_SEQUENCE_ITERATORS && TAO_HAS_SEQUENCE_ITERATORS == 1
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205 // template<typename charT>
00206 unbounded_basic_string_sequence<char>::element_type&
00207 details::Generic_Sequence_Iterator<unbounded_basic_string_sequence<char>, unbounded_basic_string_sequence::allocation_traits, unbounded_basic_string_sequence::element_traits >::operator* (void)
00208 {
00209 // Access the underlying element in the sequence.
00210 //return element_type (impl_[i], release());
00211 return element_type ((*(this->sequence_))[this->pos_],
00212 this->sequence_->release());
00213 }
00214
00215
00216 // template<typename charT>
00217 unbounded_basic_string_sequence<char>::const_element_type&
00218 details::Generic_Sequence_Iterator<unbounded_basic_string_sequence<char> >::operator* (void) const
00219 {
00220 // Access the underlying element in the sequence.
00221 //return const_element_type (impl_[i], release());
00222 return const_element_type ((*(this->sequence_))[this->pos_],
00223 this->sequence_->release ());
00224 }
00225 */
00226 #endif
00227
00228 }
00229
00230 TAO_END_VERSIONED_NAMESPACE_DECL
00231
00232 #endif // guard_unbounded_basic_string_sequence_hpp