1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef _UPDATE_INFO_INCLUDED_
29 #define _UPDATE_INFO_INCLUDED_
30 
31 #include <rtl/ustring.hxx>
32 #include <vector>
33 
34 struct DownloadSource
35 {
36     bool IsDirect;
37     rtl::OUString URL;
38 
39     DownloadSource(bool bIsDirect, const rtl::OUString& aURL) : IsDirect(bIsDirect), URL(aURL) {};
40     DownloadSource(const DownloadSource& ds) : IsDirect(ds.IsDirect), URL(ds.URL) {};
41 
42     DownloadSource & operator=( const DownloadSource & ds ) { IsDirect = ds.IsDirect; URL = ds.URL; return *this; };
43 };
44 
45 struct ReleaseNote
46 {
47     sal_uInt8 Pos;
48     rtl::OUString URL;
49     sal_uInt8 Pos2;
50     rtl::OUString URL2;
51 
52     ReleaseNote(sal_uInt8 pos, const rtl::OUString aURL) : Pos(pos), URL(aURL), Pos2(0), URL2() {};
53     ReleaseNote(sal_uInt8 pos, const rtl::OUString aURL, sal_uInt8 pos2, const rtl::OUString aURL2) : Pos(pos), URL(aURL), Pos2(pos2), URL2(aURL2) {};
54 
55     ReleaseNote(const ReleaseNote& rn) :Pos(rn.Pos), URL(rn.URL), Pos2(rn.Pos2), URL2(rn.URL2) {};
56     ReleaseNote & operator=( const ReleaseNote& rn) { Pos=rn.Pos; URL=rn.URL; Pos2=rn.Pos2; URL2=rn.URL2; return *this; };
57 };
58 
59 struct UpdateInfo
60 {
61     rtl::OUString BuildId;
62     rtl::OUString Version;
63     rtl::OUString Description;
64     std::vector< DownloadSource > Sources;
65     std::vector< ReleaseNote > ReleaseNotes;
66 
67     UpdateInfo() : BuildId(), Version(), Description(), Sources(), ReleaseNotes() {};
68     UpdateInfo(const UpdateInfo& ui) : BuildId(ui.BuildId), Version(ui.Version), Description(ui.Description), Sources(ui.Sources), ReleaseNotes(ui.ReleaseNotes) {};
69     inline UpdateInfo & operator=( const UpdateInfo& ui );
70 };
71 
72 UpdateInfo & UpdateInfo::operator=( const UpdateInfo& ui )
73 {
74     BuildId = ui.BuildId;
75     Version = ui.Version;
76     Description = ui.Description;
77     Sources = ui.Sources;
78     ReleaseNotes = ui.ReleaseNotes;
79     return *this;
80 }
81 
82 
83 // Returns the URL of the release note for the given position
84 rtl::OUString getReleaseNote(const UpdateInfo& rInfo, sal_uInt8 pos, bool autoDownloadEnabled=false);
85 
86 #endif
87