22 #ifndef Rcpp__vector__string_proxy_h
23 #define Rcpp__vector__string_proxy_h
28 template<
int RTYPE,
template <
class>
class StoragePolicy>
32 typedef typename ::Rcpp::Vector<RTYPE, StoragePolicy>
VECTOR ;
62 template <
template <
class>
class StoragePolicy2>
68 template <
template <
class>
class StoragePolicy2>
86 set( Rf_mkChar( rhs ) ) ;
91 set( internal::make_charsexp( rhs ) ) ;
104 index = other.index ;
111 template <
typename T>
118 operator SEXP()
const {
127 operator char*()
const {
128 return const_cast<char*
>( CHAR(
get()) );
149 SET_STRING_ELT( *(other.
parent), other.
index, tmp ) ;
159 template <
typename T>
160 inline void set(
const T& x ){
161 set( internal::make_charsexp(x) ) ;
169 inline R_xlen_t
size()
const {
return strlen(
begin() ) ; }
173 template <
typename UnaryOperator>
180 template <
typename OutputIterator,
typename UnaryOperator>
181 void apply( OutputIterator target, UnaryOperator op){
182 std::transform(
begin(),
end(), target, op ) ;
185 template <
typename UnaryOperator>
187 std::for_each(
begin(),
end(), op );
191 return strcmp(
begin(), other ) == 0 ;
194 return strcmp(
begin(), other ) != 0 ;
197 template<
template <
class>
class SP>
199 return strcmp(
begin(), other.
begin() ) == 0 ;
202 template<
template <
class>
class SP>
204 return strcmp(
begin(), other.
begin() ) != 0 ;
208 return get() == other;
212 return get() != other;
223 const_cast<char *
>(lhs.
begin() ),
224 const_cast<char *
>(rhs.
begin())
231 const_cast<char *
>(lhs.
begin() ),
232 const_cast<char *
>(rhs.
begin())
239 const_cast<char *
>(lhs.
begin() ),
240 const_cast<char *
>(rhs.
begin())
247 const_cast<char *
>(lhs.
begin() ),
248 const_cast<char *
>(rhs.
begin())
255 os << static_cast<const char*>(proxy) ;
260 return x +
static_cast<const char*
>(y) ;
string_proxy & operator=(const string_proxy< RTYPE, StoragePolicy2 > &other)
void apply(OutputIterator target, UnaryOperator op)
void transform(UnaryOperator op)
string_proxy & operator=(const const_string_proxy< RTYPE, StoragePolicy2 > &other)
string_proxy & operator=(const std::basic_string< T > &rhs)
string_proxy & operator=(const string_proxy< RTYPE, StoragePolicy > &other)
reference operator[](R_xlen_t n)
friend std::string operator+(const std::string &x, const string_proxy< RT > &proxy)
friend std::ostream & operator<<(std::ostream &os, const string_proxy< RT > &proxy)
bool operator==(SEXP other) const
string_proxy & operator=(const char *rhs)
string_proxy & operator=(const wchar_t *rhs)
string_proxy & operator=(SEXP rhs)
static std::string buffer
string_proxy & operator+=(const T &rhs)
bool operator!=(const string_proxy< STRSXP, SP > &other) const
bool operator==(const char *other) const
void apply(UnaryOperator op)
string_proxy(VECTOR &v, R_xlen_t index_)
bool operator==(const string_proxy< STRSXP, SP > &other) const
void swap(string_proxy &other)
bool operator!=(SEXP other) const
::Rcpp::Vector< RTYPE, StoragePolicy > VECTOR
string_proxy(const string_proxy &other)
bool operator!=(const char *other) const
bool operator<=(const const_string_proxy< RT > &lhs, const const_string_proxy< RT > &rhs)
bool operator>=(const const_string_proxy< RT > &lhs, const const_string_proxy< RT > &rhs)
bool operator<(const const_string_proxy< RT > &lhs, const const_string_proxy< RT > &rhs)
std::ostream & operator<<(std::ostream &os, const const_string_proxy< STRSXP, StoragePolicy > &proxy)
std::string operator+(const std::string &x, const const_string_proxy< STRSXP, StoragePolicy > &y)
bool operator>(const const_string_proxy< RT > &lhs, const const_string_proxy< RT > &rhs)