|
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
|
2 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
5 |
|
6 #include "nsDirIndex.h" |
|
7 #include "nsISupportsObsolete.h" |
|
8 |
|
9 NS_IMPL_ISUPPORTS(nsDirIndex, |
|
10 nsIDirIndex) |
|
11 |
|
12 nsDirIndex::nsDirIndex() : mType(TYPE_UNKNOWN), |
|
13 mSize(UINT64_MAX), |
|
14 mLastModified(-1) { |
|
15 } |
|
16 |
|
17 nsDirIndex::~nsDirIndex() {} |
|
18 |
|
19 NS_IMPL_GETSET(nsDirIndex, Type, uint32_t, mType) |
|
20 |
|
21 // GETSET macros for modern strings would be nice... |
|
22 |
|
23 NS_IMETHODIMP |
|
24 nsDirIndex::GetContentType(char* *aContentType) { |
|
25 *aContentType = ToNewCString(mContentType); |
|
26 if (!*aContentType) |
|
27 return NS_ERROR_OUT_OF_MEMORY; |
|
28 |
|
29 return NS_OK; |
|
30 } |
|
31 |
|
32 NS_IMETHODIMP |
|
33 nsDirIndex::SetContentType(const char* aContentType) { |
|
34 mContentType = aContentType; |
|
35 return NS_OK; |
|
36 } |
|
37 |
|
38 NS_IMETHODIMP |
|
39 nsDirIndex::GetLocation(char* *aLocation) { |
|
40 *aLocation = ToNewCString(mLocation); |
|
41 if (!*aLocation) |
|
42 return NS_ERROR_OUT_OF_MEMORY; |
|
43 |
|
44 return NS_OK; |
|
45 } |
|
46 |
|
47 NS_IMETHODIMP |
|
48 nsDirIndex::SetLocation(const char* aLocation) { |
|
49 mLocation = aLocation; |
|
50 return NS_OK; |
|
51 } |
|
52 |
|
53 NS_IMETHODIMP |
|
54 nsDirIndex::GetDescription(char16_t* *aDescription) { |
|
55 *aDescription = ToNewUnicode(mDescription); |
|
56 if (!*aDescription) |
|
57 return NS_ERROR_OUT_OF_MEMORY; |
|
58 |
|
59 return NS_OK; |
|
60 } |
|
61 |
|
62 NS_IMETHODIMP |
|
63 nsDirIndex::SetDescription(const char16_t* aDescription) { |
|
64 mDescription.Assign(aDescription); |
|
65 return NS_OK; |
|
66 } |
|
67 |
|
68 NS_IMPL_GETSET(nsDirIndex, Size, int64_t, mSize) |
|
69 NS_IMPL_GETSET(nsDirIndex, LastModified, PRTime, mLastModified) |
|
70 |