Line data Source code
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 :
8 0 : NS_IMPL_ISUPPORTS(nsDirIndex,
9 : nsIDirIndex)
10 :
11 0 : nsDirIndex::nsDirIndex() : mType(TYPE_UNKNOWN),
12 : mSize(UINT64_MAX),
13 0 : mLastModified(-1LL)
14 : {
15 0 : }
16 :
17 0 : nsDirIndex::~nsDirIndex() {}
18 :
19 : NS_IMETHODIMP
20 0 : nsDirIndex::GetType(uint32_t* aType)
21 : {
22 0 : NS_ENSURE_ARG_POINTER(aType);
23 :
24 0 : *aType = mType;
25 0 : return NS_OK;
26 : }
27 :
28 : NS_IMETHODIMP
29 0 : nsDirIndex::SetType(uint32_t aType)
30 : {
31 0 : mType = aType;
32 0 : return NS_OK;
33 : }
34 :
35 : NS_IMETHODIMP
36 0 : nsDirIndex::GetContentType(char* *aContentType)
37 : {
38 0 : NS_ENSURE_ARG_POINTER(aContentType);
39 :
40 0 : *aContentType = ToNewCString(mContentType);
41 0 : if (!*aContentType)
42 0 : return NS_ERROR_OUT_OF_MEMORY;
43 :
44 0 : return NS_OK;
45 : }
46 :
47 : NS_IMETHODIMP
48 0 : nsDirIndex::SetContentType(const char* aContentType)
49 : {
50 0 : mContentType = aContentType;
51 0 : return NS_OK;
52 : }
53 :
54 : NS_IMETHODIMP
55 0 : nsDirIndex::GetLocation(char* *aLocation)
56 : {
57 0 : NS_ENSURE_ARG_POINTER(aLocation);
58 :
59 0 : *aLocation = ToNewCString(mLocation);
60 0 : if (!*aLocation)
61 0 : return NS_ERROR_OUT_OF_MEMORY;
62 :
63 0 : return NS_OK;
64 : }
65 :
66 : NS_IMETHODIMP
67 0 : nsDirIndex::SetLocation(const char* aLocation)
68 : {
69 0 : mLocation = aLocation;
70 0 : return NS_OK;
71 : }
72 :
73 : NS_IMETHODIMP
74 0 : nsDirIndex::GetDescription(char16_t* *aDescription)
75 : {
76 0 : NS_ENSURE_ARG_POINTER(aDescription);
77 :
78 0 : *aDescription = ToNewUnicode(mDescription);
79 0 : if (!*aDescription)
80 0 : return NS_ERROR_OUT_OF_MEMORY;
81 :
82 0 : return NS_OK;
83 : }
84 :
85 : NS_IMETHODIMP
86 0 : nsDirIndex::SetDescription(const char16_t* aDescription)
87 : {
88 0 : mDescription.Assign(aDescription);
89 0 : return NS_OK;
90 : }
91 :
92 : NS_IMETHODIMP
93 0 : nsDirIndex::GetSize(int64_t* aSize)
94 : {
95 0 : NS_ENSURE_ARG_POINTER(aSize);
96 :
97 0 : *aSize = mSize;
98 0 : return NS_OK;
99 : }
100 :
101 : NS_IMETHODIMP
102 0 : nsDirIndex::SetSize(int64_t aSize)
103 : {
104 0 : mSize = aSize;
105 0 : return NS_OK;
106 : }
107 :
108 : NS_IMETHODIMP
109 0 : nsDirIndex::GetLastModified(PRTime* aLastModified)
110 : {
111 0 : NS_ENSURE_ARG_POINTER(aLastModified);
112 :
113 0 : *aLastModified = mLastModified;
114 0 : return NS_OK;
115 : }
116 :
117 : NS_IMETHODIMP
118 0 : nsDirIndex::SetLastModified(PRTime aLastModified)
119 : {
120 0 : mLastModified = aLastModified;
121 0 : return NS_OK;
122 : }
|