897dad6f146eefe954d3ad238c1c1488b2cb883d
[framework/web/wrt-plugins-common.git] / src / modules / API / Messaging / IAttachment.h
1 /*
2  * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
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 /**
17  *
18  *
19  * @file       IAttachment.h
20  * @author     Pawel Misiak (p.misiak@samsung.com)
21  * @version    0.1
22  * @brief
23  */
24 #ifndef IATTACHMENT_H
25 #define IATTACHMENT_H
26
27 #include <string>
28 #include <dpl/shared_ptr.h>
29 #include "IMessagingTypes.h"
30
31 namespace WrtDeviceApis {
32 namespace Messaging {
33 namespace Api {
34 class IAttachment;
35 typedef DPL::SharedPtr<IAttachment> IAttachmentPtr;
36
37 //--------------------------------------------------------------------------
38
39 class IAttachment
40 {
41   protected: // fields
42
43     /**
44      * value of attachment full path name
45      */
46     std::string m_attachFullPath;
47
48     /**
49      * value of attachment short name used to display in message
50      */
51     std::string m_attachShortName;
52
53     /**
54      * value of attachment file size
55      */
56     unsigned int m_fileSize;
57
58     /**
59      * value of attachment mime type
60      */
61     std::string m_mimeType;
62
63     /**
64      * information if abstract message attachment has been changed and need
65      * update in low level
66      * only name may be changed, not path
67      */
68     bool m_validAttachment;
69
70     bool m_isCreatedProperly;
71
72   public: // methods
73
74     explicit IAttachment();
75
76     void init(const std::string& fullPath,
77             bool isVirtualPath);
78
79     virtual ~IAttachment();
80
81     /**
82      * getter of attachment name (only name without path) value
83      */
84     std::string getShortName() const;
85
86     /**
87      * getter of attachment name (full path) value
88      */
89     std::string getFullPath() const;
90
91     /**
92      * getter of attachment size
93      */
94     unsigned int getFileSize() const;
95
96     /**
97      * getter of attachment mime type
98      */
99     std::string getMimeType() const;
100
101     /**
102      * setter of attachment mime type
103      */
104     void setMimeType(const std::string &mimeType);
105
106     /**
107      * getter of attachment valid
108      */
109     bool getIsCreatedProperly() const;
110
111     /**
112      * rename short name value of attachment
113      */
114     void rename(const std::string& newName);
115
116   private:
117
118     void makeShortName();
119
120     virtual std::string getRealPath(const std::string &path) const = 0;
121 };
122 }
123 }
124 }
125 #endif