CXXR (C++ R)
|
RObject representing a character string. More...
#include <String.h>
Classes | |
class | Comparator |
Comparison object for CXXR::String. More... |
Public Member Functions | |
char | operator[] (unsigned int index) const |
Read-only character access. | |
const char * | c_str () const |
Access as a C-style string. | |
cetype_t | encoding () const |
Character encoding. | |
bool | isASCII () const |
Is this Stringpure ASCII? | |
bool | isNA () const |
Test if 'not available'. | |
const std::string & | stdstring () const |
Access encapsulated std::string. | |
unsigned int | packGPBits () const |
Reproduce the gp bits field used in CR. | |
const char * | typeName () const |
Name within R of this type of object. | |
![]() | |
VectorBase (SEXPTYPE stype, std::size_t sz) | |
VectorBase (const VectorBase &pattern) | |
Copy constructor. | |
const ListVector * | dimensionNames () const |
Names associated with the rows, columns or other dimensions of an R matrix or array. | |
const StringVector * | dimensionNames (unsigned int d) const |
Names associated with a particular dimension of an R matrix or array. | |
const IntVector * | dimensions () const |
Dimensions of R matrix or array. | |
const StringVector * | names () const |
Names of vector elements. | |
void | setDimensionNames (ListVector *names) |
Associate names with the rows, columns or other dimensions of an R matrix or array. | |
void | setDimensionNames (unsigned int d, StringVector *names) |
Associate names with a particular dimension of an R matrix or array. | |
void | setDimensions (IntVector *dims) |
Define the dimensions of R matrix or array. | |
void | setNames (StringVector *names) |
Associate names with the elements of a VectorBase. | |
virtual void | setSize (std::size_t new_size) |
Adjust the number of elements in the vector. | |
std::size_t | size () const |
Number of elements in the vector. | |
VectorBase * | clone () const |
Return pointer to a copy of this object. | |
![]() | |
virtual const PairList * | attributes () const |
Get object attributes. | |
virtual void | clearAttributes () |
Remove all attributes. | |
void | copyAttribute (const Symbol *name, const RObject *source) |
Copy an attribute from one RObject to another. | |
void | copyAttributes (const RObject *source, bool copyS4) |
Copy attributes from one RObject to another. | |
virtual RObject * | evaluate (Environment *env) |
Evaluate object in a specified Environment. | |
virtual RObject * | getAttribute (const Symbol *name) const |
Get the value a particular attribute. | |
virtual bool | hasAttributes () const |
Has this object any attributes? | |
bool | hasClass () const |
Has this object the class attribute? | |
bool | isS4Object () const |
Is this an S4 object? | |
void | maybeTraceMemory (const RObject *src) |
Carry out memory tracing. | |
void | maybeTraceMemory (const RObject *src1, const RObject *src2) |
Carry out memory tracing. | |
void | maybeTraceMemory (const RObject *src1, const RObject *src2, const RObject *src3) |
Carry out memory tracing. | |
bool | memoryTraced () const |
Is copying etc. of this object being traced? | |
virtual void | setAttribute (const Symbol *name, RObject *value) |
Set or remove an attribute. | |
void | setAttributes (const PairList *new_attributes) |
Replace the attributes of an object. | |
void | setMemoryTracing (bool on) |
Enable/disable tracing of copying etc. | |
void | setS4Object (bool on) |
Set the status of this RObject as an S4 object. | |
SEXPTYPE | sexptype () const |
Get an object's SEXPTYPE. | |
virtual void | unpackGPBits (unsigned int gpbits) |
Interpret the gp bits field used in CR. | |
void | detachReferents () |
Null out all references from this node to other nodes. | |
void | visitReferents (const_visitor *v) const |
Conduct a visitor to the nodes referred to by this one. | |
![]() | |
void | expose () const |
Record that construction of a node is complete. | |
bool | isExposed () const |
Has this node been exposed to garbage collection? | |
![]() | |
Link () | |
Default constructor. | |
Link (HeterogeneousListBase *list) | |
Appending constructor. | |
void | freeLink () |
Detach Link from any list. |
Static Public Member Functions | |
static String * | blank () |
Blank string. | |
static cetype_t | GPBits2Encoding (unsigned int gpbits) |
Extract encoding information from CR's gp bits field. | |
static String * | NA () |
'Not available' string. | |
static String * | obtain (const std::string &str, cetype_t encoding=CE_NATIVE) |
Get a pointer to a String object. | |
static const char * | staticTypeName () |
The name by which this type is known in R. | |
![]() | |
template<class V > | |
static V * | resize (const V *pattern, std::size_t new_size) |
Create an extended or shrunken copy of an R vector. | |
static PairList * | resizeAttributes (const PairList *attributes, std::size_t new_size) |
Adjust attributes for a resized vector. | |
![]() | |
template<class T > | |
static T * | clone (const T *pattern) |
Return a pointer to a copy of an object. | |
![]() | |
static void * | operator new (size_t bytes) |
Allocate memory. | |
static void * | operator new (size_t, void *where) |
Placement new for GCNode. | |
static void | operator delete (void *p, size_t bytes) |
Deallocate memory. | |
static bool | check () |
Integrity check. | |
template<class T > | |
static T * | expose (T *node) |
Record that construction of a node is complete. | |
static void | gc () |
Initiate a garbage collection. | |
static void | gclite () |
Lightweight garbage collection. | |
static void | maybeCheckExposed (const GCNode *node) |
Subject to configuration, check that a GCNode is exposed. | |
static size_t | numNodes () |
Number of GCNode objects in existence. |
Friends | |
class | boost::serialization::access |
class | SchwarzCounter< String > |
class | Symbol |
Additional Inherited Members | |
![]() | |
R_len_t | m_truelength |
![]() | |
unsigned char | m_named |
unsigned | m_missing: 2 |
unsigned | m_argused: 2 |
bool | m_active_binding: 1 |
bool | m_binding_locked: 1 |
![]() | |
void | adjustSize (std::size_t new_size) |
Adjust the number of elements in the vector. | |
![]() | |
RObject (SEXPTYPE stype=CXXSXP) | |
RObject (const RObject &pattern) | |
Copy constructor. | |
![]() | |
virtual | ~GCNode () |
![]() | |
virtual | ~Link () |
RObject representing a character string.
At any one time, at most one String object with a particular text and encoding may exist.
char
s that the String comprises. If the string uses a multibyte encoding scheme, this may be different from the number of Unicode characters represented by the string.
|
inlinestatic |
Blank string.
const
pointer to the string "".
|
inline |
Access as a C-style string.
|
inline |
Character encoding.
|
static |
Extract encoding information from CR's gp
bits field.
This function is used to extract the character encoding information contained in the sxpinfo_struct.gp
field used in CR. It should be used exclusively for deserialization. Refer to the 'R Internals' document for details of this field.
gpbits | the gp bits field (within the least significant 16 bits). |
|
inline |
Is this Stringpure ASCII?
|
inline |
Test if 'not available'.
|
inlinestatic |
'Not available' string.
Note that although the 'not available' string contains the text "NA", it is identified as the 'not available' string by its address, not by its content. It is entirely in order to create another string with the text "NA", and that string will not be considered 'not available'.
const
pointer to the string representing 'not available'.
|
static |
Get a pointer to a String object.
If no String with the specified text and encoding currently exists, one will be created, and a pointer to it returned. Otherwise a pointer to the existing String will be returned.
str | The text of the required String. (Embedded null characters are permissible.) |
encoding | The encoding of the required String. Only CE_NATIVE, CE_UTF8 or CE_LATIN1 are permitted in this context (checked). Note that if str contains no non-ASCII characters, then the encoding is set to CE_NATIVE regardless of the value of the encoding parameter. |
|
inline |
Read-only character access.
index | Index of required character (counting from zero). No bounds checking is applied. |
|
virtual |
Reproduce the gp
bits field used in CR.
This function is used to reproduce the sxpinfo_struct.gp
field used in CR. It should be used exclusively for serialization. Refer to the 'R Internals' document for details of this field.
gp
bits field (within the least significant 16 bits).Reimplemented from CXXR::RObject.
|
inlinestatic |
The name by which this type is known in R.
Reimplemented from CXXR::VectorBase.
|
inline |
Access encapsulated std::string.
|
virtual |
Name within R of this type of object.
Reimplemented from CXXR::RObject.