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