LCOV - code coverage report
Current view: top level - ucb/source/ucp/ftp - ftpdirp.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 0 20 0.0 %
Date: 2014-11-03 Functions: 0 15 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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             : /**************************************************************************
      21             :                                 TODO
      22             :  **************************************************************************
      23             : 
      24             :  *************************************************************************/
      25             : #ifndef INCLUDED_UCB_SOURCE_UCP_FTP_FTPDIRP_HXX
      26             : #define INCLUDED_UCB_SOURCE_UCP_FTP_FTPDIRP_HXX
      27             : 
      28             : #include <osl/time.h>
      29             : #include <rtl/ustring.hxx>
      30             : #include <com/sun/star/util/DateTime.hpp>
      31             : 
      32             : 
      33             : namespace ftp {
      34             : 
      35             :     /*========================================================================
      36             :      *
      37             :      * the DateTime structure
      38             :      *
      39             :      *======================================================================*/
      40             : 
      41             :     struct DateTime
      42             :         : public com::sun::star::util::DateTime
      43             :     {
      44           0 :         DateTime(const sal_uInt32& nanoSeconds,
      45             :                  const sal_uInt16& seconds,
      46             :                  const sal_uInt16& minutes,
      47             :                  const sal_uInt16& hours,
      48             :                  const sal_uInt16& day,
      49             :                  const sal_uInt16& month,
      50             :                  const sal_uInt16& year)
      51             :                      : com::sun::star::util::DateTime(nanoSeconds,
      52             :                                                       seconds,
      53             :                                                       minutes,
      54             :                                                       hours,
      55             :                                                       day,
      56             :                                                       month,
      57             :                                                       year,
      58           0 :                                                       false) { }
      59             : 
      60           0 :         void SetYear(sal_uInt16 year) { Year = year; }
      61           0 :         void SetMonth(sal_uInt16 month) { Month = month; }
      62           0 :         void SetDay(sal_uInt16 day) { Day = day; }
      63             :         // Only zero allowed and used for time-argument
      64           0 :         void SetTime(sal_uInt16) { Hours = Minutes = Seconds = NanoSeconds = 0; }
      65           0 :         void SetHour(sal_uInt16 hours) { Hours = hours; }
      66           0 :         void SetMin(sal_uInt16 minutes) { Minutes = minutes; }
      67           0 :         void SetSec(sal_uInt16 seconds) { Seconds = seconds; }
      68           0 :         void SetNanoSec(sal_uInt32 nanoSec) { NanoSeconds = nanoSec; }
      69             : 
      70           0 :         sal_uInt16 GetMonth(void) { return Month; }
      71             :     };
      72             : 
      73             : 
      74             : 
      75             : /*========================================================================
      76             :  *
      77             :  * the directory information structure
      78             :  *
      79             :  *======================================================================*/
      80             : 
      81             :     enum FTPDirentryMode { INETCOREFTP_FILEMODE_UNKNOWN = 0x00,
      82             :                            INETCOREFTP_FILEMODE_READ = 0x01,
      83             :                            INETCOREFTP_FILEMODE_WRITE = 0x02,
      84             :                            INETCOREFTP_FILEMODE_ISDIR = 0x04,
      85             :                            INETCOREFTP_FILEMODE_ISLINK = 0x08 };
      86             : 
      87           0 :     struct FTPDirentry
      88             :     {
      89             :         OUString                       m_aURL;
      90             :         OUString                       m_aName;
      91             :         DateTime                            m_aDate;
      92             :         sal_uInt32                          m_nMode;
      93             :         sal_uInt32                          m_nSize;
      94             : 
      95           0 :         FTPDirentry(void)
      96             :             : m_aDate(0,0,0,0,0,0,0),
      97             :               m_nMode(INETCOREFTP_FILEMODE_UNKNOWN),
      98           0 :               m_nSize((sal_uInt32)(-1)) { }
      99             : 
     100           0 :         void clear() {
     101           0 :             m_aURL = m_aName = OUString();
     102           0 :             m_aDate = DateTime(0,0,0,0,0,0,0);
     103           0 :             m_nMode = INETCOREFTP_FILEMODE_UNKNOWN;
     104           0 :             m_nSize = sal_uInt32(-1);
     105           0 :         }
     106             : 
     107             :         bool isDir() const {
     108             :             return (m_nMode & INETCOREFTP_FILEMODE_ISDIR) != 0;
     109             :         }
     110             : 
     111             :         bool isFile() const {
     112             :             return (m_nMode & INETCOREFTP_FILEMODE_ISDIR) == 0;
     113             :         }
     114             :     };
     115             : 
     116             : 
     117             : /*========================================================================
     118             :  *
     119             :  * the directory parser
     120             :  *
     121             :  *======================================================================*/
     122             : 
     123             : 
     124             :     class FTPDirectoryParser
     125             :     {
     126             :     public:
     127             :         static bool parseDOS (
     128             :             FTPDirentry &rEntry,
     129             :             const sal_Char  *pBuffer );
     130             : 
     131             :         static bool parseVMS (
     132             :             FTPDirentry &rEntry,
     133             :             const sal_Char  *pBuffer );
     134             : 
     135             :         static bool parseUNIX (
     136             :             FTPDirentry &rEntry,
     137             :             const sal_Char  *pBuffer );
     138             : 
     139             : 
     140             :     private:
     141             : 
     142             :         static bool parseUNIX_isSizeField (
     143             :             const sal_Char *pStart,
     144             :             const sal_Char *pEnd,
     145             :             sal_uInt32     &rSize);
     146             : 
     147             :         static bool parseUNIX_isMonthField (
     148             :             const sal_Char *pStart,
     149             :             const sal_Char *pEnd,
     150             :             DateTime& rDateTime);
     151             : 
     152             :         static bool parseUNIX_isDayField (
     153             :             const sal_Char *pStart,
     154             :             const sal_Char *pEnd,
     155             :             DateTime& rDateTime);
     156             : 
     157             :         static bool parseUNIX_isYearTimeField (
     158             :             const sal_Char *pStart,
     159             :             const sal_Char *pEnd,
     160             :             DateTime& rDateTime);
     161             : 
     162             :         static bool parseUNIX_isTime (
     163             :             const sal_Char *pStart,
     164             :             const sal_Char *pEnd,
     165             :             sal_uInt16      nHour,
     166             :             DateTime& rDateTime);
     167             : 
     168             :         static bool setYear (
     169             :             DateTime& rDateTime,
     170             :             sal_uInt16  nYear);
     171             : 
     172             :         static bool setPath (
     173             :             OUString& rPath,
     174             :             const sal_Char *value,
     175             :             sal_Int32       length = -1);
     176             :     };
     177             : 
     178             : 
     179             : }
     180             : 
     181             : 
     182             : #endif
     183             : 
     184             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10