LibreOffice Module ucb (master)  1
ftpresultsetI.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 
22 #include <rtl/ref.hxx>
23 #include <com/sun/star/ucb/Command.hpp>
24 #include "ftpresultsetI.hxx"
25 #include "ftpcontent.hxx"
26 
27 
28 using namespace std;
29 using namespace ftp;
30 using namespace com::sun::star::ucb;
31 using namespace com::sun::star::lang;
32 using namespace com::sun::star::uno;
33 using namespace com::sun::star::beans;
34 using namespace com::sun::star::sdbc;
35 
36 
37 ResultSetI::ResultSetI(const Reference<XComponentContext>& rxContext,
38  const Reference<XContentProvider>& xProvider,
39  const Sequence<Property>& seqProp,
40  const std::vector<FTPDirentry>& dirvec)
41  : ResultSetBase(rxContext,xProvider,seqProp)
42 {
43  for(const auto & i : dirvec)
44  m_aPath.push_back(i.m_aURL);
45 
46  // m_aIdents holds the content identifiers
47 
48  m_aItems.resize( m_aPath.size() );
49  m_aIdents.resize( m_aPath.size() );
50 
51  for(size_t n = 0; n < m_aItems.size(); ++n) {
53  new ucbhelper::PropertyValueSet(rxContext);
54 
55  for( const auto& rProp : seqProp) {
56  const OUString& Name = rProp.Name;
57  if(Name == "ContentType")
58  xRow->appendString(rProp,
59  OUString( "application/ftp" ));
60  else if(Name == "Title")
61  xRow->appendString(rProp,dirvec[n].m_aName);
62  else if(Name == "IsReadOnly")
63  xRow->appendBoolean(rProp,
64  (dirvec[n].m_nMode &
65  INETCOREFTP_FILEMODE_WRITE) == INETCOREFTP_FILEMODE_WRITE);
66  else if(Name == "IsDocument")
67  xRow->appendBoolean(rProp,
68  (dirvec[n].m_nMode &
69  INETCOREFTP_FILEMODE_ISDIR) != INETCOREFTP_FILEMODE_ISDIR);
70  else if(Name == "IsFolder")
71  xRow->appendBoolean(rProp,
72  ( dirvec[n].m_nMode &
73  INETCOREFTP_FILEMODE_ISDIR) == INETCOREFTP_FILEMODE_ISDIR);
74  else if(Name == "Size")
75  xRow->appendLong(rProp,
76  dirvec[n].m_nSize);
77  else if(Name == "DateCreated")
78  xRow->appendTimestamp(rProp,
79  dirvec[n].m_aDate);
80  else if(Name == "CreatableContentsInfo")
81  xRow->appendObject(
82  rProp,
84  else
85  xRow->appendVoid(rProp);
86  }
87  m_aItems[n].set(xRow.get());
88  }
89 }
90 
91 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
OUString const m_aName
Definition: pkgprovider.cxx:57
sal_Int64 n
std::vector< OUString > m_aPath
OUString Name
Reference< XRow > xRow
int i
Definition of ftpcontentprovider.
static css::uno::Sequence< css::ucb::ContentInfo > queryCreatableContentsInfo_Static()
Definition: ftpcontent.cxx:572
sal_uInt32 m_nSize
css::uno::Any SAL_CALL makeAny(const SharedUNOComponent< INTERFACE, COMPONENT > &value)