C/C++ User's Journal Synesis Software STLSoft - ... Robust, Lightweight, Cross-platform, Template Software ... UNIXSTL - Template Software for the UNIX Operating System WinSTL - where the Standard Template Library meets the Win32 API

Main Page   Modules   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

/mappings/STL/reclstl_search_sequence.h

Go to the documentation of this file.
00001 /* 
00002  * File:        reclstl_search_sequence.h
00003  *
00004  * Purpose:     Contains the basic_search_sequence template class, and ANSI
00005  *              and Unicode specialisations thereof.
00006  *
00007  * Created:     10th September 2003
00008  * Updated:     13th October 2003
00009  *
00010  * Author:      Matthew Wilson, Synesis Software Pty Ltd.
00011  *
00012  * License:     (Licensed under the Synesis Software Standard Source License)
00013  *
00014  *              Copyright (C) 2002-2003, Synesis Software Pty Ltd.
00015  *
00016  *              All rights reserved.
00017  *
00018  *              www:        http://www.synesis.com.au/software
00019  *                          http://www.recls.org/
00020  *
00021  *              email:      submissions@recls.org  for submissions
00022  *                          admin@recls.org        for other enquiries
00023  *
00024  *              Redistribution and use in source and binary forms, with or
00025  *              without modification, are permitted provided that the following
00026  *              conditions are met:
00027  *
00028  *              (i) Redistributions of source code must retain the above
00029  *              copyright notice and contact information, this list of
00030  *              conditions and the following disclaimer.
00031  *
00032  *              (ii) Any derived versions of this software (howsoever modified)
00033  *              remain the sole property of Synesis Software.
00034  *
00035  *              (iii) Any derived versions of this software (howsoever modified)
00036  *              remain subject to all these conditions.
00037  *
00038  *              (iv) Neither the name of Synesis Software nor the names of any
00039  *              subdivisions, employees or agents of Synesis Software, nor the
00040  *              names of any other contributors to this software may be used to
00041  *              endorse or promote products derived from this software without
00042  *              specific prior written permission.
00043  *
00044  *              This source code is provided by Synesis Software "as is" and any
00045  *              warranties, whether expressed or implied, including, but not
00046  *              limited to, the implied warranties of merchantability and
00047  *              fitness for a particular purpose are disclaimed. In no event
00048  *              shall the Synesis Software be liable for any direct, indirect,
00049  *              incidental, special, exemplary, or consequential damages
00050  *              (including, but not limited to, procurement of substitute goods
00051  *              or services; loss of use, data, or profits; or business
00052  *              interruption) however caused and on any theory of liability,
00053  *              whether in contract, strict liability, or tort (including
00054  *              negligence or otherwise) arising in any way out of the use of
00055  *              this software, even if advised of the possibility of such
00056  *              damage.
00057  *
00058  * 
00059 
00060 
00061 #ifndef RECLS_INCL_H_WINSTL_SEARCH_SEQUENCE
00062 #define RECLS_INCL_H_WINSTL_SEARCH_SEQUENCE
00063 
00064 #ifndef RECLS_DOCUMENTATION_SKIP_SECTION
00065 # define RECLS_VER_H_WINSTL_SEARCH_SEQUENCE_MAJOR       1
00066 # define RECLS_VER_H_WINSTL_SEARCH_SEQUENCE_MINOR       1
00067 # define RECLS_VER_H_WINSTL_SEARCH_SEQUENCE_REVISION    8
00068 # define RECLS_VER_H_WINSTL_SEARCH_SEQUENCE_EDIT        11
00069 #endif /* !RECLS_DOCUMENTATION_SKIP_SECTION */
00070 
00077 /* 
00078  * Includes
00079  */
00080 
00081 #ifndef RECLS_INCL_H_RECLSTL
00082 # include "reclstl.h"
00083 #endif /* !RECLS_INCL_H_RECLSTL */
00084 #ifndef RECLS_INCL_H_RECLS_ASSERT
00085 # include <recls_assert.h>
00086 #endif /* !RECLS_INCL_H_RECLS_ASSERT */
00087 #ifndef _STLSOFT_INCL_H_STLSOFT_ITERATOR
00088 # include <stlsoft_iterator.h>
00089 #endif /* !_STLSOFT_INCL_H_STLSOFT_ITERATOR */
00090 
00091 #ifndef _STLSOFT_INCL_H_STLSOFT_PROXY_SEQUENCE
00092 # include <inprogress/stlsoft_proxy_sequence.h>
00093 #endif /* !_STLSOFT_INCL_H_STLSOFT_PROXY_SEQUENCE */
00094 
00095 /* 
00096  * Namespace
00097  */
00098 
00099 #if !defined(RECLS_NO_NAMESPACE)
00100 namespace recls
00101 {
00102 
00103 namespace stl
00104 {
00105 #endif /* !RECLS_NO_NAMESPACE */
00106 
00107 /* 
00108  * Forward declarations
00109  */
00110 
00111 #ifndef RECLS_DOCUMENTATION_SKIP_SECTION
00112 
00113 template<   typename C
00114         ,   typename T
00115         >
00116 class basic_search_sequence_value_type;
00117 
00118 template<   typename C
00119         ,   typename T
00120         ,   typename V
00121         >
00122 class basic_search_sequence_const_iterator;
00123 
00124 #endif /* !RECLS_DOCUMENTATION_SKIP_SECTION */
00125 
00126 /* 
00127  * Classes
00128  */
00129 
00133 template <typename C>
00134 struct reclstl_traits
00135 {
00136 public:
00141     typedef void            char_type;
00146     typedef void            *entry_type;
00147 
00148 public:
00150     static hrecls_t         Search(char_type const *searchRoot, char_type const *pattern, recls_uint32_t flags);
00151 
00153     static recls_rc_t       GetDetails(hrecls_t hSrch, entry_type *pinfo);
00155     static recls_rc_t       GetNextDetails(hrecls_t hSrch, entry_type *pinfo);
00156 
00158     static void             CloseDetails(entry_type fileInfo);
00160     static entry_type       CopyDetails(entry_type fileInfo);
00161 
00163     static char_type        *str_copy(char_type *, char_type const *);
00164 };
00165 
00166 #ifndef RECLS_DOCUMENTATION_SKIP_SECTION
00167 template <>
00168 struct reclstl_traits<char>
00169 {
00170 public:
00171     typedef reclstl_traits<char>                traits_type;
00172     typedef char                                char_type;
00173     typedef recls_info_t                        entry_type;
00174     typedef recls_strptrs_t                     strptrs_type;
00175     typedef recls_strptrsptrs_t                 strptrsptrs_type;
00176 
00178     typedef stlsoft::proxy_sequence<    const strptrs_type
00179                                     ,   string_t
00180                                     ,   traits_type // Note, this type also serves as the traits type for the STLSoft proxy_sequence
00181                                     >           directory_parts_type;
00182 
00186     static string_t make_value(strptrs_type const &ptrs)
00187     {
00188         return string_t(ptrs.begin, ptrs.end);
00189     }
00190 
00191 public:
00192     static hrecls_t Search(char_type const *searchRoot, char_type const *pattern, recls_uint32_t flags)
00193     {
00194         hrecls_t    hSrch;
00195         recls_rc_t  rc = Recls_Search(searchRoot, pattern, flags, &hSrch);
00196 
00197         return RECLS_SUCCEEDED(rc) ? hSrch : static_cast<hrecls_t>(NULL);
00198     }
00199 
00200     static recls_rc_t GetDetails(hrecls_t hSrch, entry_type *pinfo)
00201     {
00202         return Recls_GetDetails(hSrch, pinfo);
00203     }
00204 
00205     static recls_rc_t GetNextDetails(hrecls_t hSrch, entry_type *pinfo)
00206     {
00207         return Recls_GetNextDetails(hSrch, pinfo);
00208     }
00209 
00210     static void CloseDetails(entry_type fileInfo)
00211     {
00212         Recls_CloseDetails(fileInfo);
00213     }
00214     static entry_type CopyDetails(entry_type fileInfo)
00215     {
00216         entry_type  infoCopy;
00217 
00218         return RECLS_SUCCEEDED(Recls_CopyDetails(fileInfo, &infoCopy)) ? infoCopy : static_cast<entry_type>(NULL);
00219     }
00220 
00221     static char_type *str_copy(char_type *dest, char_type const *src)
00222     {
00223         return strcpy(dest, src);
00224     }
00225 };
00226 #endif /* !RECLS_DOCUMENTATION_SKIP_SECTION */
00227 
00228 // class basic_search_sequence
00235 template<   typename C
00236 #ifdef __STLSOFT_CF_TEMPLATE_CLASS_DEFAULT_CLASS_ARGUMENT_SUPPORT
00237         ,   typename T = reclstl_traits<C>
00238 #else
00239         ,   typename T /* = reclstl_traits<C> */
00240 #endif /* __STLSOFT_CF_TEMPLATE_CLASS_DEFAULT_CLASS_ARGUMENT_SUPPORT */
00241         >
00242 class basic_search_sequence
00243 {
00246 public:
00248     typedef C                                                       char_type;
00250     typedef T                                                       traits_type;
00252     typedef basic_search_sequence<C, T>                             class_type;
00254     typedef basic_search_sequence_value_type<C, T>                  value_type;
00256     typedef basic_search_sequence_const_iterator<C, T, value_type>  const_iterator;
00258     typedef value_type                                              &reference;
00260     typedef value_type const                                        &const_reference;
00262     typedef ss_typename_type_k traits_type::entry_type              entry_type;
00264     typedef size_t                                                  size_type;
00265 
00267 
00270 public:
00272     basic_search_sequence(char_type const *searchSpec, recls_uint32_t flags);
00274     basic_search_sequence(char_type const *directory, char_type const *searchSpec, recls_uint32_t flags);
00275 
00277 
00280 public:
00284     const_iterator  begin() const;
00288     const_iterator  end() const;
00289 
00291 
00294 public:
00296     size_type           size() const;
00298     recls_bool_t        empty() const;
00300     static size_type    max_size();
00301 
00303 
00306 private:
00307     friend class basic_search_sequence_value_type<C, T>;
00308     friend class basic_search_sequence_const_iterator<C, T, value_type>;
00309 
00310     char_type       m_directory[_MAX_DIR + 1];
00311     char_type       m_search[_MAX_PATH + 1];
00312     recls_uint32_t  m_flags;
00313 
00315 
00316 // Not to be implemented
00317 private:
00318     basic_search_sequence(class_type const &);
00319     basic_search_sequence const &operator =(class_type const &);
00320 };
00321 
00322 /* 
00323  * Typedefs for commonly encountered types
00324  */
00325 
00327 typedef basic_search_sequence<char, reclstl_traits<char> >          search_sequence_a;
00329 typedef basic_search_sequence<wchar_t, reclstl_traits<wchar_t> >    search_sequence_w;
00330 
00331 /* 
00332 
00333 // class basic_search_sequence_value_type
00337 template<   typename C
00338         ,   typename T
00339         >
00340 class basic_search_sequence_value_type
00341 {
00344 public:
00346     typedef C                                                       char_type;
00348     typedef T                                                       traits_type;
00350     typedef basic_search_sequence_value_type<C, T>                  class_type;
00352     typedef ss_typename_type_k traits_type::entry_type              entry_type;
00354     typedef ss_typename_type_k traits_type::directory_parts_type    directory_parts_type;
00355 
00357 
00360 public:
00362     basic_search_sequence_value_type();
00363     basic_search_sequence_value_type(class_type const &rhs);
00364 private:
00365     basic_search_sequence_value_type(entry_type info)
00366         : m_info(info)
00367     {}
00368 public:
00370     ~basic_search_sequence_value_type();
00371 
00373     class_type &operator =(class_type const &rhs);
00374 
00376 
00379 public:
00381     string_t                get_path() const;
00382 #ifdef RECLS_PLATFORM_API_WIN32
00383     char_type               get_drive() const;
00384 #endif /* RECLS_PLATFORM_API_WIN32 */
00386     string_t                get_directory() const;
00388     string_t                get_directory_path() const;
00390     directory_parts_type    get_directory_parts() const;
00392     string_t                get_file() const;
00394     string_t                get_short_file() const;
00396     string_t                get_filename() const;
00398     string_t                get_fileext() const;
00399 
00400     recls_time_t            get_creation_time() const;
00401     recls_time_t            get_modification_time() const;
00402     recls_time_t            get_last_access_time() const;
00403     recls_time_t            get_last_status_change_time() const;
00404 
00405     recls_filesize_t        get_size() const;
00406 
00407     recls_bool_t            is_readonly() const;
00408     recls_bool_t            is_directory() const;
00409     recls_bool_t            is_link() const;
00410 
00412     char_type const         *c_str() const;
00413 
00415     entry_type const        &get_entry() const;
00416 
00418 
00419 // Members
00420 private:
00421     friend class basic_search_sequence_const_iterator<C, T, class_type>;
00422 
00423     entry_type  m_info;
00424 };
00425 
00426 // class basic_search_sequence_const_iterator
00430 template<   typename C
00431         ,   typename T
00432         ,   typename V
00433         >
00434 class basic_search_sequence_const_iterator
00435     : public stlsoft_ns_qual(iterator_base)<stlsoft_ns_qual_std(input_iterator_tag), V, ptrdiff_t, void, V>
00436 {
00437 public:
00439     typedef C                                               char_type;
00441     typedef T                                               traits_type;
00443     typedef V                                               value_type;
00445     typedef basic_search_sequence_const_iterator<C, T, V>   class_type;
00446     typedef stlsoft_define_move_rhs_type(class_type)        rhs_type;
00448     typedef ss_typename_type_k traits_type::entry_type      entry_type;
00449 private:
00450     typedef basic_search_sequence<C, T>                     sequence_type;
00451 
00452 private:
00453     explicit basic_search_sequence_const_iterator(hrecls_t hSrch)
00454         : m_hSrch(hSrch)
00455     {}
00456 public:
00458     basic_search_sequence_const_iterator();
00460     basic_search_sequence_const_iterator(rhs_type rhs);
00462     ~basic_search_sequence_const_iterator();
00463 
00464 public:
00466     class_type &operator ++();
00468     void operator ++(int);
00470     const value_type operator *() const;
00472     recls_bool_t operator ==(class_type const &rhs) const;
00474     recls_bool_t operator !=(class_type const &rhs) const;
00475 
00476 // Members
00477 private:
00478     friend class basic_search_sequence<C, T>;
00479 
00480     hrecls_t    m_hSrch;
00481 
00482 // Not to be implemented
00483 private:
00484     basic_search_sequence_const_iterator &operator =(class_type const &rhs);
00485 };
00486 
00488 // Shims
00489 
00500 template <typename C, typename T>
00501 inline recls_bool_t is_empty(basic_search_sequence<C, T> const &s)
00502 {
00503     return s.empty();
00504 }
00505 
00516 template <typename C, typename T>
00517 #ifndef RECLS_DOCUMENTATION_SKIP_SECTION
00518 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)
00519 #else
00520 inline C const *c_str_ptr(basic_search_sequence_value_type<C, T> const &v)
00521 #endif /* !RECLS_DOCUMENTATION_SKIP_SECTION */
00522 {
00523     return v.c_str();
00524 }
00525 
00527 // Implementation
00528 
00529 #ifndef RECLS_DOCUMENTATION_SKIP_SECTION
00530 
00531 // basic_search_sequence
00532 
00533 // Construction
00534 template <typename C, typename T>
00535 inline basic_search_sequence<C, T>::basic_search_sequence(char_type const *searchSpec, recls_uint32_t flags)
00536     : m_flags(flags)
00537 {
00538     m_directory[0] = '\0';
00539     traits_type::str_copy(m_search, searchSpec);
00540 }
00541 
00542 template <typename C, typename T>
00543 inline basic_search_sequence<C, T>::basic_search_sequence(char_type const *directory, char_type const * searchSpec, recls_uint32_t flags)
00544     : m_flags(flags)
00545 {
00546     traits_type::str_copy(m_directory, directory);
00547     traits_type::str_copy(m_search, searchSpec);
00548 }
00549 
00550 // Iteration
00551 template <typename C, typename T>
00552 inline ss_typename_type_k basic_search_sequence<C, T>::const_iterator basic_search_sequence<C, T>::begin() const
00553 {
00554     return const_iterator(traits_type::Search(m_directory, m_search, m_flags));
00555 }
00556 
00557 template <typename C, typename T>
00558 inline ss_typename_type_k basic_search_sequence<C, T>::const_iterator basic_search_sequence<C, T>::end() const
00559 {
00560     return const_iterator();
00561 }
00562 
00563 // State
00564 template <typename C, typename T>
00565 inline ss_typename_type_k basic_search_sequence<C, T>::size_type basic_search_sequence<C, T>::size() const
00566 {
00567     const_iterator  b   =   begin();
00568     const_iterator  e   =   end();
00569     size_type       c   =   0;
00570 
00571     for(; b != e; ++b)
00572     {
00573         ++c;
00574     }
00575 
00576     return c;
00577 }
00578 
00579 template <typename C, typename T>
00580 inline recls_bool_t basic_search_sequence<C, T>::empty() const
00581 {
00582     return begin() == end();
00583 }
00584 
00585 template <typename C, typename T>
00586 inline /* static */ ss_typename_type_k basic_search_sequence<C, T>::size_type basic_search_sequence<C, T>::max_size()
00587 {
00588     return static_cast<size_type>(-1);
00589 }
00590 
00591 // basic_search_sequence_value_type
00592 
00593 template <typename C, typename T>
00594 inline basic_search_sequence_value_type<C, T>::basic_search_sequence_value_type()
00595     : m_info(NULL)
00596 {}
00597 
00598 template <typename C, typename T>
00599 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)
00600     : m_info(traits_type::CopyDetails(rhs.m_info))
00601 {}
00602 
00603 template <typename C, typename T>
00604 inline basic_search_sequence_value_type<C, T>::~basic_search_sequence_value_type()
00605 {
00606     if(NULL != m_info)
00607     {
00608         traits_type::CloseDetails(m_info);
00609     }
00610 }
00611 
00612 template <typename C, typename T>
00613 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)
00614 {
00615     if(NULL != m_info)
00616     {
00617         traits_type::CloseDetails(m_info);
00618     }
00619 
00620     m_info = traits_type::CopyDetails(rhs.m_info);
00621 
00622     return *this;
00623 }
00624 
00625 template <typename C, typename T>
00626 inline string_t basic_search_sequence_value_type<C, T>::get_path() const
00627 {
00628     recls_assert(NULL != m_info);
00629 
00630     return string_t(m_info->path.begin, m_info->path.end);
00631 }
00632 
00633 #ifdef RECLS_PLATFORM_API_WIN32
00634 template <typename C, typename T>
00635 inline ss_typename_type_k basic_search_sequence_value_type<C, T>::char_type basic_search_sequence_value_type<C, T>::get_drive() const
00636 {
00637     char    chDrive;
00638 
00639     return (Recls_GetDriveProperty(m_info, &chDrive), chDrive);
00640 }
00641 #endif /* RECLS_PLATFORM_API_WIN32 */
00642 
00643 template <typename C, typename T>
00644 inline string_t basic_search_sequence_value_type<C, T>::get_directory() const
00645 {
00646     recls_assert(NULL != m_info);
00647 
00648     return string_t(m_info->directory.begin, m_info->directory.end);
00649 }
00650 
00651 template <typename C, typename T>
00652 inline string_t basic_search_sequence_value_type<C, T>::get_directory_path() const
00653 {
00654     recls_assert(NULL != m_info);
00655 
00656     return string_t(m_info->path.begin, m_info->directory.end);
00657 }
00658 
00659 template <typename C, typename T>
00660 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
00661 {
00662     recls_assert(NULL != m_info);
00663 
00664     return directory_parts_type(m_info->directoryParts.begin, m_info->directoryParts.end);
00665 }
00666 
00667 template <typename C, typename T>
00668 inline string_t basic_search_sequence_value_type<C, T>::get_file() const
00669 {
00670     recls_assert(NULL != m_info);
00671 
00672     return string_t(m_info->fileName.begin, m_info->fileExt.end);
00673 }
00674 
00675 #if 0
00676 template <typename C, typename T>
00677 inline string_t basic_search_sequence_value_type<C, T>::get_short_file() const
00678 {
00679     return m_info.cAlternateFileName[0] != '\0' ? m_info.cAlternateFileName : m_info.cFileName;
00680 }
00681 #endif /* 0 */
00682 
00683 template <typename C, typename T>
00684 inline string_t basic_search_sequence_value_type<C, T>::get_filename() const
00685 {
00686     recls_assert(NULL != m_info);
00687 
00688     return string_t(m_info->fileName.begin, m_info->fileName.end);
00689 }
00690 
00691 template <typename C, typename T>
00692 inline string_t basic_search_sequence_value_type<C, T>::get_fileext() const
00693 {
00694     recls_assert(NULL != m_info);
00695 
00696     return string_t(m_info->fileExt.begin, m_info->fileExt.end);
00697 }
00698 
00699 template <typename C, typename T>
00700 inline recls_time_t basic_search_sequence_value_type<C, T>::get_creation_time() const
00701 {
00702     recls_assert(NULL != m_info);
00703 
00704     return Recls_GetCreationTime(m_info);
00705 }
00706 
00707 template <typename C, typename T>
00708 inline recls_time_t basic_search_sequence_value_type<C, T>::get_modification_time() const
00709 {
00710     recls_assert(NULL != m_info);
00711 
00712     return Recls_GetModificationTime(m_info);
00713 }
00714 
00715 template <typename C, typename T>
00716 inline recls_time_t basic_search_sequence_value_type<C, T>::get_last_access_time() const
00717 {
00718     recls_assert(NULL != m_info);
00719 
00720     return Recls_GetLastAccessTime(m_info);
00721 }
00722 
00723 template <typename C, typename T>
00724 inline recls_time_t basic_search_sequence_value_type<C, T>::get_last_status_change_time() const
00725 {
00726     recls_assert(NULL != m_info);
00727 
00728     return Recls_GetLastStatusChangeTime(m_info);
00729 }
00730 
00731 template <typename C, typename T>
00732 inline recls_filesize_t basic_search_sequence_value_type<C, T>::get_size() const
00733 {
00734     recls_assert(NULL != m_info);
00735 
00736     return m_info->size;
00737 }
00738 
00739 template <typename C, typename T>
00740 inline recls_bool_t basic_search_sequence_value_type<C, T>::is_readonly() const
00741 {
00742     recls_assert(NULL != m_info);
00743 
00744     return Recls_IsFileReadOnly(m_info);
00745 }
00746 
00747 template <typename C, typename T>
00748 inline recls_bool_t basic_search_sequence_value_type<C, T>::is_directory() const
00749 {
00750     recls_assert(NULL != m_info);
00751 
00752     return Recls_IsFileDirectory(m_info);
00753 }
00754 
00755 template <typename C, typename T>
00756 inline recls_bool_t basic_search_sequence_value_type<C, T>::is_link() const
00757 {
00758     recls_assert(NULL != m_info);
00759 
00760     return Recls_IsFileLink(m_info);
00761 }
00762 
00763 template <typename C, typename T>
00764 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
00765 {
00766     recls_assert(NULL != m_info);
00767 
00768     return m_info->path.begin;
00769 }
00770 
00771 template <typename C, typename T>
00772 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
00773 {
00774     return m_info;
00775 }
00776 
00777 // basic_search_sequence_const_iterator
00778 
00779 template <typename C, typename T, typename V>
00780 inline basic_search_sequence_const_iterator<C, T, V>::basic_search_sequence_const_iterator()
00781     : m_hSrch(NULL)
00782 {}
00783 
00784 template <typename C, typename T, typename V>
00785 inline basic_search_sequence_const_iterator<C, T, V>::basic_search_sequence_const_iterator(rhs_type rhs)
00786     : m_hSrch(rhs.m_hSrch)
00787 {
00788     move_lhs_from_rhs(rhs).m_hSrch = NULL;
00789 }
00790 
00791 template <typename C, typename T, typename V>
00792 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)
00793 {
00794     m_hSrch =   rhs.m_hSrch;
00795 
00796     return *this;
00797 }
00798 
00799 template <typename C, typename T, typename V>
00800 inline basic_search_sequence_const_iterator<C, T, V>::~basic_search_sequence_const_iterator()
00801 {
00802     if(NULL != m_hSrch)
00803     {
00804         Recls_SearchClose(m_hSrch);
00805     }
00806 }
00807 
00808 template <typename C, typename T, typename V>
00809 inline ss_typename_type_k basic_search_sequence_const_iterator<C, T, V>::class_type &basic_search_sequence_const_iterator<C, T, V>::operator ++()
00810 {
00811     recls_message_assert("Attempting to increment invalid iterator", NULL != m_hSrch);
00812 
00813     if(RECLS_FAILED(Recls_GetNext(m_hSrch)))
00814     {
00815         Recls_SearchClose(m_hSrch);
00816         m_hSrch = NULL;
00817     }
00818 
00819     return *this;
00820 }
00821 
00822 template <typename C, typename T, typename V>
00823 inline void basic_search_sequence_const_iterator<C, T, V>::operator ++(int)
00824 {
00825     operator ++();
00826 }
00827 
00828 template <typename C, typename T, typename V>
00829 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
00830 {
00831     entry_type  info;
00832 
00833     if( m_hSrch != NULL &&
00834         RECLS_SUCCEEDED(traits_type::GetDetails(m_hSrch, &info)))
00835     {
00836         return value_type(info);
00837     }
00838     else
00839     {
00840         recls_message_assert("Dereferencing end()-valued iterator", 0);
00841 
00842         return value_type();
00843     }
00844 }
00845 
00846 template <typename C, typename T, typename V>
00847 inline recls_bool_t basic_search_sequence_const_iterator<C, T, V>::operator ==(class_type const &rhs) const
00848 {
00849     return (m_hSrch == NULL) && (rhs.m_hSrch == NULL);
00850 }
00851 
00852 template <typename C, typename T, typename V>
00853 inline recls_bool_t basic_search_sequence_const_iterator<C, T, V>::operator !=(class_type const &rhs) const
00854 {
00855     return ! operator ==(rhs);
00856 }
00857 
00858 #endif /* !RECLS_DOCUMENTATION_SKIP_SECTION */
00859 
00860 /* 
00861 
00862 #if !defined(RECLS_NO_NAMESPACE)
00863 } /* namespace stl */
00864 } /* namespace recls */
00865 #endif /* !RECLS_NO_NAMESPACE */
00866 
00867 /* 
00868 
00869 #endif /* RECLS_INCL_H_WINSTL_SEARCH_SEQUENCE */
00870 
00871 /* 

recls Library documentation Synesis Software Pty Ltd, 2001-2003