2 +----------------------------------------------------------------------+
4 +----------------------------------------------------------------------+
5 | Copyright (c) 2010-present Facebook, Inc. (http://www.facebook.com) |
6 +----------------------------------------------------------------------+
7 | This source file is subject to version 3.01 of the PHP license, |
8 | that is bundled with this package in the file LICENSE, and is |
9 | available through the world-wide-web at the following url: |
10 | http://www.php.net/license/3_01.txt |
11 | If you did not receive a copy of the PHP license and are unable to |
12 | obtain it through the world-wide-web, please send a note to |
13 | license@php.net so we can mail you a copy immediately. |
14 +----------------------------------------------------------------------+
17 #ifndef incl_HPHP_NAMED_ENTITY_PAIR_TABLE_INL_H_
18 #error "named-entity-pair-table-inl.h should only be included by " \
19 "named-entity-pair-table.h"
23 ///////////////////////////////////////////////////////////////////////////////
25 extern StringData
* loadLitstrById(Id id
);
27 ///////////////////////////////////////////////////////////////////////////////
29 inline bool NamedEntityPairTable::contains(Id id
) const {
30 return id
>= 0 && id
< Id(size());
33 inline StringData
* NamedEntityPairTable::lookupLitstr(Id id
) const {
34 assertx(contains(id
));
35 if (auto const ret
= (*this)[id
].get()) {
36 return const_cast<StringData
*>(ret
);
38 return loadLitstrById(id
);
41 inline const NamedEntity
*
42 NamedEntityPairTable::lookupNamedEntity(Id id
) const {
43 return lookupNamedEntityPair(id
).second
;
46 inline NamedEntityPair
47 NamedEntityPairTable::lookupNamedEntityPair(Id id
) const {
48 assertx(contains(id
));
49 auto const name
= lookupLitstr(id
);
52 assertx(name
->data()[0] != '\\');
54 return { name
, NamedEntity::get(name
) };
57 ///////////////////////////////////////////////////////////////////////////////