EasyManuals Logo
Home>Casio>Calculator>ClassPad 300

Casio ClassPad 300 Programming Guide

Casio ClassPad 300
125 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #99 background imageLoading...
Page #99 background image
CPString
The CPString is a C++ class that encapsulates the memory allocation necessary for string
handling and multi-byte string handling, while still providing access to a raw character
buffer.
The character buffer is dynamically allocated, and may be reallocated when the string is
modified. If the string is modified, destroyed, or goes out of scope, any saved reference
to the string (a saved value from Text() or an iterator) should be considered invalid. The
exception is if an iterator is passed by reference to the operator that modified the string,
the iterator will be automatically updated.
CPString is not a reference counted string. If you pass a CPString as an argument to a
function it will make a complete copy of that string. This is not very efficient and can
waste a lot of memory. If you plan on passing a CPString as an argument to a function
you should pass it as a constant reference. For example:
void MyFunction(const CPString& str)
{
... do something ...
}
Constructors and Assignment
To create a new CPString you can use one of the following constructors:
CPString();
CPString(CPMCHAR c);
CPString(const PEGCHAR* s);
CPString(const CPString& y);
CPString(OBCD d, int num_digits);
Instead of explicitly creating a string with a constructor, the assignment and
concatenation characters are also defined as:
CPString& operator=(const CPString& y);
CPString& operator+=(const CPString& y);
CPString& operator+=(const PEGCHAR *y);
Here are some examples of creating CPStrings:
CPString str1;
str1 = "Hello world.";
str1 += " How are you?"; //str1 now equals “Hello world. How are you?”
CPString str2("I am fine.");
CPString str3(str2); //str2=str3=”I am fine.”
99

Table of Contents

Other manuals for Casio ClassPad 300

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Casio ClassPad 300 and is the answer not in the manual?

Casio ClassPad 300 Specifications

General IconGeneral
BrandCasio
ModelClassPad 300
CategoryCalculator
LanguageEnglish

Related product manuals