Public Member Functions | |
Context_Iteration (Binding_Iterator &iterator) | |
int | next_n (u_long how_many, Binding_List &list) |
Next how_many entries. |
|
Definition at line 855 of file Registry.cpp.
00856 : Iteration_State (iter) 00857 { 00858 } |
|
Next how_many entries.
Implements ACE_Registry::Binding_Iterator::Iteration_State. Definition at line 1009 of file Registry.cpp. References ACE_TCHAR, ACE_Registry::Binding_List, ACE_Registry::Binding_Iterator::current_enumeration(), and ACE_Unbounded_Set< T >::insert().
01011 { 01012 // Make a copy 01013 u_long requested = how_many; 01014 01015 // While there are more entries to be added to the list 01016 while (how_many > 0) 01017 { 01018 ACE_TCHAR string [ACE_Registry::Naming_Context::MAX_CONTEXT_NAME_SIZE]; 01019 u_long size = sizeof string / sizeof (ACE_TCHAR); 01020 long result = ACE_TEXT_RegEnumKeyEx (this->parent_->naming_context (). key (), 01021 this->index_, 01022 string, 01023 &size, 01024 0, 01025 0, 01026 0, 01027 0); 01028 switch (result) 01029 { 01030 case ERROR_SUCCESS: 01031 // Object found 01032 { 01033 // Readjust counters 01034 this->index_++; 01035 how_many--; 01036 01037 // Add to list 01038 // Create binding 01039 Binding binding (string, CONTEXT); 01040 // Add to binding list 01041 list.insert (binding); 01042 } 01043 // Continue to add to list 01044 break; 01045 01046 case ERROR_NO_MORE_ITEMS: 01047 // Enumeration of objects complete 01048 01049 /* FALL THROUGH */ 01050 01051 default: 01052 // Strange error 01053 01054 // Reset index 01055 this->index_ = 0; 01056 // Current enumeration will become CONTEXTS 01057 this->parent_->current_enumeration (this->parent_->iteration_complete_); 01058 01059 // If we were able to add contexts 01060 if (requested != how_many) 01061 return 0; 01062 else 01063 return -1; 01064 } 01065 } 01066 // If we reach here, all of <how_many> pairs were added to the list 01067 // Since more entries may be available 01068 // current enumeration will remain CONTEXTS 01069 return 0; 01070 } |