LibreOffice Module ucb (master)  1
ftpdirp.hxx
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 /**************************************************************************
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 <rtl/ustring.hxx>
29 #include <com/sun/star/util/DateTime.hpp>
30 
31 
32 namespace ftp {
33 
34  /*========================================================================
35  *
36  * the DateTime structure
37  *
38  *======================================================================*/
39 
40  struct DateTime
41  : public css::util::DateTime
42  {
43  DateTime() : css::util::DateTime(0, 0, 0, 0, 0, 0, 0, false) { }
44 
45  void SetYear(sal_uInt16 year) { Year = year; }
46  void SetMonth(sal_uInt16 month) { Month = month; }
47  void SetDay(sal_uInt16 day) { Day = day; }
48  // Only zero allowed and used for time-argument
49  void SetTime() { Hours = 0; Minutes = 0; Seconds = 0; NanoSeconds = 0; }
50  void SetHour(sal_uInt16 hours) { Hours = hours; }
51  void SetMin(sal_uInt16 minutes) { Minutes = minutes; }
52  void SetSec(sal_uInt16 seconds) { Seconds = seconds; }
53  void SetNanoSec(sal_uInt32 nanoSec) { NanoSeconds = nanoSec; }
54 
55  sal_uInt16 GetMonth() const { return Month; }
56  };
57 
58 
59 /*========================================================================
60  *
61  * the directory information structure
62  *
63  *======================================================================*/
64 
70 
71  struct FTPDirentry
72  {
73  OUString m_aURL;
74  OUString m_aName;
76  sal_uInt32 m_nMode;
77  sal_uInt32 m_nSize;
78 
80  : m_aDate(),
82  m_nSize(sal_uInt32(-1)) { }
83 
84  void clear() {
85  m_aURL.clear();
86  m_aName.clear();
87  m_aDate = DateTime();
89  m_nSize = sal_uInt32(-1);
90  }
91  };
92 
93 
94 /*========================================================================
95  *
96  * the directory parser
97  *
98  *======================================================================*/
99 
100 
102  {
103  public:
104  static bool parseDOS (
105  FTPDirentry &rEntry,
106  const sal_Char *pBuffer );
107 
108  static bool parseVMS (
109  FTPDirentry &rEntry,
110  const sal_Char *pBuffer );
111 
112  static bool parseUNIX (
113  FTPDirentry &rEntry,
114  const sal_Char *pBuffer );
115 
116 
117  private:
118 
119  static bool parseUNIX_isSizeField (
120  const sal_Char *pStart,
121  const sal_Char *pEnd,
122  sal_uInt32 &rSize);
123 
124  static bool parseUNIX_isMonthField (
125  const sal_Char *pStart,
126  const sal_Char *pEnd,
127  DateTime& rDateTime);
128 
129  static bool parseUNIX_isDayField (
130  const sal_Char *pStart,
131  const sal_Char *pEnd,
132  DateTime& rDateTime);
133 
134  static bool parseUNIX_isYearTimeField (
135  const sal_Char *pStart,
136  const sal_Char *pEnd,
137  DateTime& rDateTime);
138 
139  static bool parseUNIX_isTime (
140  const sal_Char *pStart,
141  const sal_Char *pEnd,
142  sal_uInt16 nHour,
143  DateTime& rDateTime);
144 
145  static void setYear (
146  DateTime& rDateTime,
147  sal_uInt16 nYear);
148 
149  static bool setPath (
150  OUString& rPath,
151  const sal_Char *value,
152  sal_Int32 length = -1);
153  };
154 
155 
156 }
157 
158 
159 #endif
160 
161 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static bool parseUNIX_isTime(const sal_Char *pStart, const sal_Char *pEnd, sal_uInt16 nHour, DateTime &rDateTime)
Definition: ftpdirp.cxx:1177
void SetNanoSec(sal_uInt32 nanoSec)
Definition: ftpdirp.hxx:53
void SetSec(sal_uInt16 seconds)
Definition: ftpdirp.hxx:52
static bool parseUNIX_isDayField(const sal_Char *pStart, const sal_Char *pEnd, DateTime &rDateTime)
Definition: ftpdirp.cxx:1103
static bool parseUNIX_isMonthField(const sal_Char *pStart, const sal_Char *pEnd, DateTime &rDateTime)
Definition: ftpdirp.cxx:1005
static bool parseUNIX_isYearTimeField(const sal_Char *pStart, const sal_Char *pEnd, DateTime &rDateTime)
Definition: ftpdirp.cxx:1130
static bool parseUNIX_isSizeField(const sal_Char *pStart, const sal_Char *pEnd, sal_uInt32 &rSize)
Definition: ftpdirp.cxx:952
static bool parseUNIX(FTPDirentry &rEntry, const sal_Char *pBuffer)
Definition: ftpdirp.cxx:843
char sal_Char
length
sal_uInt32 m_nMode
Definition: ftpdirp.hxx:76
void SetMin(sal_uInt16 minutes)
Definition: ftpdirp.hxx:51
sal_uInt16 GetMonth() const
Definition: ftpdirp.hxx:55
static bool parseDOS(FTPDirentry &rEntry, const sal_Char *pBuffer)
Definition: ftpdirp.cxx:59
Definition of ftpcontentprovider.
void SetDay(sal_uInt16 day)
Definition: ftpdirp.hxx:47
OUString m_aURL
Definition: ftpdirp.hxx:73
void SetYear(sal_uInt16 year)
Definition: ftpdirp.hxx:45
static bool setPath(OUString &rPath, const sal_Char *value, sal_Int32 length=-1)
Definition: ftpdirp.cxx:1257
void SetHour(sal_uInt16 hours)
Definition: ftpdirp.hxx:50
DateTime m_aDate
Definition: ftpdirp.hxx:75
Any value
sal_uInt32 m_nSize
Definition: ftpdirp.hxx:77
FTPDirentryMode
Definition: ftpdirp.hxx:65
void SetMonth(sal_uInt16 month)
Definition: ftpdirp.hxx:46
static void setYear(DateTime &rDateTime, sal_uInt16 nYear)
Definition: ftpdirp.cxx:1222
void SetTime()
Definition: ftpdirp.hxx:49
OUString m_aName
Definition: ftpdirp.hxx:74
static bool parseVMS(FTPDirentry &rEntry, const sal_Char *pBuffer)
Definition: ftpdirp.cxx:556