• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2007 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #ifndef _OPERATIONPERMISSION_H
17 #define _OPERATIONPERMISSION_H
18 
19 #include <Drm2CommonTypes.h>
20 #include <rights/Constraint.h>
21 
22 class OperationPermission {
23 public:
24     enum OPERATION {NONE, PLAY, DISPLAY, EXECUTE, PRINT, EXPORT, COMMON};
25 
26     /**
27      * Construtor of OperationPermission.
28      */
29     OperationPermission();
30 
31     /**
32      * Construtor of OperationPermission.
33      * @param type the specific operation type.
34      * @param cst the constraint related with operation permission.
35      */
36     OperationPermission(OPERATION type, Constraint* cst=NULL);
37 
38     /**
39      * Destrutor of OperationPermission.
40      */
41     ~OperationPermission();
42 
43     /**
44      * Set the type for operation permission.
45      * @param type the specific type.
46      */
47     void setType(OPERATION type);
48 
49     /**
50      * Get the type of operation permission.
51      * @return operation type.
52      */
53     OPERATION getType() const;
54 
55     /**
56      * Add constraint for operation permission.
57      * @param constraint the constraint related with operation permission.
58      */
59     void addConstraint(Constraint* constraint);
60 
61     /**
62      * Add constraint for operation permission.
63      * @return constraint related with operation permission.
64      */
65     Constraint* getConstraint() const;
66 
67 PRIVATE:
68     OPERATION mType;
69     Constraint* mConstraint;
70 
71 PRIVATE:
72     /**
73      * Disable the assignment between OperationPermissions.
74      */
75     OperationPermission& operator=(const OperationPermission &op);
76 
77     /**
78      * Disable copy construtor.
79      */
80     OperationPermission(const OperationPermission &op);
81 };
82 
83 #endif
84