/indra/llcommon/llboost.h

https://bitbucket.org/lindenlab/viewer-beta/ · C++ Header · 58 lines · 17 code · 5 blank · 36 comment · 2 complexity · b27e97a44f84a235d69ed036bd7de4ed MD5 · raw file

  1. /**
  2. * @file llboost.h
  3. * @brief helper object & functions for use with boost
  4. *
  5. * $LicenseInfo:firstyear=2005&license=viewerlgpl$
  6. * Second Life Viewer Source Code
  7. * Copyright (C) 2010, Linden Research, Inc.
  8. *
  9. * This library is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU Lesser General Public
  11. * License as published by the Free Software Foundation;
  12. * version 2.1 of the License only.
  13. *
  14. * This library is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * Lesser General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Lesser General Public
  20. * License along with this library; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  22. *
  23. * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
  24. * $/LicenseInfo$
  25. */
  26. #ifndef LL_LLBOOST_H
  27. #define LL_LLBOOST_H
  28. #include <boost/tokenizer.hpp>
  29. // boost_tokenizer typedef
  30. /* example usage:
  31. boost_tokenizer tokens(input_string, boost::char_separator<char>(" \t\n"));
  32. for (boost_tokenizer::iterator token_iter = tokens.begin(); token_iter != tokens.end(); ++token_iter)
  33. {
  34. std::string tok = *token_iter;
  35. process_token_string( tok );
  36. }
  37. */
  38. typedef boost::tokenizer<boost::char_separator<char> > boost_tokenizer;
  39. // Useful combiner for boost signals that return a bool (e.g. validation)
  40. // returns false if any of the callbacks return false
  41. struct boost_boolean_combiner
  42. {
  43. typedef bool result_type;
  44. template<typename InputIterator>
  45. bool operator()(InputIterator first, InputIterator last) const
  46. {
  47. bool res = true;
  48. while (first != last)
  49. res &= *first++;
  50. return res;
  51. }
  52. };
  53. #endif // LL_LLBOOST_H