no bug - Correct some typos in the comments. a=typo-fix
[gecko.git] / accessible / base / EmbeddedObjCollector.h
bloba1d29e458f2e75cd5e2fc44b3e9b5790395dd4c0
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #ifndef mozilla_a11y_EmbeddedObjCollector_h__
6 #define mozilla_a11y_EmbeddedObjCollector_h__
8 #include "nsTArray.h"
10 namespace mozilla {
11 namespace a11y {
13 class LocalAccessible;
15 /**
16 * Collect embedded objects. Provide quick access to accessible by index and
17 * vice versa.
19 class EmbeddedObjCollector final {
20 public:
21 ~EmbeddedObjCollector() {}
23 /**
24 * Return index of the given accessible within the collection.
26 int32_t GetIndexAt(LocalAccessible* aAccessible);
28 /**
29 * Return accessible count within the collection.
31 uint32_t Count();
33 /**
34 * Return an accessible from the collection at the given index.
36 LocalAccessible* GetAccessibleAt(uint32_t aIndex);
38 protected:
39 /**
40 * Ensure accessible at the given index is stored and return it.
42 LocalAccessible* EnsureNGetObject(uint32_t aIndex);
44 /**
45 * Ensure index for the given accessible is stored and return it.
47 int32_t EnsureNGetIndex(LocalAccessible* aAccessible);
49 // Make sure it's used by LocalAccessible class only.
50 explicit EmbeddedObjCollector(LocalAccessible* aRoot)
51 : mRoot(aRoot), mRootChildIdx(0) {}
53 /**
54 * Append the object to collection.
56 void AppendObject(LocalAccessible* aAccessible);
58 friend class LocalAccessible;
60 LocalAccessible* mRoot;
61 uint32_t mRootChildIdx;
62 nsTArray<LocalAccessible*> mObjects;
65 } // namespace a11y
66 } // namespace mozilla
68 #endif