bump product version to 7.2.5.1
[LibreOffice.git] / ucb / source / ucp / ftp / ftpdirp.hxx
blobae9f36a473034ff170febf0981d841b08aaf5f84
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 /**************************************************************************
21 TODO
22 **************************************************************************
24 *************************************************************************/
25 #pragma once
27 #include <rtl/ustring.hxx>
28 #include <com/sun/star/util/DateTime.hpp>
31 namespace ftp {
33 /*========================================================================
35 * the DateTime structure
37 *======================================================================*/
39 struct DateTime
40 : public css::util::DateTime
42 DateTime() : css::util::DateTime(0, 0, 0, 0, 0, 0, 0, false) { }
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; }
54 sal_uInt16 GetMonth() const { return Month; }
58 /*========================================================================
60 * the directory information structure
62 *======================================================================*/
64 enum FTPDirentryMode { INETCOREFTP_FILEMODE_UNKNOWN = 0x00,
65 INETCOREFTP_FILEMODE_READ = 0x01,
66 INETCOREFTP_FILEMODE_WRITE = 0x02,
67 INETCOREFTP_FILEMODE_ISDIR = 0x04,
68 INETCOREFTP_FILEMODE_ISLINK = 0x08 };
70 struct FTPDirentry
72 OUString m_aURL;
73 OUString m_aName;
74 DateTime m_aDate;
75 sal_uInt32 m_nMode;
76 sal_uInt32 m_nSize;
78 FTPDirentry()
79 : m_aDate(),
80 m_nMode(INETCOREFTP_FILEMODE_UNKNOWN),
81 m_nSize(sal_uInt32(-1)) { }
83 void clear() {
84 m_aURL.clear();
85 m_aName.clear();
86 m_aDate = DateTime();
87 m_nMode = INETCOREFTP_FILEMODE_UNKNOWN;
88 m_nSize = sal_uInt32(-1);
93 /*========================================================================
95 * the directory parser
97 *======================================================================*/
100 class FTPDirectoryParser
102 public:
103 static bool parseDOS (
104 FTPDirentry &rEntry,
105 const char *pBuffer );
107 static bool parseVMS (
108 FTPDirentry &rEntry,
109 const char *pBuffer );
111 static bool parseUNIX (
112 FTPDirentry &rEntry,
113 const char *pBuffer );
116 private:
118 static bool parseUNIX_isSizeField (
119 const char *pStart,
120 const char *pEnd,
121 sal_uInt32 &rSize);
123 static bool parseUNIX_isMonthField (
124 const char *pStart,
125 const char *pEnd,
126 DateTime& rDateTime);
128 static bool parseUNIX_isDayField (
129 const char *pStart,
130 const char *pEnd,
131 DateTime& rDateTime);
133 static bool parseUNIX_isYearTimeField (
134 const char *pStart,
135 const char *pEnd,
136 DateTime& rDateTime);
138 static bool parseUNIX_isTime (
139 const char *pStart,
140 const char *pEnd,
141 sal_uInt16 nHour,
142 DateTime& rDateTime);
144 static void setYear (
145 DateTime& rDateTime,
146 sal_uInt16 nYear);
148 static bool setPath (
149 OUString& rPath,
150 const char *value,
151 sal_Int32 length = -1);
158 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */