00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00058
00059
00060
00061
00062 #ifndef RECLS_INCL_RECLS_STL_HPP_RECLS
00063 # include <recls/stl/recls.hpp>
00064 #endif
00065 #ifndef RECLS_INCL_RECLS_STL_HPP_TRAITS
00066 # include <recls/stl/traits.hpp>
00067 #endif
00068 #if defined(RECLS_PLATFORM_IS_UNIX)
00069 # include <unixstl_file_path_buffer.h>
00070 #elif defined(RECLS_PLATFORM_IS_WIN32)
00071 # include <winstl_file_path_buffer.h>
00072 #else
00073 # error Platform not (yet) recognised
00074 #endif
00075 #if !defined(STLSOFT_INCL_H_STLSOFT_SIMPLE_STRING)
00076 # include <stlsoft_simple_string.h>
00077 #endif
00078
00079
00080
00081
00082
00083 #if !defined(RECLS_NO_NAMESPACE)
00084 namespace recls
00085 {
00086
00087 namespace stl
00088 {
00089 #endif
00090
00091 #if defined(RECLS_PLATFORM_IS_WIN32)
00092 typedef winstl::basic_file_path_buffer<recls_char_t> file_path_buffer;
00093 #elif defined(RECLS_PLATFORM_IS_UNIX)
00094 typedef unixstl::basic_file_path_buffer<recls_char_t> file_path_buffer;
00095 #else
00096 # error Platform not (yet) recognised
00097 #endif
00098
00099
00100
00101
00102
00103 #ifndef RECLS_DOCUMENTATION_SKIP_SECTION
00104
00105 template< typename C
00106 , typename T
00107 >
00108 class basic_search_sequence_value_type;
00109
00110 template< typename C
00111 , typename T
00112 , typename V
00113 >
00114 class basic_search_sequence_const_iterator;
00115
00116 #endif
00117
00118
00119
00120
00121
00122 #ifndef RECLS_DOCUMENTATION_SKIP_SECTION
00123 struct rss_shared_handle
00124 {
00125 hrecls_t hSrch;
00126 recls_sint32_t cRefs;
00127
00128 public:
00129 explicit rss_shared_handle(hrecls_t h)
00130 : hSrch(h)
00131 , cRefs(1)
00132 {}
00133 void Release()
00134 {
00135 if(--cRefs == 0)
00136 {
00137 delete this;
00138 }
00139 }
00140 #if defined(__STLSOFT_COMPILER_IS_GCC)
00141 protected:
00142 #else
00143 private:
00144 #endif
00145 ~rss_shared_handle()
00146 {
00147 recls_message_assert("Shared search handle being destroyed with outstanding references!", 0 == cRefs);
00148
00149 if(NULL != hSrch)
00150 {
00151 Recls_SearchClose(hSrch);
00152 }
00153 }
00154 };
00155 #endif
00156
00157
00158
00159
00160
00161
00168
00169 #ifdef __STLSOFT_CF_TEMPLATE_CLASS_DEFAULT_CLASS_ARGUMENT_SUPPORT
00170 , typename T = reclstl_traits<C>
00171 #else
00172 , typename T
00173 #endif
00174 >
00175 class basic_search_sequence
00176 {
00179 public:
00181 typedef C char_type;
00183 typedef T traits_type;
00185 typedef basic_search_sequence<C, T> class_type;
00187 typedef basic_search_sequence_value_type<C, T> value_type;
00189 typedef basic_search_sequence_const_iterator<C, T, value_type> const_iterator;
00191 typedef value_type &reference;
00193 typedef value_type const &const_reference;
00195 typedef ss_typename_type_k traits_type::entry_type entry_type;
00197 typedef size_t size_type;
00199 typedef ptrdiff_t difference_type;
00201 typedef stlsoft::basic_simple_string<C> string_type;
00203
00206 public:
00208 basic_search_sequence(char_type const *pattern, recls_uint32_t flags);
00209 #if defined(__STLSOFT_CF_MEMBER_TEMPLATE_FUNCTION_SUPPORT)
00210
00211 template <typename S>
00212 basic_search_sequence(S const &pattern, recls_uint32_t flags)
00213 : m_directory(copy_or_null_(m_directory_, stlsoft_ns_qual(c_str_ptr)("")))
00214 , m_pattern(copy_or_null_(m_pattern_, stlsoft_ns_qual(c_str_ptr)(pattern)))
00215 , m_flags(flags)
00216 {}
00217 #endif
00218
00219 basic_search_sequence(char_type const *directory, char_type const *pattern, recls_uint32_t flags);
00220 #if defined(__STLSOFT_CF_MEMBER_TEMPLATE_FUNCTION_SUPPORT)
00221
00222 template <typename S1, typename S2>
00223 basic_search_sequence(S1 const &directory, S2 const &pattern, recls_uint32_t flags)
00224 : m_directory(copy_or_null_(m_directory_, stlsoft_ns_qual(c_str_ptr)(directory)))
00225 , m_pattern(copy_or_null_(m_pattern_, stlsoft_ns_qual(c_str_ptr)(pattern)))
00226 , m_flags(flags)
00227 {}
00228 #endif
00229 #if defined(RECLS_API_FTP)
00230
00231 basic_search_sequence(char_type const *host, char_type const *username, char_type const *password, char_type const *directory, char_type const *pattern, recls_uint32_t flags);
00232 #endif
00233
00234 ~basic_search_sequence()
00235 {
00236 stlsoft_static_assert(stlsoft_raw_offsetof(class_type, m_directory_) < stlsoft_raw_offsetof(class_type, m_directory));
00237 stlsoft_static_assert(stlsoft_raw_offsetof(class_type, m_pattern_) < stlsoft_raw_offsetof(class_type, m_pattern));
00238 }
00240
00243 public:
00247 const_iterator begin() const;
00251 const_iterator end() const;
00253
00256 public:
00258 size_type size() const;
00260 recls_bool_t empty() const;
00262 static size_type max_size();
00264
00267 private:
00268 friend class basic_search_sequence_value_type<C, T>;
00269 friend class basic_search_sequence_const_iterator<C, T, value_type>;
00270
00271
00272 static char_type const *copy_or_null_(file_path_buffer &dest, char_type const *src)
00273 {
00274 return (NULL == src) ? static_cast<char_type const*>(NULL) : traits_type::str_copy(&dest[0], src);
00275 }
00276
00277 #if defined(RECLS_API_FTP)
00278 string_type m_host;
00279 string_type m_username;
00280 string_type m_password;
00281 #endif
00282
00283 file_path_buffer m_directory_;
00284 file_path_buffer m_pattern_;
00285 char_type const *const m_directory;
00286 char_type const *const m_pattern;
00287 recls_uint32_t m_flags;
00289
00290
00291 private:
00292 basic_search_sequence(class_type const &);
00293 basic_search_sequence const &operator =(class_type const &);
00294 };
00295
00296
00297
00298
00299
00301 typedef basic_search_sequence<recls_char_a_t, reclstl_traits<recls_char_a_t> > search_sequence_a;
00303 typedef basic_search_sequence<recls_char_w_t, reclstl_traits<recls_char_w_t> > search_sequence_w;
00304
00305
00306
00307
00311
00312
00313
00314
00315
00318
00320
00322
00324
00326
00328
00330
00333
00335
00336
00337
00338
00339
00340
00341
00343
00344
00346
00348
00351
00353
00354
00355
00356
00358 string_t get_directory() const;
00360 string_t get_directory_path() const;
00361 #if defined(RECLS_DOCUMENTATION_SKIP_SECTION) || \
00362 ( RECLS_VER_MAJOR > 1 || \
00363 RECLS_VER_MINOR >= 6)
00364
00365 string_t get_UNC_drive() const;
00366 #endif
00367 #ifndef RECLS_PURE_API
00368
00369 directory_parts_type get_directory_parts() const;
00370 #endif
00371
00372 string_t get_file() const;
00374 string_t get_short_file() const;
00376 string_t get_filename() const;
00378 string_t get_fileext() const;
00379
00380 recls_time_t get_creation_time() const;
00381 recls_time_t get_modification_time() const;
00382 recls_time_t get_last_access_time() const;
00383 recls_time_t get_last_status_change_time() const;
00384
00385 recls_filesize_t get_size() const;
00386
00387 recls_bool_t is_readonly() const;
00388 recls_bool_t is_directory() const;
00389 recls_bool_t is_link() const;
00390 #if defined(RECLS_DOCUMENTATION_SKIP_SECTION) || \
00391 ( RECLS_VER_MAJOR > 1 || \
00392 RECLS_VER_MINOR >= 6)
00393
00394 recls_bool_t is_UNC() const;
00395 #endif
00396
00397 #ifndef RECLS_PURE_API
00398
00399 char_type const *c_str() const;
00400 #endif
00401
00403 entry_type const &get_entry() const;
00405
00407 private:
00408 #ifdef RECLS_PURE_API
00409 static string_t get_string_(size_t (RECLS_CALLCONV_DEFAULT *pfn)(recls_info_t, recls_char_t *, size_t), entry_type info)
00410 {
00411 file_path_buffer buffer;
00412 size_t cch = pfn(info, &buffer[0], buffer.size());
00413
00414 return string_t(&buffer[0], cch);
00415 }
00416 #endif
00417
00418
00419 private:
00420 friend class basic_search_sequence_const_iterator<C, T, class_type>;
00421
00422 entry_type m_info;
00423 };
00424
00425
00429
00430 , typename T
00431 , typename V
00432 >
00433 class basic_search_sequence_const_iterator
00434 : public stlsoft_ns_qual(iterator_base)<stlsoft_ns_qual_std(input_iterator_tag), V, ptrdiff_t, void, V>
00435 {
00436 public:
00438 typedef C char_type;
00440 typedef T traits_type;
00442 typedef V value_type;
00444 typedef basic_search_sequence_const_iterator<C, T, V> class_type;
00446 typedef ss_typename_type_k traits_type::entry_type entry_type;
00447 private:
00448 typedef basic_search_sequence<C, T> sequence_type;
00449
00450 private:
00451 explicit basic_search_sequence_const_iterator(hrecls_t hSrch)
00452 : m_handle(make_handle_(hSrch))
00453 {}
00454 public:
00456 basic_search_sequence_const_iterator();
00458 basic_search_sequence_const_iterator(class_type const &rhs);
00460 ~basic_search_sequence_const_iterator();
00461
00462
00463 basic_search_sequence_const_iterator &operator =(class_type const &rhs);
00464
00465 public:
00467 class_type &operator ++();
00469 void operator ++(int);
00471 const value_type operator *() const;
00473 recls_bool_t operator ==(class_type const &rhs) const;
00475 recls_bool_t operator !=(class_type const &rhs) const;
00476
00477
00478 private:
00479 rss_shared_handle *make_handle_(hrecls_t hSrch);
00480
00481
00482 private:
00483 friend class basic_search_sequence<C, T>;
00484
00485 rss_shared_handle *m_handle;
00486 };
00487
00489
00490
00501 template <typename C, typename T>
00502 inline recls_bool_t is_empty(basic_search_sequence<C, T> const &s)
00503 {
00504 return s.empty();
00505 }
00506
00507 #ifndef RECLS_PURE_API
00518 template <typename C, typename T>
00519 #ifndef RECLS_DOCUMENTATION_SKIP_SECTION
00520 inline ss_typename_type_k basic_search_sequence_value_type<C, T>::char_type const *c_str_ptr(basic_search_sequence_value_type<C, T> const &v)
00521 #else
00522 inline C const *c_str_ptr(basic_search_sequence_value_type<C, T> const &v)
00523 #endif
00524 {
00525 return v.c_str();
00526 }
00527
00528 template <typename C, typename T>
00529 inline size_t c_str_len(basic_search_sequence_value_type<C, T> const &v)
00530 {
00531 return stlsoft_ns_qual(c_str_len)(v.c_str());
00532 }
00533 #endif
00534
00536
00537
00538 template< typename S
00539 , typename C
00540 , typename T
00541 >
00542 inline S &operator <<(S &s, basic_search_sequence_value_type<C, T> const &v)
00543 {
00544 #ifdef RECLS_PURE_API
00545 s << v.c_str();
00546 #else
00547 s << v.get_path();
00548 #endif
00549
00550 return s;
00551 }
00552
00554
00555
00556 #ifndef RECLS_DOCUMENTATION_SKIP_SECTION
00557
00558
00559
00560
00561
00562 template <typename C, typename T>
00563 inline basic_search_sequence<C, T>::basic_search_sequence(char_type const *pattern, recls_uint32_t flags)
00564 : m_directory(copy_or_null_(m_directory_, ""))
00565 , m_pattern(copy_or_null_(m_pattern_, pattern))
00566 , m_flags(flags)
00567 {}
00568
00569 template <typename C, typename T>
00570 inline basic_search_sequence<C, T>::basic_search_sequence(char_type const *directory, char_type const *pattern, recls_uint32_t flags)
00571 : m_directory(copy_or_null_(m_directory_, directory))
00572 , m_pattern(copy_or_null_(m_pattern_, pattern))
00573 , m_flags(flags)
00574 {}
00575
00576 #if defined(RECLS_API_FTP)
00577 template <typename C, typename T>
00578 inline basic_search_sequence<C, T>::basic_search_sequence(char_type const *host, char_type const *username, char_type const *password, char_type const *directory, char_type const *pattern, recls_uint32_t flags)
00579 : m_host(host)
00580 , m_username(username)
00581 , m_password(password)
00582 , m_directory(copy_or_null_(m_directory_, directory))
00583 , m_pattern(copy_or_null_(m_pattern_, pattern))
00584 , m_flags(flags)
00585 {
00586 recls_message_assert("Must specify a hostname if using FTP", (NULL == username && NULL == password) || NULL != host);
00587 }
00588 #endif
00589
00590
00591 template <typename C, typename T>
00592 inline ss_typename_type_k basic_search_sequence<C, T>::const_iterator basic_search_sequence<C, T>::begin() const
00593 {
00594 #if defined(RECLS_API_FTP)
00595 if(m_host.empty())
00596 {
00597 #endif
00598 return const_iterator(traits_type::Search(m_directory, m_pattern, m_flags));
00599 #if defined(RECLS_API_FTP)
00600 }
00601 else
00602 {
00603 return const_iterator(traits_type::SearchFtp(m_host.c_str(), m_username.c_str(), m_password.c_str(), m_directory, m_pattern, m_flags));
00604 }
00605 #endif
00606 }
00607
00608 template <typename C, typename T>
00609 inline ss_typename_type_k basic_search_sequence<C, T>::const_iterator basic_search_sequence<C, T>::end() const
00610 {
00611 return const_iterator();
00612 }
00613
00614
00615 template <typename C, typename T>
00616 inline ss_typename_type_k basic_search_sequence<C, T>::size_type basic_search_sequence<C, T>::size() const
00617 {
00618 const_iterator b = begin();
00619 const_iterator e = end();
00620 size_type c = 0;
00621
00622 for(; b != e; ++b)
00623 {
00624 ++c;
00625 }
00626
00627 return c;
00628 }
00629
00630 template <typename C, typename T>
00631 inline recls_bool_t basic_search_sequence<C, T>::empty() const
00632 {
00633 return begin() == end();
00634 }
00635
00636 template <typename C, typename T>
00637 inline ss_typename_type_k basic_search_sequence<C, T>::size_type basic_search_sequence<C, T>::max_size()
00638 {
00639 return static_cast<size_type>(-1);
00640 }
00641
00642
00643
00644
00645 template <typename C, typename T>
00646 inline basic_search_sequence_value_type<C, T>::basic_search_sequence_value_type()
00647 : m_info(NULL)
00648 {}
00649
00650 template <typename C, typename T>
00651 inline basic_search_sequence_value_type<C, T>::basic_search_sequence_value_type(ss_typename_type_k basic_search_sequence_value_type<C, T>::class_type const &rhs)
00652 : m_info(traits_type::CopyDetails(rhs.m_info))
00653 {}
00654
00655 template <typename C, typename T>
00656 inline basic_search_sequence_value_type<C, T>::~basic_search_sequence_value_type()
00657 {
00658 if(NULL != m_info)
00659 {
00660 traits_type::CloseDetails(m_info);
00661 }
00662 }
00663
00664 template <typename C, typename T>
00665 inline ss_typename_type_k basic_search_sequence_value_type<C, T>::class_type &basic_search_sequence_value_type<C, T>::operator =(ss_typename_type_k basic_search_sequence_value_type<C, T>::class_type const &rhs)
00666 {
00667 if(NULL != m_info)
00668 {
00669 traits_type::CloseDetails(m_info);
00670 }
00671
00672 m_info = traits_type::CopyDetails(rhs.m_info);
00673
00674 return *this;
00675 }
00676
00677 template <typename C, typename T>
00678 inline string_t basic_search_sequence_value_type<C, T>::get_path() const
00679 {
00680 recls_assert(NULL != m_info);
00681
00682 #ifdef RECLS_PURE_API
00683 return get_string_(Recls_GetPathProperty, m_info);
00684 #else
00685 return string_t(m_info->path.begin, m_info->path.end);
00686 #endif
00687 }
00688
00689 #ifdef RECLS_PLATFORM_API_WIN32
00690 template <typename C, typename T>
00691 inline ss_typename_type_k basic_search_sequence_value_type<C, T>::char_type basic_search_sequence_value_type<C, T>::get_drive() const
00692 {
00693 char_type chDrive;
00694
00695 return (Recls_GetDriveProperty(m_info, &chDrive), chDrive);
00696 }
00697 #endif
00698
00699 template <typename C, typename T>
00700 inline string_t basic_search_sequence_value_type<C, T>::get_directory() const
00701 {
00702 recls_assert(NULL != m_info);
00703
00704 #ifdef RECLS_PURE_API
00705 return get_string_(Recls_GetDirectoryProperty, m_info);
00706 #else
00707 return string_t(m_info->directory.begin, m_info->directory.end);
00708 #endif
00709 }
00710
00711 template <typename C, typename T>
00712 inline string_t basic_search_sequence_value_type<C, T>::get_directory_path() const
00713 {
00714 recls_assert(NULL != m_info);
00715
00716 #ifdef RECLS_PURE_API
00717 return get_string_(Recls_GetDirectoryPathProperty, m_info);
00718 #else
00719 return string_t(m_info->path.begin, m_info->directory.end);
00720 #endif
00721 }
00722
00723 #if defined(RECLS_DOCUMENTATION_SKIP_SECTION) || \
00724 ( RECLS_VER_MAJOR > 1 || \
00725 RECLS_VER_MINOR >= 6)
00726 template <typename C, typename T>
00727 inline string_t basic_search_sequence_value_type<C, T>::get_UNC_drive() const
00728 {
00729 recls_assert(NULL != m_info);
00730
00731 #if 0
00732 if(!is_UNC())
00733 {
00734 return string_t();
00735 }
00736 else
00737 {
00738 #ifdef RECLS_PURE_API
00739 string_t directoryPath = get_directory_path();
00740 size_t directoryLen = Recls_GetDirectoryProperty(m_info, NULL, 0);
00741
00742 return string_t(directoryPath, 0, directoryPath.length() - directoryLen);
00743 #else
00744 return string_t(m_info->path.begin, m_info->directory.begin);
00745 #endif
00746 }
00747 #else
00748 # ifdef RECLS_PURE_API
00749 return get_string_(Recls_GetUNCDriveProperty, m_info);
00750 # else
00751 return string_t(m_info->path.begin, m_info->directory.begin);
00752 # endif
00753 #endif
00754 }
00755 #endif
00756
00757 #ifndef RECLS_PURE_API
00758 template <typename C, typename T>
00759 inline ss_typename_type_k basic_search_sequence_value_type<C, T>::directory_parts_type basic_search_sequence_value_type<C, T>::get_directory_parts() const
00760 {
00761 recls_assert(NULL != m_info);
00762
00763 return directory_parts_type(m_info->directoryParts.begin, m_info->directoryParts.end);
00764 }
00765 #endif
00766
00767 template <typename C, typename T>
00768 inline string_t basic_search_sequence_value_type<C, T>::get_file() const
00769 {
00770 recls_assert(NULL != m_info);
00771
00772 #ifdef RECLS_PURE_API
00773 return get_string_(Recls_GetFileProperty, m_info);
00774 #else
00775 return string_t(m_info->fileName.begin, m_info->fileExt.end);
00776 #endif
00777 }
00778
00779 #if 0
00780 template <typename C, typename T>
00781 inline string_t basic_search_sequence_value_type<C, T>::get_short_file() const
00782 {
00783 return m_info.cAlternateFileName[0] != '\0' ? m_info.cAlternateFileName : m_info.cFileName;
00784 }
00785 #endif
00786
00787 template <typename C, typename T>
00788 inline string_t basic_search_sequence_value_type<C, T>::get_filename() const
00789 {
00790 recls_assert(NULL != m_info);
00791
00792 #ifdef RECLS_PURE_API
00793 return get_string_(Recls_GetFileNameProperty, m_info);
00794 #else
00795 return string_t(m_info->fileName.begin, m_info->fileName.end);
00796 #endif
00797 }
00798
00799 template <typename C, typename T>
00800 inline string_t basic_search_sequence_value_type<C, T>::get_fileext() const
00801 {
00802 recls_assert(NULL != m_info);
00803
00804 #ifdef RECLS_PURE_API
00805 return get_string_(Recls_GetFileExtProperty, m_info);
00806 #else
00807 return string_t(m_info->fileExt.begin, m_info->fileExt.end);
00808 #endif
00809 }
00810
00811 template <typename C, typename T>
00812 inline recls_time_t basic_search_sequence_value_type<C, T>::get_creation_time() const
00813 {
00814 recls_assert(NULL != m_info);
00815
00816 return Recls_GetCreationTime(m_info);
00817 }
00818
00819 template <typename C, typename T>
00820 inline recls_time_t basic_search_sequence_value_type<C, T>::get_modification_time() const
00821 {
00822 recls_assert(NULL != m_info);
00823
00824 return Recls_GetModificationTime(m_info);
00825 }
00826
00827 template <typename C, typename T>
00828 inline recls_time_t basic_search_sequence_value_type<C, T>::get_last_access_time() const
00829 {
00830 recls_assert(NULL != m_info);
00831
00832 return Recls_GetLastAccessTime(m_info);
00833 }
00834
00835 template <typename C, typename T>
00836 inline recls_time_t basic_search_sequence_value_type<C, T>::get_last_status_change_time() const
00837 {
00838 recls_assert(NULL != m_info);
00839
00840 return Recls_GetLastStatusChangeTime(m_info);
00841 }
00842
00843 template <typename C, typename T>
00844 inline recls_filesize_t basic_search_sequence_value_type<C, T>::get_size() const
00845 {
00846 recls_assert(NULL != m_info);
00847
00848 #ifdef RECLS_PURE_API
00849 recls_filesize_t size;
00850
00851 return (Recls_GetSizeProperty(m_info, &size), size);
00852 #else
00853 return m_info->size;
00854 #endif
00855 }
00856
00857 template <typename C, typename T>
00858 inline recls_bool_t basic_search_sequence_value_type<C, T>::is_readonly() const
00859 {
00860 recls_assert(NULL != m_info);
00861
00862 return Recls_IsFileReadOnly(m_info);
00863 }
00864
00865 template <typename C, typename T>
00866 inline recls_bool_t basic_search_sequence_value_type<C, T>::is_directory() const
00867 {
00868 recls_assert(NULL != m_info);
00869
00870 return Recls_IsFileDirectory(m_info);
00871 }
00872
00873 template <typename C, typename T>
00874 inline recls_bool_t basic_search_sequence_value_type<C, T>::is_link() const
00875 {
00876 recls_assert(NULL != m_info);
00877
00878 return Recls_IsFileLink(m_info);
00879 }
00880
00881 #if defined(RECLS_DOCUMENTATION_SKIP_SECTION) || \
00882 ( RECLS_VER_MAJOR > 1 || \
00883 RECLS_VER_MINOR >= 6)
00884 template <typename C, typename T>
00885 inline recls_bool_t basic_search_sequence_value_type<C, T>::is_UNC() const
00886 {
00887 recls_assert(NULL != m_info);
00888
00889 return Recls_IsFileUNC(m_info);
00890 }
00891 #endif
00892
00893 #ifndef RECLS_PURE_API
00894 template <typename C, typename T>
00895 inline ss_typename_type_k basic_search_sequence_value_type<C, T>::char_type const * basic_search_sequence_value_type<C, T>::c_str() const
00896 {
00897 recls_assert(NULL != m_info);
00898
00899 return m_info->path.begin;
00900 }
00901 #endif
00902
00903 template <typename C, typename T>
00904 inline ss_typename_type_k basic_search_sequence_value_type<C, T>::entry_type const &basic_search_sequence_value_type<C, T>::get_entry() const
00905 {
00906 return m_info;
00907 }
00908
00909
00910
00911 template <typename C, typename T, typename V>
00912 inline rss_shared_handle *basic_search_sequence_const_iterator<C, T, V>::make_handle_(hrecls_t hSrch)
00913 {
00914 return (NULL != hSrch) ? new rss_shared_handle(hSrch) : static_cast<rss_shared_handle*>(NULL);
00915 }
00916
00917 template <typename C, typename T, typename V>
00918 inline basic_search_sequence_const_iterator<C, T, V>::basic_search_sequence_const_iterator()
00919 : m_handle(NULL)
00920 {}
00921
00922 template <typename C, typename T, typename V>
00923 inline basic_search_sequence_const_iterator<C, T, V>::basic_search_sequence_const_iterator(class_type const &rhs)
00924 : m_handle(rhs.m_handle)
00925 {
00926 if(NULL != m_handle)
00927 {
00928 ++m_handle->cRefs;
00929 }
00930 }
00931
00932 template <typename C, typename T, typename V>
00933 inline ss_typename_type_k basic_search_sequence_const_iterator<C, T, V>::class_type &basic_search_sequence_const_iterator<C, T, V>::operator =(typename basic_search_sequence_const_iterator<C, T, V>::class_type const &rhs)
00934 {
00935 if(NULL != m_handle)
00936 {
00937 m_handle->Release();
00938 }
00939
00940 m_handle = rhs.m_handle;
00941
00942 if(NULL != m_handle)
00943 {
00944 ++m_handle->cRefs;
00945 }
00946
00947 return *this;
00948 }
00949
00950 template <typename C, typename T, typename V>
00951 inline basic_search_sequence_const_iterator<C, T, V>::~basic_search_sequence_const_iterator()
00952 {
00953 if(NULL != m_handle)
00954 {
00955 m_handle->Release();
00956 }
00957 }
00958
00959 template <typename C, typename T, typename V>
00960 inline ss_typename_type_k basic_search_sequence_const_iterator<C, T, V>::class_type &basic_search_sequence_const_iterator<C, T, V>::operator ++()
00961 {
00962 recls_message_assert("Attempting to increment invalid iterator", NULL != m_handle);
00963
00964 if(RECLS_FAILED(Recls_GetNext(m_handle->hSrch)))
00965 {
00966 m_handle->Release();
00967
00968 m_handle = NULL;
00969 }
00970
00971 return *this;
00972 }
00973
00974 template <typename C, typename T, typename V>
00975 inline void basic_search_sequence_const_iterator<C, T, V>::operator ++(int)
00976 {
00977 operator ++();
00978 }
00979
00980 template <typename C, typename T, typename V>
00981 inline const ss_typename_type_k basic_search_sequence_const_iterator<C, T, V>::value_type basic_search_sequence_const_iterator<C, T, V>::operator *() const
00982 {
00983 entry_type info;
00984
00985 recls_message_assert("Attempting to dereference invalid iterator", NULL != m_handle);
00986
00987 if( m_handle->hSrch != NULL &&
00988 RECLS_SUCCEEDED(traits_type::GetDetails(m_handle->hSrch, &info)))
00989 {
00990 return value_type(info);
00991 }
00992 else
00993 {
00994 recls_message_assert("Dereferencing end()-valued iterator", 0);
00995
00996 return value_type();
00997 }
00998 }
00999
01000 template <typename C, typename T, typename V>
01001 inline recls_bool_t basic_search_sequence_const_iterator<C, T, V>::operator ==(class_type const &rhs) const
01002 {
01003 return (m_handle == NULL) && (rhs.m_handle == NULL);
01004 }
01005
01006 template <typename C, typename T, typename V>
01007 inline recls_bool_t basic_search_sequence_const_iterator<C, T, V>::operator !=(class_type const &rhs) const
01008 {
01009 return ! operator ==(rhs);
01010 }
01011
01012 #endif
01013
01014
01015
01016
01017
01018 }
01019
01020
01021 namespace stlsoft
01022 {
01023 using recls::stl::is_empty;
01024 #ifndef RECLS_PURE_API
01025 using recls::stl::c_str_ptr;
01026 using recls::stl::c_str_len;
01027 #endif
01028
01029 }
01030 #endif
01031
01032
01033
01034
01035
01036