messagingappbase/msgeditor/modelsrc/MsgEditorFlags.cpp
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     1 /*
       
     2 * Copyright (c) 2002 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:  MsgEditorFlags implementation
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // ========== INCLUDE FILES ================================
       
    21 
       
    22 #include <s32strm.h>             // streams
       
    23 
       
    24 #include "MsgEditorFlags.h"      // class
       
    25 
       
    26 // ========== EXTERNAL DATA STRUCTURES =====================
       
    27 
       
    28 // ========== EXTERNAL FUNCTION PROTOTYPES =================
       
    29 
       
    30 // ========== CONSTANTS ====================================
       
    31 
       
    32 // ========== MACROS =======================================
       
    33 
       
    34 // ========== LOCAL CONSTANTS AND MACROS ===================
       
    35 
       
    36 // ========== MODULE DATA STRUCTURES =======================
       
    37 
       
    38 // ========== LOCAL FUNCTION PROTOTYPES ====================
       
    39 
       
    40 // ========== LOCAL FUNCTIONS ==============================
       
    41 
       
    42 // ========== MEMBER FUNCTIONS =============================
       
    43 
       
    44 // ---------------------------------------------------------
       
    45 // TMsgEditorFlags::TMsgEditorFlags
       
    46 //
       
    47 // Constructor.
       
    48 // ---------------------------------------------------------
       
    49 //
       
    50 EXPORT_C TMsgEditorFlags::TMsgEditorFlags() : iFlags(0L) { }
       
    51 
       
    52 // ---------------------------------------------------------
       
    53 // TMsgEditorFlags::TMsgEditorFlags
       
    54 //
       
    55 // Copy constructor.
       
    56 // ---------------------------------------------------------
       
    57 //
       
    58 EXPORT_C TMsgEditorFlags::TMsgEditorFlags(const TMsgEditorFlags& aFlags) : iFlags(aFlags.iFlags) { }
       
    59 
       
    60 // ---------------------------------------------------------
       
    61 // TMsgEditorFlags::TMsgEditorFlags
       
    62 //
       
    63 // Constructor.
       
    64 // ---------------------------------------------------------
       
    65 //
       
    66 EXPORT_C TMsgEditorFlags::TMsgEditorFlags(TUint32 aFlags) : iFlags(aFlags) { }
       
    67 
       
    68 // ---------------------------------------------------------
       
    69 // TMsgEditorFlags::Set
       
    70 //
       
    71 // Sets the given flags (several flags may be set at the same time).
       
    72 // ---------------------------------------------------------
       
    73 //
       
    74 EXPORT_C void TMsgEditorFlags::Set(TUint32 aFlag)
       
    75 {
       
    76     iFlags |= aFlag;
       
    77 }
       
    78 
       
    79 // ---------------------------------------------------------
       
    80 // TMsgEditorFlags::Clear
       
    81 //
       
    82 // Clears given flags.
       
    83 // ---------------------------------------------------------
       
    84 //
       
    85 EXPORT_C void TMsgEditorFlags::Clear(TUint32 aFlag)
       
    86 {
       
    87     TUint32 mask = ~aFlag;
       
    88     iFlags &= mask;
       
    89 }
       
    90 
       
    91 // ---------------------------------------------------------
       
    92 // TMsgEditorFlags::IsSet
       
    93 //
       
    94 // Returns ETrue, if all flags defined in aFlag parameter are set.
       
    95 // ---------------------------------------------------------
       
    96 //
       
    97 EXPORT_C TBool TMsgEditorFlags::IsSet(TUint32 aFlag) const
       
    98 {
       
    99     return (iFlags & aFlag) != 0;
       
   100 }
       
   101 
       
   102 // ---------------------------------------------------------
       
   103 // TMsgEditorFlags::operator=
       
   104 //
       
   105 // Assignment operator.
       
   106 // ---------------------------------------------------------
       
   107 //
       
   108 EXPORT_C TMsgEditorFlags& TMsgEditorFlags::operator=(const TMsgEditorFlags& aFlags)
       
   109 {
       
   110     if (&aFlags != this)        // self assignment => nothing to do
       
   111     {
       
   112         iFlags = aFlags.iFlags;
       
   113     }
       
   114     return *this;
       
   115 }
       
   116 
       
   117 // ---------------------------------------------------------
       
   118 // TMsgEditorFlags::ExternalizeL
       
   119 //
       
   120 // Write flags into given stream.
       
   121 // ---------------------------------------------------------
       
   122 //
       
   123 EXPORT_C void TMsgEditorFlags::ExternalizeL(RWriteStream& aStream) const
       
   124 {
       
   125     aStream << iFlags;
       
   126 }
       
   127 
       
   128 // ---------------------------------------------------------
       
   129 // TMsgEditorFlags::InternalizeL
       
   130 //
       
   131 // Read flags from given stream.
       
   132 // ---------------------------------------------------------
       
   133 //
       
   134 EXPORT_C void TMsgEditorFlags::InternalizeL(RReadStream& aStream)
       
   135 {
       
   136     aStream >> iFlags;
       
   137 }
       
   138 
       
   139 //  End of File