xml/libxml2libs/inc/xmlengineutils/xmlengxestrings.inl
changeset 0 e35f40988205
equal deleted inserted replaced
-1:000000000000 0:e35f40988205
       
     1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Declaration of methods from string classes.
       
    15 //
       
    16 
       
    17 inline TXmlEngConstString::TXmlEngConstString()
       
    18         : iString(NULL) {}
       
    19 
       
    20 inline TXmlEngConstString::TXmlEngConstString(const char* const aString) 
       
    21         :iString(const_cast<char*>(aString)) {}
       
    22 
       
    23 inline TBool TXmlEngConstString::NotNull() const 
       
    24     {return iString!=NULL;}
       
    25 
       
    26 inline TBool TXmlEngConstString::IsNull()  const 
       
    27     {return iString==NULL;}
       
    28 
       
    29 inline const char* TXmlEngConstString::Cstring() const 
       
    30     {return iString;}
       
    31 
       
    32 inline const char* TXmlEngConstString::CstringDef(const char* aDefaultValue) const 
       
    33     {return iString ? iString : aDefaultValue;}
       
    34 
       
    35 inline TBool TXmlEngConstString::Equals(TXmlEngConstString aString) const
       
    36     {return !Compare(aString);}
       
    37 
       
    38 inline TPtrC8 TXmlEngConstString::PtrC8() const 
       
    39     {return TPtrC8((TUint8*)iString, Size());}
       
    40 
       
    41 inline void TXmlEngConstString::Set(char* aString) 
       
    42     {iString = aString;}
       
    43 
       
    44 // ---------------------------------------------------- TXmlEngString
       
    45 
       
    46 // --------------------------------------------------------------------------------------
       
    47 // Default constructor
       
    48 // --------------------------------------------------------------------------------------
       
    49 //
       
    50 inline TXmlEngString::TXmlEngString()
       
    51     :TXmlEngConstString(NULL) {}
       
    52 
       
    53 // --------------------------------------------------------------------------------------
       
    54 //Constructor for TDOMString initialized with given c-string
       
    55 // --------------------------------------------------------------------------------------
       
    56 //
       
    57 inline TXmlEngString::TXmlEngString(char* aString)
       
    58         :TXmlEngConstString(aString) {}
       
    59 
       
    60 // --------------------------------------------------------------------------------------
       
    61 // Sets new value; old contents is freed
       
    62 // --------------------------------------------------------------------------------------
       
    63 //
       
    64 inline void TXmlEngString::Set(char* aStr) 
       
    65     {delete iString; iString = aStr;}
       
    66 
       
    67 inline void TXmlEngString::Close() 
       
    68     {Free();}
       
    69 
       
    70 // --------------------------------------------------------------------------------------
       
    71 // Pushes string pointer to CleanupStack. 
       
    72 // 
       
    73 // DO NOT forget to call CleanupStack::PopAndDestroy() for it
       
    74 // (or CleanupStack::Pop() and then Free())
       
    75 // --------------------------------------------------------------------------------------
       
    76 //
       
    77 inline TXmlEngString TXmlEngString::PushL() 
       
    78     {CleanupStack::PushL((TAny*)iString); return *this;}