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 <com/sun/star/ucb/XCommandEnvironment.hpp>
25 #include <com/sun/star/ucb/XCommandProcessor.hpp>
26 #include <com/sun/star/sdbc/XRow.hpp>
27 #include "ftpresultsetI.hxx"
28 #include "ftpcontent.hxx"
29 
30 
31 using namespace std;
32 using namespace ftp;
33 using namespace com::sun::star::ucb;
34 using namespace com::sun::star::lang;
35 using namespace com::sun::star::uno;
36 using namespace com::sun::star::beans;
37 using namespace com::sun::star::sdbc;
38 
39 
40 ResultSetI::ResultSetI(const Reference<XComponentContext>& rxContext,
41  const Reference<XContentProvider>& xProvider,
42  const Sequence<Property>& seqProp,
43  const std::vector<FTPDirentry>& dirvec)
44  : ResultSetBase(rxContext,xProvider,seqProp)
45 {
46  for(const auto & i : dirvec)
47  m_aPath.push_back(i.m_aURL);
48 
49  // m_aIdents holds the content identifiers
50 
51  m_aItems.resize( m_aPath.size() );
52  m_aIdents.resize( m_aPath.size() );
53 
54  for(size_t n = 0; n < m_aItems.size(); ++n) {
56  new ucbhelper::PropertyValueSet(rxContext);
57 
58  for( const auto& rProp : seqProp) {
59  const OUString& Name = rProp.Name;
60  if(Name == "ContentType")
61  xRow->appendString(rProp,
62  OUString( "application/ftp" ));
63  else if(Name == "Title")
64  xRow->appendString(rProp,dirvec[n].m_aName);
65  else if(Name == "IsReadOnly")
66  xRow->appendBoolean(rProp,
67  (dirvec[n].m_nMode &
68  INETCOREFTP_FILEMODE_WRITE) == INETCOREFTP_FILEMODE_WRITE);
69  else if(Name == "IsDocument")
70  xRow->appendBoolean(rProp,
71  (dirvec[n].m_nMode &
72  INETCOREFTP_FILEMODE_ISDIR) != INETCOREFTP_FILEMODE_ISDIR);
73  else if(Name == "IsFolder")
74  xRow->appendBoolean(rProp,
75  ( dirvec[n].m_nMode &
76  INETCOREFTP_FILEMODE_ISDIR) == INETCOREFTP_FILEMODE_ISDIR);
77  else if(Name == "Size")
78  xRow->appendLong(rProp,
79  dirvec[n].m_nSize);
80  else if(Name == "DateCreated")
81  xRow->appendTimestamp(rProp,
82  dirvec[n].m_aDate);
83  else if(Name == "CreatableContentsInfo")
84  xRow->appendObject(
85  rProp,
87  else
88  xRow->appendVoid(rProp);
89  }
90  m_aItems[n].set(xRow.get());
91  }
92 }
93 
94 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::vector< OUString > m_aPath
OUString Name
int i
Definition of ftpcontentprovider.
static css::uno::Sequence< css::ucb::ContentInfo > queryCreatableContentsInfo_Static()
Definition: ftpcontent.cxx:571
css::uno::Any SAL_CALL makeAny(const SharedUNOComponent< INTERFACE, COMPONENT > &value)