forked from VoIPGRID/Vialer-pjsip-iOS
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
633 changed files
with
53,939 additions
and
46,933 deletions.
There are no files selected for viewing
Git LFS file not shown
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
/* $Id$ */ | ||
/* | ||
* Copyright (C) 2008-2009 Teluu Inc. (http://www.teluu.com) | ||
* Copyright (C) 2003-2008 Benny Prijono <[email protected]> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
/* $Id$ */ | ||
/* | ||
* Copyright (C) 2008-2009 Teluu Inc. (http://www.teluu.com) | ||
* Copyright (C) 2003-2008 Benny Prijono <[email protected]> | ||
|
@@ -36,44 +35,44 @@ class Pj_Hash_Table : public Pj_Object | |
class iterator | ||
{ | ||
public: | ||
iterator() | ||
iterator() | ||
{ | ||
} | ||
explicit iterator(pj_hash_table_t *h, pj_hash_iterator_t *i) | ||
explicit iterator(pj_hash_table_t *h, pj_hash_iterator_t *i) | ||
: ht_(h), it_(i) | ||
{ | ||
} | ||
iterator(const iterator &rhs) | ||
iterator(const iterator &rhs) | ||
: ht_(rhs.ht_), it_(rhs.it_) | ||
{ | ||
} | ||
void operator++() | ||
void operator++() | ||
{ | ||
it_ = pj_hash_next(ht_, it_); | ||
} | ||
bool operator==(const iterator &rhs) | ||
bool operator==(const iterator &rhs) | ||
{ | ||
return ht_ == rhs.ht_ && it_ == rhs.it_; | ||
} | ||
iterator & operator=(const iterator &rhs) | ||
iterator & operator=(const iterator &rhs) | ||
{ | ||
ht_=rhs.ht_; it_=rhs.it_; | ||
return *this; | ||
} | ||
private: | ||
pj_hash_table_t *ht_; | ||
pj_hash_iterator_t it_val_; | ||
pj_hash_iterator_t *it_; | ||
pj_hash_table_t *ht_; | ||
pj_hash_iterator_t it_val_; | ||
pj_hash_iterator_t *it_; | ||
|
||
friend class Pj_Hash_Table; | ||
friend class Pj_Hash_Table; | ||
}; | ||
|
||
// | ||
// Construct hash table. | ||
// | ||
Pj_Hash_Table(Pj_Pool *pool, unsigned size) | ||
{ | ||
table_ = pj_hash_create(pool->pool_(), size); | ||
table_ = pj_hash_create(pool->pool_(), size); | ||
} | ||
|
||
// | ||
|
@@ -90,23 +89,23 @@ class Pj_Hash_Table : public Pj_Object | |
const void *key, | ||
unsigned keylen = PJ_HASH_KEY_STRING) | ||
{ | ||
return pj_hash_calc(initial_hval, key, keylen); | ||
return pj_hash_calc(initial_hval, key, keylen); | ||
} | ||
|
||
// | ||
// Return pjlib compatible hash table object. | ||
// | ||
pj_hash_table_t *pj_hash_table_t_() | ||
{ | ||
return table_; | ||
return table_; | ||
} | ||
|
||
// | ||
// Get the value associated with the specified key. | ||
// | ||
void *get(const void *key, unsigned keylen = PJ_HASH_KEY_STRING) | ||
{ | ||
return pj_hash_get(table_, key, keylen); | ||
return pj_hash_get(table_, key, keylen); | ||
} | ||
|
||
// | ||
|
@@ -118,39 +117,39 @@ class Pj_Hash_Table : public Pj_Object | |
void *value, | ||
unsigned keylen = PJ_HASH_KEY_STRING) | ||
{ | ||
pj_hash_set(pool->pool_(), table_, key, keylen, value); | ||
pj_hash_set(pool->pool_(), table_, key, keylen, value); | ||
} | ||
|
||
// | ||
// Get number of items in the hash table. | ||
// | ||
unsigned count() | ||
{ | ||
return pj_hash_count(table_); | ||
return pj_hash_count(table_); | ||
} | ||
|
||
// | ||
// Iterate hash table. | ||
// | ||
iterator begin() | ||
{ | ||
iterator it(table_, NULL); | ||
it.it_ = pj_hash_first(table_, &it.it_val_); | ||
return it; | ||
iterator it(table_, NULL); | ||
it.it_ = pj_hash_first(table_, &it.it_val_); | ||
return it; | ||
} | ||
|
||
// | ||
// End of items. | ||
// | ||
iterator end() | ||
{ | ||
return iterator(table_, NULL); | ||
return iterator(table_, NULL); | ||
} | ||
|
||
private: | ||
pj_hash_table_t *table_; | ||
}; | ||
|
||
|
||
#endif /* __PJPP_HASH_HPP__ */ | ||
#endif /* __PJPP_HASH_HPP__ */ | ||
|
Oops, something went wrong.