TOC PREV NEXT INDEX


Character String Types


Character string types are derived from the built-in base class OSXMLStringClass. This class is in turn derived from the OSXMLSTRING C struct type which contains a value member character pointer variable.
An example of the constructors and assignment operators generated for a character string type is shown for the following definition:

   <xsd:simpleType name="Date">
 
      <xsd:restriction base="xsd:string"/>
 
   </xsd:simpleType>
 

The C++ constructors and assignment operators generated for this definition are as follows:

class EXTERN Date : public OSXMLStringClass {
 
public:
 
   Date ();
 
   Date (const OSUTF8CHAR* value);
 
   Date (const char* value);
 
   Date& operator= (const OSUTF8CHAR* value);
 
   Date& operator= (const char* value);
 

Note that constructors and operators are available that allow strings to be specified as either standard C character strings or as UTF-8 strings.
It is also possible to transfer ownership of memory for a string to the string class. This is done by using the setOwnMemory method defined in the OSBaseType base class. For example, the following series of calls will cause the allocated string variable to be deleted when the encapsulating Date class instance goes out of scope:
const char* myStringVar = new char [40];
 
strcpy (myStringVar, "22 Feb 2004");
 
Date myDate (myStringVar);
 
myDate.setOwnMemory (TRUE);
 


Copyright © Objective Systems 2002-2005
This document may be distributed in any form, electronic or otherwise, provided that it is distributed in its entirety and that the copyright and this notice are included.
  Objective Systems, Inc.
102 Pickering Way, Suite #506
Exton, Pennsylvania 19341
http://www.obj-sys.com
Phone: (484) 875-9841
Toll-free: (877) 307-6855 (US only)
Fax: (484) 875-9830
info@obj-sys.com
TOC PREV NEXT INDEX