blob: d51c0524c61e1e035ba18874afa6640b7bef8db9 [file] [log] [blame]
Mike Lockwood5ed68d22010-05-25 19:08:48 -04001/*
2 * Copyright (C) 2010 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef _MTP_CURSOR_H
18#define _MTP_CURSOR_H
19
20#include "MtpTypes.h"
21
22namespace android {
23
24class CursorWindow;
25
26class MtpCursor {
27private:
28 enum {
29 DEVICE = 1,
30 DEVICE_ID = 2,
31 STORAGE = 3,
32 STORAGE_ID = 4,
33 OBJECT = 5,
34 OBJECT_ID = 6,
35 STORAGE_CHILDREN = 7,
36 OBJECT_CHILDREN = 8,
37 };
38
39 MtpClient* mClient;
40 int mQueryType;
41 int mDeviceID;
42 int mStorageID;
43 int mQbjectID;
44 int mColumnCount;
45 int* mColumns;
46
47public:
48 MtpCursor(MtpClient* client, int queryType, int deviceID,
49 int storageID, int objectID, int columnCount, int* columns);
50 virtual ~MtpCursor();
51
52 int fillWindow(CursorWindow* window, int startPos);
53
54private:
55 int fillDevices(CursorWindow* window, int startPos);
56 int fillDevice(CursorWindow* window, int startPos);
57 int fillStorages(CursorWindow* window, int startPos);
58 int fillStorage(CursorWindow* window, int startPos);
59 int fillObjects(CursorWindow* window, int parent, int startPos);
60 int fillObject(CursorWindow* window, int startPos);
61
62 bool fillDevice(CursorWindow* window, MtpDevice* device, int startPos);
63 bool fillStorage(CursorWindow* window, MtpDevice* device,
64 MtpStorageID storageID, int row);
65 bool fillObject(CursorWindow* window, MtpDevice* device,
66 MtpObjectHandle objectID, int row);
67
68 bool prepareRow(CursorWindow* window);
69 bool putLong(CursorWindow* window, int value, int row, int column);
70 bool putString(CursorWindow* window, const char* text, int row, int column);
Mike Lockwood3e072b32010-06-10 16:34:20 -040071 bool putThumbnail(CursorWindow* window, int objectID, int row, int column);
Mike Lockwood5ed68d22010-05-25 19:08:48 -040072};
73
74}; // namespace android
75
76#endif // _MTP_CURSOR_H