2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 * @author Pawel Misiak (p.misiak@samsung.com)
27 #include <dpl/shared_ptr.h>
28 #include "IMessagingTypes.h"
29 #include "IAttachment.h"
31 namespace WrtDeviceApis {
34 //--------------------------------------------------------------------------
38 std::vector<IAttachmentPtr> m_attachments;
44 bool m_validAttachments;
50 virtual ~Attachments();
53 * method for append attachment into list
54 * @param[in] fullPath - path for attachment
55 * @return AttachmentPtr - if file exist create attachment object
56 * it is possible to modify name, etc.
57 * @throw InvalidArgumentException - if file not exist
59 IAttachmentPtr appendAttachment(const std::string& fullPath,
63 * method for append attachment into list
64 * @param[in] attachment - attachment to be added
66 void appendAttachment(const IAttachmentPtr& attachment);
69 * method for append attachments list
70 * @param[in] attachments - attachment list
72 void appendAttachments(const std::vector<IAttachmentPtr>& attachments);
75 * get attachment count
76 * @return attachment count
78 size_t getAttachmentsCount() const;
81 * get attachment object at index
82 * @param[in] index - index of attachment to get
83 * @return attachment object
84 * @throw OutOfRangeException if index is out of range
86 IAttachmentPtr getAttachment(const size_t index) const;
89 * remove attachment at the index
90 * @param[in] index - index of attachment to get
92 * @throw OutOfRangeException if index is out of range
94 void removeAttachment(const size_t index);
97 * remove attachment at the index
98 * @param[in] attachment - AttachmentPtr object
100 * @throw OutOfRangeException if index is out of range
102 void removeAttachment(const IAttachmentPtr& attachment);
105 * get all attachments vector
106 * @return attachment vector
108 std::vector<IAttachmentPtr> getAttachments() const;
111 * get all attachments full path vector
112 * @return attachment path vector
114 std::vector<std::string> getAttachmentsFullPaths() const;
117 * get all attachments names vector
118 * @return attachment names vector
120 std::vector<std::string> getAttachmentsShortNames() const;
123 * get all attachments vector reference
124 * @return attachment vector
126 const std::vector<IAttachmentPtr>& getAttachmentsRef() const;
130 * @param[in] attachments - vector of and attachments full path
131 * @throw InvalidArgumentException - if file not exist
133 void setAttachments(const std::vector<std::string>& attachments,
138 * @param[in] attachments - vector of AttachmentPtr
140 void setAttachments(const std::vector<IAttachmentPtr>& attachments);
143 * check if attachments are modified and need update in platform
146 bool isAttachmentsValid() const;
149 * setting validity after update
150 * @param[in] state - state for validity to set
152 void setAttachmentsValidity(bool state);
155 * saving attachment file to selected destination file
156 * @param[in] destFileName - destination file to save attachment
157 * @param[in] attachment - attachment to be saved
159 void saveAttachment(const std::string& destFileName,
160 const IAttachmentPtr& attachment);
163 * sets attachment at given position and expands array if needed
164 * @param[in] index - position
165 * @param[in] fullPath - path for attachment
166 * @throw InvalidArgumentException - if file not exist
168 void setAttachmentWithExpand(const size_t index,
169 const std::string& fullPath,
173 * The reverse() method reverses the order of the elements in an array
174 * (makes the last element first, and the first element last).
179 * Creates new attachment and inserts it at given position
180 * @param[in] index position
181 * @param[in] fullPath - path for attachment
182 * @param[in] isVirtualPath - true if path is virtual
183 * @throw InvalidArgumentException - if file not exist
185 void insertAttachment(const size_t index,
186 const std::string& fullPath,
190 * Creates new attachment and inserts it at given position and expands array if needed
191 * @param[in] index position
192 * @param[in] fullPath - path for attachment
193 * @param[in] isVirtualPath - true if path is virtual
194 * @throw InvalidArgumentException - if file not exist
196 void insertAttachmentWithExpand(const size_t index,
197 const std::string& fullPath,
201 typedef DPL::SharedPtr<Attachments> AttachmentsPtr;