1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef _UPDATE_INFO_INCLUDED_ 25 #define _UPDATE_INFO_INCLUDED_ 26 27 #include <rtl/ustring.hxx> 28 #include <vector> 29 30 struct DownloadSource 31 { 32 bool IsDirect; 33 rtl::OUString URL; 34 35 DownloadSource(bool bIsDirect, const rtl::OUString& aURL) : IsDirect(bIsDirect), URL(aURL) {}; 36 DownloadSource(const DownloadSource& ds) : IsDirect(ds.IsDirect), URL(ds.URL) {}; 37 38 DownloadSource & operator=( const DownloadSource & ds ) { IsDirect = ds.IsDirect; URL = ds.URL; return *this; }; 39 }; 40 41 struct ReleaseNote 42 { 43 sal_uInt8 Pos; 44 rtl::OUString URL; 45 sal_uInt8 Pos2; 46 rtl::OUString URL2; 47 48 ReleaseNote(sal_uInt8 pos, const rtl::OUString aURL) : Pos(pos), URL(aURL), Pos2(0), URL2() {}; 49 ReleaseNote(sal_uInt8 pos, const rtl::OUString aURL, sal_uInt8 pos2, const rtl::OUString aURL2) : Pos(pos), URL(aURL), Pos2(pos2), URL2(aURL2) {}; 50 51 ReleaseNote(const ReleaseNote& rn) :Pos(rn.Pos), URL(rn.URL), Pos2(rn.Pos2), URL2(rn.URL2) {}; 52 ReleaseNote & operator=( const ReleaseNote& rn) { Pos=rn.Pos; URL=rn.URL; Pos2=rn.Pos2; URL2=rn.URL2; return *this; }; 53 }; 54 55 struct UpdateInfo 56 { 57 rtl::OUString BuildId; 58 rtl::OUString Version; 59 rtl::OUString Description; 60 std::vector< DownloadSource > Sources; 61 std::vector< ReleaseNote > ReleaseNotes; 62 63 UpdateInfo() : BuildId(), Version(), Description(), Sources(), ReleaseNotes() {}; 64 UpdateInfo(const UpdateInfo& ui) : BuildId(ui.BuildId), Version(ui.Version), Description(ui.Description), Sources(ui.Sources), ReleaseNotes(ui.ReleaseNotes) {}; 65 inline UpdateInfo & operator=( const UpdateInfo& ui ); 66 }; 67 68 UpdateInfo & UpdateInfo::operator=( const UpdateInfo& ui ) 69 { 70 BuildId = ui.BuildId; 71 Version = ui.Version; 72 Description = ui.Description; 73 Sources = ui.Sources; 74 ReleaseNotes = ui.ReleaseNotes; 75 return *this; 76 } 77 78 79 // Returns the URL of the release note for the given position 80 rtl::OUString getReleaseNote(const UpdateInfo& rInfo, sal_uInt8 pos, bool autoDownloadEnabled=false); 81 82 #endif 83