Branch data Line data Source code
1 : : /* libcmis
2 : : * Version: MPL 1.1 / GPLv2+ / LGPLv2+
3 : : *
4 : : * The contents of this file are subject to the Mozilla Public License Version
5 : : * 1.1 (the "License"); you may not use this file except in compliance with
6 : : * the License or as specified alternatively below. You may obtain a copy of
7 : : * the License at http://www.mozilla.org/MPL/
8 : : *
9 : : * Software distributed under the License is distributed on an "AS IS" basis,
10 : : * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11 : : * for the specific language governing rights and limitations under the
12 : : * License.
13 : : *
14 : : * Major Contributor(s):
15 : : * Copyright (C) 2011 SUSE <cbosdonnat@suse.com>
16 : : *
17 : : *
18 : : * All Rights Reserved.
19 : : *
20 : : * For minor contributions see the git repository.
21 : : *
22 : : * Alternatively, the contents of this file may be used under the terms of
23 : : * either the GNU General Public License Version 2 or later (the "GPLv2+"), or
24 : : * the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
25 : : * in which case the provisions of the GPLv2+ or the LGPLv2+ are applicable
26 : : * instead of those above.
27 : : */
28 : : #ifndef _DOCUMENT_HXX_
29 : : #define _DOCUMENT_HXX_
30 : :
31 : : #include <iostream>
32 : : #include <string>
33 : : #include <vector>
34 : :
35 : : #include <boost/shared_ptr.hpp>
36 : :
37 : : #include "exception.hxx"
38 : : #include "object.hxx"
39 : :
40 : : namespace libcmis
41 : : {
42 : : class Folder;
43 : :
44 : : /** Interface for a CMIS Document object.
45 : : */
46 : : class Document : public virtual Object
47 : : {
48 : : public:
49 : :
50 : 0 : virtual ~Document( ) { }
51 : :
52 : : /** Get the folder parents for the document.
53 : :
54 : : Note that an unfiled document will have no parent folder.
55 : :
56 : : @return the parents folder if any.
57 : : */
58 : : virtual std::vector< boost::shared_ptr< Folder > > getParents( ) throw ( Exception ) = 0;
59 : :
60 : : /** Get the content stream without using a temporary file.
61 : :
62 : : <p>The stream may not contain anything if there is
63 : : no content or if something wrong happened during the
64 : : download.</p>
65 : :
66 : : @return
67 : : An input stream to read the data from.
68 : :
69 : : @throws Exception
70 : : if anything wrong happened during the file transfer.
71 : : In such a case, the content of the stream can't be
72 : : guaranteed.
73 : : */
74 : : virtual boost::shared_ptr< std::istream > getContentStream( ) throw ( Exception ) = 0;
75 : :
76 : : /** Set or replace the content stream of the document.
77 : :
78 : : @param is the output stream containing the new data for the content stream
79 : : @param contentType the mime-type of the new content stream
80 : : @param overwrite if set to false, don't overwrite the content stream if one is already set.
81 : :
82 : : @throw Exception if anything happens during the upload like a wrong authentication,
83 : : no rights to set the stream, server doesn't have the ContentStreamUpdatability
84 : : capability.
85 : : */
86 : : virtual void setContentStream( boost::shared_ptr< std::ostream > os, std::string contentType,
87 : : bool overwrite = true ) throw ( Exception ) = 0;
88 : :
89 : : /** Get the content mime type.
90 : : */
91 : : virtual std::string getContentType( ) = 0;
92 : :
93 : : /** Get the content stream filename.
94 : : */
95 : : virtual std::string getContentFilename( ) = 0;
96 : :
97 : : /** Get the content length in bytes.
98 : : */
99 : : virtual long getContentLength( ) = 0;
100 : : };
101 : : typedef ::boost::shared_ptr< Document > DocumentPtr;
102 : : }
103 : :
104 : : #endif
|