| 27 | |
| 28 | template<int RTYPE, template <class> class StoragePolicy> |
| 29 | class string_proxy { |
| 30 | public: |
| 31 | |
| 32 | typedef typename ::Rcpp::Vector<RTYPE, StoragePolicy> VECTOR ; |
| 33 | typedef const char* iterator ; |
| 34 | typedef const char& reference ; |
| 35 | |
| 36 | string_proxy() : parent(0), index(-1){}; |
| 37 | |
| 38 | /** |
| 39 | * Creates a proxy |
| 40 | * |
| 41 | * @param v reference to the associated character vector |
| 42 | * @param index index |
| 43 | */ |
| 44 | string_proxy( VECTOR& v, R_xlen_t index_ ) : parent(&v), index(index_){} |
| 45 | |
| 46 | string_proxy( const string_proxy& other ) : |
| 47 | parent(other.parent), index(other.index) |
| 48 | {} ; |
| 49 | |
| 50 | /** |
| 51 | * lhs use. Assign the value of the referred element to |
| 52 | * the current content of the element referred by the |
| 53 | * rhs proxy |
| 54 | * |
| 55 | * @param rhs another proxy, possibly from another vector |
| 56 | */ |
| 57 | string_proxy& operator=( const string_proxy<RTYPE, StoragePolicy>& other) { |
| 58 | set( other.get() ) ; |
| 59 | return *this ; |
| 60 | } |
| 61 | |
| 62 | template <template <class> class StoragePolicy2> |
| 63 | string_proxy& operator=( const string_proxy<RTYPE, StoragePolicy2>& other) { |
| 64 | set( other.get() ) ; |
| 65 | return *this ; |
| 66 | } |
| 67 | |
| 68 | template <template <class> class StoragePolicy2> |
| 69 | string_proxy& operator=( const const_string_proxy<RTYPE, StoragePolicy2>& other) ; |
| 70 | |
| 71 | string_proxy& operator=( const String& s) ; |
| 72 | |
| 73 | /** |
| 74 | * lhs use. Assigns the value of the referred element |
| 75 | * of the character vector |
| 76 | * |
| 77 | * @param rhs new content for the element referred by this proxy |
| 78 | */ |
| 79 | template <typename T> |
| 80 | string_proxy& operator=(const std::basic_string<T>& rhs){ |
| 81 | set( rhs ) ; |
| 82 | return *this ; |
| 83 | } |
| 84 | |
| 85 | string_proxy& operator=(const char* rhs){ |
| 86 | set( Rf_mkChar( rhs ) ) ; |
nothing calls this directly
no test coverage detected