blob: 4e7a502f03aed08d416fed6c2d6da04439565798
1 | // |
2 | // |
3 | // amlogic 2013 |
4 | // |
5 | // @ Project : tv |
6 | // @ File Name : CTvDimension.h |
7 | // @ Date : 2013-11 |
8 | // @ Author : |
9 | // |
10 | // |
11 | |
12 | #if !defined(_CTVDIMENSION_H) |
13 | #define _CTVDIMENSION_H |
14 | #include <utils/Vector.h> |
15 | #include "CTvDatabase.h" |
16 | #include <utils/String8.h> |
17 | #include <stdlib.h> |
18 | |
19 | #include "CTvLog.h" |
20 | |
21 | // TV ATSC rating dimension |
22 | class CTvDimension { |
23 | public: |
24 | class VChipRating { |
25 | private: |
26 | int region; |
27 | int dimension; |
28 | int value; |
29 | |
30 | public: |
31 | VChipRating(int region, int dimension, int value); |
32 | VChipRating(); |
33 | ~VChipRating(); |
34 | int getRegion(); |
35 | int getDimension(); |
36 | int getValue()const; |
37 | }; |
38 | /* 'All' is a very special case, it links to dimension0 & dimension5 */ |
39 | void createFromCursor(CTvDatabase::Cursor &c); |
40 | static int getUSPGAllLockStatus(String8 abbrev); |
41 | static void setUSPGAllLockStatus(String8 abbrev, int lock); |
42 | static void selectByID(CTvDimension &dm, int id); |
43 | static int selectByIndex(CTvDimension &dm, int ratingRegionID, int index); |
44 | static void selectByName(CTvDimension &dm, int ratingRegionID, String8 dimensionName); |
45 | static void selectByRatingRegion(CTvDimension &dm, int ratingRegionID); |
46 | bool isBlocked(CTvDimension &dm, VChipRating *definedRating); |
47 | int getID(); |
48 | int getRatingRegion(); |
49 | String8 getRatingRegionName(); |
50 | String8 getName(); |
51 | int getGraduatedScale(); |
52 | int getDefinedValue(); |
53 | //int* getLockStatus(); |
54 | int getLockStatus(int valueIndex); |
55 | void getLockStatus(String8 abbrevs[], int lock[], int *array_len); |
56 | int getAbbrev(String8 abb[]); |
57 | String8 getAbbrev(int valueIndex); |
58 | int getText(String8 tx[]); |
59 | String8 getText(int valueIndex); |
60 | void setLockStatus(int valueIndex, int status); |
61 | void setLockStatus(int status[]); |
62 | void setLockStatus(String8 abbrevs[], int locks[], int abb_size); |
63 | /**Rating regions*/ |
64 | public: |
65 | static const int REGION_US = 0x1; |
66 | static const int REGION_CANADA = 0x2; |
67 | static const int REGION_TAIWAN = 0x3; |
68 | static const int REGION_SOUTHKOREA = 0x4; |
69 | |
70 | CTvDimension(CTvDatabase::Cursor &c); |
71 | CTvDimension(); |
72 | ~CTvDimension(); |
73 | |
74 | static void insertNewDimension(const int region, String8 regionName, String8 name, |
75 | int indexj, int *lock, const char **abbrev, const char **text, int size); |
76 | static void builtinAtscDimensions(); |
77 | static int isDimensionTblExist(); |
78 | String8 getCurdimension(); |
79 | String8 getCurAbbr(); |
80 | String8 getCurText(); |
81 | private: |
82 | int id; |
83 | int indexj; |
84 | int ratingRegion; |
85 | int graduatedScale; |
86 | int valuesDefined; |
87 | int *lockValues; |
88 | String8 name; |
89 | String8 ratingRegionName; |
90 | String8 *abbrevValues; |
91 | String8 *textValues; |
92 | bool isPGAll; |
93 | String8 CurvchipDimension; |
94 | String8 CurvchipAbbrev; |
95 | String8 CurvchipText; |
96 | }; |
97 | #endif //_CTVDIMENSION_H |
98 |