1 /*---------------------------------------------------------------------------* 2 Project: Horizon 3 File: font_TagProcessorBase.h 4 5 Copyright (C)2009-2010 Nintendo Co., Ltd./HAL Laboratory, Inc. All rights reserved. 6 7 These coded instructions, statements, and computer programs contain 8 proprietary information of Nintendo of America Inc. and/or Nintendo 9 Company Ltd., and are protected by Federal copyright law. They may 10 not be disclosed to third parties or copied or duplicated in any form, 11 in whole or in part, without the prior written consent of Nintendo. 12 13 $Revision: 25674 $ 14 *---------------------------------------------------------------------------*/ 15 16 #ifndef NN_FONT_CTR_FONT_TAG_PROCESSOR_BASE_H_ 17 #define NN_FONT_CTR_FONT_TAG_PROCESSOR_BASE_H_ 18 19 #include <nn/types.h> 20 #include <nn/util/util_Rect.h> 21 22 namespace nn { 23 namespace font { 24 namespace CTR { 25 26 27 28 template <typename CharType> 29 class TextWriterBase; 30 31 32 template <typename CharType> 33 struct PrintContext 34 { 35 TextWriterBase<CharType>* writer; // 36 const CharType* str; // 37 const f32 xOrigin; // 38 const f32 yOrigin; // 39 u32 flags; // 40 PrintContextPrintContext41 PrintContext( 42 TextWriterBase<CharType>* aWriter, 43 const CharType* aStr, 44 const f32 aXOrigin, 45 const f32 aYOrigin, 46 u32 aFlags 47 ) 48 : writer(aWriter), 49 str(aStr), 50 xOrigin(aXOrigin), 51 yOrigin(aYOrigin), 52 flags(aFlags) 53 {} 54 }; 55 56 #if defined( __CC_ARM ) || defined( __ARMCC_VERSION ) 57 #pragma push 58 #pragma diag_suppress 2819 // class XXX has an implicitly instantiated key function YYY 59 #endif 60 61 //--------------------------------------------------------------------------- 62 // 63 // 64 // 65 //--------------------------------------------------------------------------- 66 template <typename CharType> 67 class TagProcessorBase 68 { 69 public: 70 /* ------------------------------------------------------------------------ 71 Types 72 ------------------------------------------------------------------------ */ 73 74 // 75 enum Operation 76 { 77 // 78 // 79 // 80 OPERATION_DEFAULT, 81 82 // 83 // 84 // 85 // 86 OPERATION_NO_CHAR_SPACE, 87 88 // 89 // 90 // 91 // 92 OPERATION_CHAR_SPACE, 93 94 // 95 // 96 // 97 // 98 OPERATION_NEXT_LINE, 99 100 // 101 // 102 OPERATION_END_DRAW, 103 104 // 105 NUM_OF_OPERATION 106 }; 107 108 /* ------------------------------------------------------------------------ 109 Functions 110 ------------------------------------------------------------------------ */ 111 112 // 113 // 114 115 // 116 TagProcessorBase(); 117 118 // 119 virtual ~TagProcessorBase(); 120 121 // 122 123 124 // 125 // 126 127 // 128 // 129 // 130 // 131 // 132 // 133 // 134 virtual Operation Process( 135 u16 code, 136 PrintContext<CharType>* pContext); 137 138 // 139 // 140 // 141 // 142 // 143 // 144 // 145 // 146 // 147 virtual Operation CalcRect( 148 util::Rect* pRect, 149 u16 code, 150 PrintContext<CharType>* pContext); 151 152 // 153 154 private: 155 /* ------------------------------------------------------------------------ 156 Types 157 ------------------------------------------------------------------------ */ 158 typedef PrintContext<CharType> ContextType; 159 160 void ProcessLinefeed(ContextType* pContext); 161 void ProcessTab(ContextType* pContext); 162 }; 163 164 #if defined( __CC_ARM ) || defined( __ARMCC_VERSION ) 165 #pragma pop 166 #endif 167 168 } // namespace CTR 169 } // namespace font 170 } // namespace nn 171 172 #endif // NN_FONT_CTR_FONT_TAG_PROCESSOR_BASE_H_ 173