@@ -58,8 +58,7 @@ namespace Rcpp {
58
58
}
59
59
60
60
/* * copy constructor */
61
- String ( const String& other) : data( other.get_sexp()), valid(true ), buffer_ready(false ),
62
- enc (Rf_getCharCE(other.get_sexp())) {
61
+ String ( const String& other) : data( other.get_sexp()), valid(true ), buffer_ready(false ), enc(Rf_getCharCE(other.get_sexp())) {
63
62
RCPP_STRING_DEBUG ( " String(const String&)" ) ;
64
63
}
65
64
@@ -69,46 +68,41 @@ namespace Rcpp {
69
68
}
70
69
71
70
/* * construct a string from a single CHARSXP SEXP */
72
- String (SEXP charsxp) : data(charsxp), valid(true ), buffer_ready(false ),
73
- enc(Rf_getCharCE(charsxp)) {
71
+ String (SEXP charsxp) : data(charsxp), valid(true ), buffer_ready(false ), enc(Rf_getCharCE(charsxp)) {
74
72
RCPP_STRING_DEBUG ( " String(SEXP)" ) ;
75
73
}
76
74
77
75
String (SEXP charsxp, const char * enc) : data(charsxp), valid(true ), buffer_ready(false ) {
78
- set_encoding (enc);
76
+ set_encoding (enc);
79
77
RCPP_STRING_DEBUG ( " String(SEXP)" ) ;
80
78
}
81
79
82
80
/* * from string proxy */
83
- String ( const StringProxy& proxy ): data( proxy.get() ), valid(true ), buffer_ready(false ),
84
- enc(Rf_getCharCE(proxy.get())){
81
+ String ( const StringProxy& proxy ): data( proxy.get() ), valid(true ), buffer_ready(false ), enc(Rf_getCharCE(proxy.get())){
85
82
RCPP_STRING_DEBUG ( " String( const StringProxy&)" ) ;
86
83
}
87
84
88
85
String ( const StringProxy& proxy, const char * enc ): data( proxy.get() ), valid(true ), buffer_ready(false ) {
89
- set_encoding (enc);
86
+ set_encoding (enc);
90
87
RCPP_STRING_DEBUG ( " String( const StringProxy&)" ) ;
91
88
}
92
89
93
90
/* * from string proxy */
94
- String ( const const_StringProxy& proxy ): data( proxy.get() ), valid(true ), buffer_ready(false ),
95
- enc(Rf_getCharCE(proxy.get())){
91
+ String ( const const_StringProxy& proxy ): data( proxy.get() ), valid(true ), buffer_ready(false ), enc(Rf_getCharCE(proxy.get())){
96
92
RCPP_STRING_DEBUG ( " String( const const_StringProxy&)" ) ;
97
93
}
98
94
99
95
String ( const const_StringProxy& proxy, const char * enc ): data( proxy.get() ), valid(true ), buffer_ready(false ) {
100
- set_encoding (enc);
96
+ set_encoding (enc);
101
97
RCPP_STRING_DEBUG ( " String( const const_StringProxy&)" ) ;
102
98
}
103
99
104
100
/* * from a std::string */
105
- String ( const std::string& s) : buffer(s), valid(false ), buffer_ready(true ),
106
- enc(CE_NATIVE) {
101
+ String ( const std::string& s) : buffer(s), valid(false ), buffer_ready(true ), enc(CE_NATIVE) {
107
102
RCPP_STRING_DEBUG ( " String(const std::string& )" ) ;
108
103
}
109
104
110
- String ( const std::wstring& s) : data(internal::make_charsexp(s)), valid(true ), buffer_ready(false ),
111
- enc(CE_NATIVE) {
105
+ String ( const std::wstring& s) : data(internal::make_charsexp(s)), valid(true ), buffer_ready(false ), enc(CE_NATIVE) {
112
106
RCPP_STRING_DEBUG ( " String(const std::wstring& )" ) ;
113
107
}
114
108
@@ -117,8 +111,7 @@ namespace Rcpp {
117
111
RCPP_STRING_DEBUG ( " String(const char*)" ) ;
118
112
}
119
113
120
- String ( const wchar_t * s) : data(internal::make_charsexp(s)), valid(true ), buffer_ready(false ),
121
- enc(CE_NATIVE) {
114
+ String ( const wchar_t * s) : data(internal::make_charsexp(s)), valid(true ), buffer_ready(false ), enc(CE_NATIVE) {
122
115
RCPP_STRING_DEBUG ( " String(const wchar_t* s)" ) ;
123
116
}
124
117
@@ -160,7 +153,7 @@ namespace Rcpp {
160
153
setBuffer () ; buffer += s ; valid = false ;
161
154
return *this ;
162
155
}
163
-
156
+
164
157
inline String& operator +=( const char * s){
165
158
RCPP_STRING_DEBUG ( " String::operator+=( const char*)" ) ;
166
159
if ( is_na () ) return *this ;
@@ -357,7 +350,7 @@ namespace Rcpp {
357
350
inline const char * get_cstring () const {
358
351
return buffer_ready ? buffer.c_str () : CHAR (data) ;
359
352
}
360
-
353
+
361
354
inline const std::string get_encoding () const {
362
355
switch (enc) {
363
356
case CE_BYTES:
@@ -370,7 +363,7 @@ namespace Rcpp {
370
363
return " unknown" ;
371
364
}
372
365
}
373
-
366
+
374
367
inline void set_encoding ( cetype_t encoding ) {
375
368
enc = encoding;
376
369
if (data != NULL )
@@ -386,9 +379,8 @@ namespace Rcpp {
386
379
enc = CE_UTF8;
387
380
} else {
388
381
enc = CE_ANY;
389
- Rcout << " Unknown encoding" << std::endl;
390
382
}
391
- set_encoding (enc);
383
+ set_encoding (enc);
392
384
}
393
385
394
386
bool operator <( const Rcpp::String& other ) const {
@@ -410,7 +402,7 @@ namespace Rcpp {
410
402
411
403
/* * the CHARSXP this String encapsulates */
412
404
SEXP data ;
413
-
405
+
414
406
/* * the encoding of encapsulated CHARSXP */
415
407
cetype_t enc;
416
408
0 commit comments