Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
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/. */
6 #include "nsDirIndex.h"
7 #include "nsISupportsObsolete.h"
9 NS_IMPL_ISUPPORTS(nsDirIndex,
10 nsIDirIndex)
12 nsDirIndex::nsDirIndex() : mType(TYPE_UNKNOWN),
13 mSize(UINT64_MAX),
14 mLastModified(-1) {
15 }
17 nsDirIndex::~nsDirIndex() {}
19 NS_IMPL_GETSET(nsDirIndex, Type, uint32_t, mType)
21 // GETSET macros for modern strings would be nice...
23 NS_IMETHODIMP
24 nsDirIndex::GetContentType(char* *aContentType) {
25 *aContentType = ToNewCString(mContentType);
26 if (!*aContentType)
27 return NS_ERROR_OUT_OF_MEMORY;
29 return NS_OK;
30 }
32 NS_IMETHODIMP
33 nsDirIndex::SetContentType(const char* aContentType) {
34 mContentType = aContentType;
35 return NS_OK;
36 }
38 NS_IMETHODIMP
39 nsDirIndex::GetLocation(char* *aLocation) {
40 *aLocation = ToNewCString(mLocation);
41 if (!*aLocation)
42 return NS_ERROR_OUT_OF_MEMORY;
44 return NS_OK;
45 }
47 NS_IMETHODIMP
48 nsDirIndex::SetLocation(const char* aLocation) {
49 mLocation = aLocation;
50 return NS_OK;
51 }
53 NS_IMETHODIMP
54 nsDirIndex::GetDescription(char16_t* *aDescription) {
55 *aDescription = ToNewUnicode(mDescription);
56 if (!*aDescription)
57 return NS_ERROR_OUT_OF_MEMORY;
59 return NS_OK;
60 }
62 NS_IMETHODIMP
63 nsDirIndex::SetDescription(const char16_t* aDescription) {
64 mDescription.Assign(aDescription);
65 return NS_OK;
66 }
68 NS_IMPL_GETSET(nsDirIndex, Size, int64_t, mSize)
69 NS_IMPL_GETSET(nsDirIndex, LastModified, PRTime, mLastModified)