javaextensions/iapinfo/inc.s60/stringbuffer.h
branchRCL_3
changeset 19 04becd199f91
equal deleted inserted replaced
16:f5050f1da672 19:04becd199f91
       
     1 /*
       
     2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Header file of the StringBuffer class
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 ///////////////////////////////////////////////////////////////////////////////
       
    20 //
       
    21 // StringBuffer class is a simple helper utility which provides the following
       
    22 // functions:
       
    23 //
       
    24 // * concatenate HBufC strings
       
    25 // * concatenate HBufC strings with TInt
       
    26 // * create java string (jstring) object from HBufC
       
    27 // * create HBufC object from jstring java object
       
    28 //
       
    29 ///////////////////////////////////////////////////////////////////////////////
       
    30 #include <jni.h>
       
    31 #include <e32cons.h>
       
    32 
       
    33 #define KInitialSize 10
       
    34 
       
    35 class StringBuffer
       
    36 {
       
    37 public:
       
    38     const static TInt KBUFMAX = 10;
       
    39     //Method to create a new StringBuffer object
       
    40     static StringBuffer* NewL();
       
    41     //Method to append an HBufC to the buffer
       
    42     void Append(HBufC* what);
       
    43     //Method to append a TDesC to the buffer
       
    44     void Append(const TDesC &what);
       
    45     //Method to append an integer-TInt to the buffer
       
    46     void Append(TInt aWhat);
       
    47     //Method to create a java string from the c++ buffer
       
    48     jstring ToJavaString(JNIEnv* aJNI);
       
    49     //Method to get the string object stored in the buffer
       
    50     HBufC* GetString();
       
    51     //Method to create a java string from an HBufC object
       
    52     static jstring CreateJavaString(JNIEnv* aJNI, const HBufC* aString);
       
    53     //Method to create an HBufC string from a java string object
       
    54     static HBufC* CreateHBufCFromJavaStringLC(JNIEnv* aJNI, jstring aString);
       
    55     //Destructor
       
    56     ~StringBuffer();
       
    57 private:
       
    58     //Constructor
       
    59     StringBuffer();
       
    60     //method to construct the objects in buffer
       
    61     void ConstructL();
       
    62     //variable which stores the string in the buffer
       
    63     HBufC* String;
       
    64 };