webengine/wmlengine/src/lmgr/src/LMgrFormatContext.cpp
changeset 74 91031d3aab7d
parent 68 92a765b5b3e7
child 85 e358f2276d3f
equal deleted inserted replaced
68:92a765b5b3e7 74:91031d3aab7d
     1 /*
       
     2 * Copyright (c) 2000 - 2001 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 the License "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: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "nw_lmgr_formatcontexti.h"
       
    20 #include "nw_lmgr_linebox.h"
       
    21 #include "nw_lmgr_box.h"
       
    22 #include "BrsrStatusCodes.h"
       
    23 
       
    24 /* ------------------------------------------------------------------------- *
       
    25    class definition
       
    26  * ------------------------------------------------------------------------- */
       
    27 
       
    28 /* ------------------------------------------------------------------------- */
       
    29 const
       
    30 NW_LMgr_FormatContext_Class_t NW_LMgr_FormatContext_Class = {
       
    31   { /* NW_Object_Core          */
       
    32     /* super                   */ &NW_Object_Dynamic_Class,
       
    33     /* queryInterface          */ _NW_Object_Base_QueryInterface
       
    34   },
       
    35   { /* NW_Object_Base          */
       
    36     /* interfaceList           */ NULL
       
    37   },
       
    38   { /* NW_Object_Dynamic       */
       
    39     /* instanceSize            */ sizeof (NW_LMgr_FormatContext_t),
       
    40     /* construct               */ _NW_LMgr_FormatContext_Construct,
       
    41     /* destruct                */ _NW_LMgr_FormatContext_Destruct
       
    42   },
       
    43   { /* NW_LMgr_FormatContext   */
       
    44     /* unused                  */ NW_Object_Unused
       
    45   }
       
    46 };
       
    47 
       
    48 /* ------------------------------------------------------------------------- */
       
    49 TBrowserStatusCode
       
    50 _NW_LMgr_FormatContext_Construct (NW_Object_Dynamic_t* dynamicObject,
       
    51                                   va_list* argp)
       
    52 {
       
    53   NW_TRY (status) {
       
    54     NW_LMgr_FormatContext_t* thisObj;
       
    55 
       
    56     /* avoid 'unreferenced formal parameter' warnings */
       
    57     (void) argp;
       
    58 
       
    59     /* for convenience */
       
    60     thisObj = NW_LMgr_FormatContextOf (dynamicObject);
       
    61 
       
    62     /* Initialize the member variables */
       
    63     thisObj->currentLine = NW_LMgr_LineBox_New();
       
    64     NW_THROW_OOM_ON_NULL (thisObj->currentLine, status);
       
    65 
       
    66   } NW_CATCH (status) {
       
    67   } NW_FINALLY {
       
    68     return status;
       
    69   } NW_END_TRY
       
    70 }
       
    71   
       
    72 /* ------------------------------------------------------------------------- */
       
    73 void
       
    74 _NW_LMgr_FormatContext_Destruct (NW_Object_Dynamic_t* dynamicObject)
       
    75 {
       
    76   NW_LMgr_FormatContext_t* thisObj;
       
    77 
       
    78   /* for convenience */
       
    79   thisObj = NW_LMgr_FormatContextOf (dynamicObject);
       
    80 
       
    81   /* Destroy the line box */
       
    82   NW_Object_Delete (thisObj->currentLine);
       
    83 }
       
    84 
       
    85 /* ------------------------------------------------------------------------- *
       
    86   convenience functions
       
    87  * ------------------------------------------------------------------------- */
       
    88 
       
    89 NW_LMgr_FormatContext_t*
       
    90 NW_LMgr_FormatContext_New ()
       
    91 {
       
    92   return (NW_LMgr_FormatContext_t*)
       
    93     NW_Object_New (&NW_LMgr_FormatContext_Class);
       
    94 }
       
    95