1 /*---------------------------------------------------------------------------*
2   Project:  Horizon
3   File:     ngc_IProfanityFilter.h
4 
5   Copyright (C)2010 Nintendo Co., Ltd.  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   $Rev: 33638 $
14  *---------------------------------------------------------------------------*/
15 
16 #ifndef NN_NGC_CTR_PROFANITY_FILTER_BASE_H_
17 #define NN_NGC_CTR_PROFANITY_FILTER_BASE_H_
18 
19 #include <nn/cfg/CTR/cfg_RegionCode.h>
20 
21 namespace nn
22 {
23 namespace ngc
24 {
25 namespace CTR
26 {
27 
28 /* Please see man pages for details
29 
30 
31 
32 
33  */
34 class ProfanityFilterBase
35 {
36 public:
37     /* Please see man pages for details
38 
39      */
~ProfanityFilterBase()40     virtual ~ProfanityFilterBase(){}
41 
42     /* Please see man pages for details
43 
44 
45      */
46     virtual u32 GetContentVersion() = 0;
47 
48     /* Please see man pages for details
49 
50 
51 
52 
53 
54 
55 
56 
57 
58 
59 
60 
61 
62 
63 
64 
65 
66 
67 
68 
69 
70 
71 
72      */
73     virtual nn::Result CheckProfanityWords( bit32* pCheckResults, const wchar_t** ppWords, size_t nWordCount ) = 0;
74 
75     /* Please see man pages for details
76 
77 
78 
79 
80 
81 
82 
83 
84 
85 
86 
87 
88 
89 
90 
91 
92 
93 
94 
95 
96 
97 
98 
99      */
100     virtual nn::Result CheckProfanityWords( bit32* pCheckResults, ProfanityFilterPatternList nPatternCode, const wchar_t** ppWords, size_t nWordCount ) = 0;
101 
102     /* Please see man pages for details
103 
104 
105 
106 
107 
108 
109 
110 
111 
112 
113 
114 
115 
116 
117 
118 
119 
120 
121 
122 
123 
124 
125 
126 
127 
128 
129      */
130     virtual nn::Result CheckProfanityWords( bit32* pCheckResults, bool bCommunicateWithOtherRegions, const wchar_t** ppWords, size_t nWordCount ) = 0;
131 
132 protected:
133     void GetPatternListsFromRegion( ProfanityFilterPatternList* pPatternLists, int *pListNum, bool bCommunicateWithOtherRegions );
134     void ConvertTargetWord( wchar_t* pConvertedWord, const wchar_t* pWord );
135     bool IsIncludesAtSign( const wchar_t* pWord );
136 
137 private:
138     /* Please see man pages for details
139 
140      */
141     typedef struct SmallMap
142     {
143         //
144         wchar_t small;
145 
146         //
147         wchar_t big;
148     } SmallMap;
149 
150     /* Please see man pages for details
151 
152      */
153     typedef struct HalfwidthMap
154     {
155         //
156         wchar_t half;
157 
158         //
159         wchar_t full;
160     } HalfwidthMap;
161 
162     void ConvertKatakanaToBig( wchar_t *pKana );
163     bool ConvertHalfwidthKatakanaToFullwidth( wchar_t *pBuffer, wchar_t half, const HalfwidthMap* pMapping, int mapNum );
164 
165 private:
166     static const SmallMap s_SmallMapping[];
167     static const HalfwidthMap s_HalfMapping[];
168     static const HalfwidthMap s_VoicedMapping[];
169     static const HalfwidthMap s_SemiVoicedMapping[];
170 };
171 
172 }   // namespace CTR
173 }   // namespaec ngc
174 }   // namespace nn
175 
176 #endif // NN_NGC_CTR_PROFANITY_FILTER_BASE_H_
177