omasuplasnconverterstubimpl/src/asnimplementation.cpp
changeset 0 0ce1b5ce9557
equal deleted inserted replaced
-1:000000000000 0:0ce1b5ce9557
       
     1 /*
       
     2 * Copyright (c) 2009 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: Declaration of ASN plugin
       
    15 *
       
    16 */
       
    17 
       
    18 //  Include Files  
       
    19 
       
    20 #include "asnimplementation.h"	// CAsnImplementation
       
    21 #include "asnimplementation.pan"	  	// panic codes
       
    22 #include <ecom/implementationproxy.h>
       
    23 #include "asnimplementationBase.h"
       
    24 
       
    25 //  Member Functions
       
    26 
       
    27 EXPORT_C CAsnImplementation* CAsnImplementation::NewLC()
       
    28     {
       
    29     CAsnImplementation* self = new (ELeave) CAsnImplementation;
       
    30     CleanupStack::PushL(self);
       
    31     self->ConstructL();
       
    32     return self;
       
    33     }
       
    34 
       
    35 EXPORT_C CAsnImplementation* CAsnImplementation::NewL()
       
    36     {
       
    37     CAsnImplementation* self = CAsnImplementation::NewLC();
       
    38     CleanupStack::Pop(self);
       
    39     return self;
       
    40     }
       
    41 
       
    42 CAsnImplementation::CAsnImplementation()
       
    43 // note, CBase initialises all member variables to zero
       
    44     {
       
    45     }
       
    46 
       
    47 void CAsnImplementation::ConstructL()
       
    48     {
       
    49     // second phase constructor, anything that may leave must be constructed here
       
    50     iString = new (ELeave) TAsnImplementationExampleString;
       
    51     }
       
    52 
       
    53 EXPORT_C CAsnImplementation::~CAsnImplementation()
       
    54     {
       
    55     delete iString;
       
    56     }
       
    57 
       
    58 EXPORT_C TVersion CAsnImplementation::Version() const
       
    59     {
       
    60     // Version number of example API
       
    61     const TInt KMajor = 1;
       
    62     const TInt KMinor = 0;
       
    63     const TInt KBuild = 1;
       
    64     return TVersion(KMajor, KMinor, KBuild);
       
    65     }
       
    66 
       
    67 EXPORT_C void CAsnImplementation::ExampleFuncAddCharL(const TChar& aChar)
       
    68     {
       
    69     __ASSERT_ALWAYS(iString != NULL, Panic(EAsnImplementationNullPointer));
       
    70 
       
    71     if (iString->Length() >= KAsnImplementationBufferLength)
       
    72         {
       
    73         User::Leave(KErrTooBig);
       
    74         }
       
    75 
       
    76     iString->Append(aChar);
       
    77     }
       
    78 
       
    79 EXPORT_C void CAsnImplementation::ExampleFuncRemoveLast()
       
    80     {
       
    81     __ASSERT_ALWAYS(iString != NULL, Panic(EAsnImplementationNullPointer));
       
    82 
       
    83     if (iString->Length() > 0)
       
    84         {
       
    85         iString->SetLength(iString->Length() - 1);
       
    86         }
       
    87     }
       
    88 
       
    89 EXPORT_C const TPtrC CAsnImplementation::ExampleFuncString() const
       
    90     {
       
    91     __ASSERT_ALWAYS(iString != NULL, Panic(EAsnImplementationNullPointer));
       
    92     return *iString;
       
    93     }
       
    94 
       
    95 const TImplementationProxy ImplementationTable[] =
       
    96     {
       
    97     
       
    98     #ifdef __EABI__ 
       
    99         IMPLEMENTATION_PROXY_ENTRY(0xE4D72222, CAsnImplementationBase::NewL) 
       
   100     #else
       
   101         { { 0xE4D72222 },  CAsnImplementationBase::NewL}
       
   102     #endif        
       
   103         
       
   104     };
       
   105 
       
   106 // Exported proxy for instantiation method resolution.
       
   107 EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
       
   108     TInt& aTableCount)
       
   109     {
       
   110     aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
       
   111     return ImplementationTable;
       
   112     }