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