($Id: String.h 1390 2013-06-11 14:41:41Z arr $)
Class CXXR::String and associated C interface.
More...
#include "CXXR/GCRoot.h"
#include "CXXR/VectorBase.h"
#include <boost/serialization/nvp.hpp>
#include <tr1/unordered_map>
#include <string>
#include "CXXR/Allocator.hpp"
#include "CXXR/SEXP_downcast.hpp"
#include "CXXR/SchwarzCounter.hpp"
Go to the source code of this file.
Namespaces |
namespace | CXXR |
| Namespace for the CXXR project.
|
Enumerations |
enum | cetype_t {
CE_NATIVE = 0,
CE_UTF8 = 1,
CE_LATIN1 = 2,
CE_BYTES = 3,
CE_SYMBOL = 5,
CE_ANY = 99
} |
Variables |
SEXP | R_NaString |
SEXP | R_BlankString |
Detailed Description
Class CXXR::String and associated C interface.
Function Documentation
Is the encoding of a CXXR::String known?
- Parameters:
-
- Returns:
- a non-zero value iff x is marked as having either LATIN1 encoding or UTF8 encoding.
Is a CXXR::String pure ASCII?
- Parameters:
-
- Returns:
- true iff x contains only ASCII characters..
Does a CXXR::String have bytecode encoding?
- Parameters:
-
- Returns:
- true iff x is marked as having BYTES encoding.
Rboolean IS_LATIN1 |
( |
SEXP |
x | ) |
|
|
inline |
Does a CXXR::String have LATIN1 encoding?
- Parameters:
-
- Returns:
- true iff x is marked as having LATIN1 encoding.
Rboolean IS_UTF8 |
( |
SEXP |
x | ) |
|
|
inline |
Does a CXXR::String have UTF8 encoding?
- Parameters:
-
- Returns:
- true iff x is marked as having UTF8 encoding.
const char* R_CHAR |
( |
SEXP |
x | ) |
|
|
inline |
Access the content of CXXR::String as a C-style string.
- Parameters:
-
- Returns:
const
pointer to character 0 of x .
SEXP Rf_mkChar |
( |
const char * |
str | ) |
|
|
inline |
Get a pointer to a CXXR::String object.
CE_NATIVE encoding is assumed. If no CXXR::String with the specified text and encoding currently exists, one will be created. Otherwise a pointer to the existing CXXR::String will be returned.
- Parameters:
-
str | The null-terminated text of the required string. |
- Returns:
- Pointer to a string object representing the specified text.
SEXP Rf_mkCharCE |
( |
const char * |
str, |
|
|
cetype_t |
encoding |
|
) |
| |
|
inline |
Get a pointer to a CXXR::String object.
If no CXXR::String with the specified text and encoding currently exists, one will be created. Otherwise a pointer to the existing CXXR::String will be returned.
- Parameters:
-
str | The null-terminated text of the required cached string. |
encoding | The encoding of the required String. Only CE_NATIVE, CE_UTF8 or CE_LATIN1 are permitted in this context (checked). |
- Returns:
- Pointer to a string object representing the specified text in the specified encoding.
SEXP Rf_mkCharLen |
( |
const char * |
text, |
|
|
int |
length |
|
) |
| |
|
inline |
Create a CXXR::String object for specified text.
CE_NATIVE encoding is assumed. If no CXXR::String with the specified text and encoding currently exists, one will be created. Otherwise a pointer to the existing CXXR::String will be returned.
- Parameters:
-
text | The text of the string to be created, possibly including embedded null characters. The encoding is assumed to be CE_NATIVE. |
length | The length of the string pointed to by text. Must be nonnegative. The created string will comprise the text plus an appended null byte. |
- Returns:
- Pointer to the created string.
SEXP Rf_mkCharLenCE |
( |
const char * |
text, |
|
|
int |
length, |
|
|
cetype_t |
encoding |
|
) |
| |
Create a CXXR::String object for specified text and encoding.
If no CXXR::String with the specified text and encoding currently exists, one will be created. Otherwise a pointer to the existing CXXR::String will be returned.
- Parameters:
-
text | The text of the string to be created, possibly including embedded null characters. The encoding is assumed to be CE_NATIVE. |
length | The length of the string pointed to by text. Must be nonnegative. The created string will comprise the text plus an appended null byte. |
encoding | The encoding of the required String. Only CE_NATIVE, CE_UTF8 or CE_LATIN1 are permitted in this context (checked). |
- Returns:
- Pointer to the created string.
const char* Rf_translateCharUTF8 |
( |
SEXP |
x | ) |
|
Convert contents of a CXXR::String to UTF8.
- Parameters:
-
- Returns:
- The text of x rendered in UTF8 encoding.
- Note:
- The result is held in memory allocated using R_alloc(). The calling code must arrange for this memory to be released in due course.