os/graphics/graphicsdeviceinterface/gdi/sgdi/BidiCompact.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
//
sl@0
    15
sl@0
    16
#ifndef BIDICOMPACT_H_
sl@0
    17
#define BIDICOMPACT_H_
sl@0
    18
sl@0
    19
#include <e32std.h>
sl@0
    20
#include <bidi.h>
sl@0
    21
sl@0
    22
class TRunInfoCompact
sl@0
    23
/**
sl@0
    24
Stores information about a run and how to re-order it.
sl@0
    25
@internalTechnology
sl@0
    26
*/
sl@0
    27
	{
sl@0
    28
public:
sl@0
    29
	/** Describes text to be re-ordered.
sl@0
    30
	@internalTechnology */
sl@0
    31
	class TReorderingContext
sl@0
    32
		{
sl@0
    33
	public:
sl@0
    34
		/** Where the logical-order text starts. */
sl@0
    35
		const TText* iSource;
sl@0
    36
		/** The start of the line. */
sl@0
    37
		TInt iStart;
sl@0
    38
		/** One past the end of the line. */
sl@0
    39
		TInt iEnd;
sl@0
    40
		/**
sl@0
    41
		 * Truncation character, if there is to be one on this line. Otherwise,
sl@0
    42
		 * 0xFFFF.
sl@0
    43
		 */
sl@0
    44
		TChar iTruncation;
sl@0
    45
		/** ETrue if the line must join at its beginning. */
sl@0
    46
		TBool iJoinsAtStart;
sl@0
    47
		/** ETrue if the line must join at its end. */
sl@0
    48
		TBool iJoinsAtEnd;
sl@0
    49
		};
sl@0
    50
	
sl@0
    51
	/** How to re-order the run.
sl@0
    52
	@internalTechnology */
sl@0
    53
	enum TTypeFlags
sl@0
    54
		{
sl@0
    55
		/** Reverse the run, but not surrogate pairs or combining characters. */
sl@0
    56
		EFRightToLeft = 0x80000000,
sl@0
    57
		/** Simply reverse the run, do not check for surrogates or combiners. */
sl@0
    58
		EFNoPairsNoCombiners = 0x40000000,
sl@0
    59
		/** No mirrored characters are present. */
sl@0
    60
		EFNoMirroredCharacters = 0x20000000
sl@0
    61
		};
sl@0
    62
	
sl@0
    63
	/**	Sets up an empty run.
sl@0
    64
	@internalTechnology */
sl@0
    65
	TRunInfoCompact() : iStart(0), iLengthAndType(0) {}
sl@0
    66
	TRunInfoCompact(TInt aStart, TInt aLength, TBool aReverse,
sl@0
    67
		const TText* aText);
sl@0
    68
	TRunInfoCompact(TInt aStart, TInt aLength, TBool aReverse);
sl@0
    69
	TBool AddRun(const TRunInfoCompact& aToBeAdded);
sl@0
    70
	TText* Reorder(TText* aDestination, const TReorderingContext& aContext) const;
sl@0
    71
sl@0
    72
	/**	@return The start of this run.
sl@0
    73
	@internalTechnology */
sl@0
    74
	TInt Start() const { return iStart; }
sl@0
    75
sl@0
    76
	/**@return The length of this run.
sl@0
    77
	@internalTechnology */
sl@0
    78
	TInt Length() const { return static_cast<TInt>(iLengthAndType & 0x0FFFFFFF); }
sl@0
    79
sl@0
    80
	/** @return The flags associated with this run.
sl@0
    81
	@internalTechnology */
sl@0
    82
	TInt TypeFlags() const { return iLengthAndType & 0xF0000000; }
sl@0
    83
sl@0
    84
	static TInt Convert(TRunInfoCompact* aBuffer, const TDesC& aText,
sl@0
    85
		const TBidirectionalState::TRunInfo* aRunArray, TInt aArraySize);
sl@0
    86
	static TBool JoinBefore(const TText* aText, TInt aIndex);
sl@0
    87
private:
sl@0
    88
	TInt iStart;
sl@0
    89
	TUint iLengthAndType;
sl@0
    90
	};
sl@0
    91
sl@0
    92
#endif
sl@0
    93