1 /*
2  *
3  * (C) Copyright IBM Corp. 1998-2013 - All Rights Reserved
4  *
5  */
6 
7 #include "LETypes.h"
8 #include "MorphTables.h"
9 #include "SubtableProcessor.h"
10 #include "NonContextualGlyphSubst.h"
11 #include "NonContextualGlyphSubstProc.h"
12 #include "SimpleArrayProcessor.h"
13 #include "SegmentSingleProcessor.h"
14 #include "SegmentArrayProcessor.h"
15 #include "SingleTableProcessor.h"
16 #include "TrimmedArrayProcessor.h"
17 #include "LESwaps.h"
18 
19 U_NAMESPACE_BEGIN
20 
NonContextualGlyphSubstitutionProcessor()21 NonContextualGlyphSubstitutionProcessor::NonContextualGlyphSubstitutionProcessor()
22 {
23 }
24 
NonContextualGlyphSubstitutionProcessor(const LEReferenceTo<MorphSubtableHeader> & morphSubtableHeader,LEErrorCode & success)25 NonContextualGlyphSubstitutionProcessor::NonContextualGlyphSubstitutionProcessor(const LEReferenceTo<MorphSubtableHeader> &morphSubtableHeader, LEErrorCode &success)
26   : SubtableProcessor(morphSubtableHeader, success)
27 {
28 }
29 
~NonContextualGlyphSubstitutionProcessor()30 NonContextualGlyphSubstitutionProcessor::~NonContextualGlyphSubstitutionProcessor()
31 {
32 }
33 
createInstance(const LEReferenceTo<MorphSubtableHeader> & morphSubtableHeader,LEErrorCode & success)34 SubtableProcessor *NonContextualGlyphSubstitutionProcessor::createInstance(const LEReferenceTo<MorphSubtableHeader> &morphSubtableHeader, LEErrorCode &success)
35 {
36   LEReferenceTo<NonContextualGlyphSubstitutionHeader> header(morphSubtableHeader, success);
37 
38   if(LE_FAILURE(success)) return NULL;
39 
40   switch (SWAPW(header->table.format)) {
41     case ltfSimpleArray:
42       return new SimpleArrayProcessor(morphSubtableHeader, success);
43 
44     case ltfSegmentSingle:
45       return new SegmentSingleProcessor(morphSubtableHeader, success);
46 
47     case ltfSegmentArray:
48       return new SegmentArrayProcessor(morphSubtableHeader, success);
49 
50     case ltfSingleTable:
51       return new SingleTableProcessor(morphSubtableHeader, success);
52 
53     case ltfTrimmedArray:
54       return new TrimmedArrayProcessor(morphSubtableHeader, success);
55 
56     default:
57         return NULL;
58     }
59 }
60 
61 U_NAMESPACE_END
62